Applied default Visual Studio formatting to most files. This is a quick fix for the tabs vs spaces issue that messes up the formatting in any editor (esp. Linux) which handles tabs/spaces differently to Visual Studio. Some parts of the formatting look a bit worse but overall it should be better (or at least more consistent).
I didn't apply the changes to a few macro-heavy files as Visual Studio removes all indentation from macros, whereas the indentation can be handy to see nesting.
This commit is contained in:
@ -26,13 +26,13 @@
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
namespace
|
||||
namespace
|
||||
{
|
||||
/**
|
||||
* This is just an implementation class for the pickVoxel function
|
||||
*
|
||||
*
|
||||
* It makes note of the sort of empty voxel you're looking for in the constructor.
|
||||
*
|
||||
*
|
||||
* Each time the operator() is called:
|
||||
* * if it's hit a voxel it sets up the result and returns false
|
||||
* * otherwise it preps the result for the next iteration and returns true
|
||||
@ -43,43 +43,43 @@ namespace PolyVox
|
||||
public:
|
||||
RaycastPickingFunctor(const typename VolumeType::VoxelType& emptyVoxelExample)
|
||||
:m_emptyVoxelExample(emptyVoxelExample)
|
||||
,m_result()
|
||||
, m_result()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool operator()(const typename VolumeType::Sampler& sampler)
|
||||
{
|
||||
if(sampler.getVoxel() != m_emptyVoxelExample) //If we've hit something
|
||||
if (sampler.getVoxel() != m_emptyVoxelExample) //If we've hit something
|
||||
{
|
||||
m_result.didHit = true;
|
||||
m_result.hitVoxel = sampler.getPosition();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
m_result.previousVoxel = sampler.getPosition();
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
const typename VolumeType::VoxelType& m_emptyVoxelExample;
|
||||
PickResult m_result;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \param volData The volume to pass the ray though
|
||||
* \param v3dStart The start position in the volume
|
||||
* \param v3dDirectionAndLength The direction and length of the ray
|
||||
* \param emptyVoxelExample The value used to represent empty voxels in your volume
|
||||
*
|
||||
*
|
||||
* \return A PickResult containing the hit information
|
||||
*/
|
||||
template<typename VolumeType>
|
||||
PickResult pickVoxel(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirectionAndLength, const typename VolumeType::VoxelType& emptyVoxelExample)
|
||||
{
|
||||
RaycastPickingFunctor<VolumeType> functor(emptyVoxelExample);
|
||||
|
||||
|
||||
raycastWithDirection(volData, v3dStart, v3dDirectionAndLength, functor);
|
||||
|
||||
|
||||
return functor.m_result;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user