#pragma once #include "PolyVoxCore/Raycast.h" #include "PolyVoxCore/SimpleVolume.h" using namespace PolyVox; class RaycastIntersectionFinder { public: RaycastIntersectionFinder(void); ~RaycastIntersectionFinder(void); bool operator()(const SimpleVolume::Sampler& sampler) { // Store this so we can retrieve it later // If the ray is inside the volume then check if it has hit a solid voxel. if(sampler.getVoxel() > 0) // You can replace this with your own condition if you want to. { // We've hit something, so stop traversing. v3dLastPosition = sampler.getPosition(); bFoundIntersection=true; return false; } bFoundIntersection=false; // By default we continue traversing. return true; } bool bFoundIntersection; Vector3DInt32 v3dLastPosition; };