godot_voxel/voxel_raycast.h

17 lines
461 B
C
Raw Normal View History

2017-03-26 11:07:01 -07:00
#include "vector3i.h"
2018-09-19 12:25:04 -07:00
#include <core/math/vector3.h>
2017-03-26 11:07:01 -07:00
2017-08-12 16:19:39 -07:00
// TODO that could be a template function
2017-03-26 11:07:01 -07:00
// pos: voxel position
// context: arguments to carry (as a lamdbda capture)
2017-08-12 16:19:39 -07:00
typedef bool (*VoxelPredicate)(Vector3i pos, void *context);
2017-03-26 11:07:01 -07:00
bool voxel_raycast(
2017-08-12 16:19:39 -07:00
Vector3 ray_origin,
Vector3 ray_direction,
VoxelPredicate predicate,
void *predicate_context, // Handle that one with care
real_t max_distance,
Vector3i &out_hit_pos,
Vector3i &out_prev_pos);