Replaced temporary use of MyClassname.
This commit is contained in:
parent
bedd09af18
commit
c8ba433b88
@ -90,9 +90,9 @@ namespace PolyVox
|
|||||||
v3dRayDirection *= fRayLength;
|
v3dRayDirection *= fRayLength;
|
||||||
|
|
||||||
AmbientOcclusionCalculatorRaycastCallback<IsVoxelTransparentCallback> ambientOcclusionCalculatorRaycastCallback(isVoxelTransparentCallback);
|
AmbientOcclusionCalculatorRaycastCallback<IsVoxelTransparentCallback> ambientOcclusionCalculatorRaycastCallback(isVoxelTransparentCallback);
|
||||||
MyRaycastResult result = raycastWithDirection(volInput, v3dRayStart, v3dRayDirection, ambientOcclusionCalculatorRaycastCallback);
|
RaycastResult result = raycastWithDirection(volInput, v3dRayStart, v3dRayDirection, ambientOcclusionCalculatorRaycastCallback);
|
||||||
|
|
||||||
if(result == MyRaycastResults::Completed)
|
if(result == RaycastResults::Completed)
|
||||||
{
|
{
|
||||||
++uVisibleDirections;
|
++uVisibleDirections;
|
||||||
}
|
}
|
||||||
|
@ -28,15 +28,15 @@ freely, subject to the following restrictions:
|
|||||||
|
|
||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
namespace MyRaycastResults
|
namespace RaycastResults
|
||||||
{
|
{
|
||||||
enum MyRaycastResult
|
enum RaycastResult
|
||||||
{
|
{
|
||||||
Completed,
|
Completed,
|
||||||
Interupted
|
Interupted
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
typedef MyRaycastResults::MyRaycastResult MyRaycastResult;
|
typedef RaycastResults::RaycastResult RaycastResult;
|
||||||
|
|
||||||
/// OUT OF DATE SINCE UNCLASSING
|
/// OUT OF DATE SINCE UNCLASSING
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -87,10 +87,10 @@ namespace PolyVox
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
template<typename VolumeType, typename Callback>
|
template<typename VolumeType, typename Callback>
|
||||||
MyRaycastResult raycastWithEndpoints(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dEnd, Callback& callback);
|
RaycastResult raycastWithEndpoints(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dEnd, Callback& callback);
|
||||||
|
|
||||||
template<typename VolumeType, typename Callback>
|
template<typename VolumeType, typename Callback>
|
||||||
MyRaycastResult raycastWithDirection(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirectionAndLength, Callback& callback);
|
RaycastResult raycastWithDirection(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirectionAndLength, Callback& callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "PolyVoxCore/Raycast.inl"
|
#include "PolyVoxCore/Raycast.inl"
|
||||||
|
@ -53,7 +53,7 @@ namespace PolyVox
|
|||||||
//
|
//
|
||||||
// This error was reported by Joey Hammer (PixelActive).
|
// This error was reported by Joey Hammer (PixelActive).
|
||||||
template<typename VolumeType, typename Callback>
|
template<typename VolumeType, typename Callback>
|
||||||
MyRaycastResult raycastWithEndpoints(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dEnd, Callback& callback)
|
RaycastResult raycastWithEndpoints(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dEnd, Callback& callback)
|
||||||
{
|
{
|
||||||
VolumeType::Sampler sampler(volData);
|
VolumeType::Sampler sampler(volData);
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ namespace PolyVox
|
|||||||
{
|
{
|
||||||
if(!callback(sampler))
|
if(!callback(sampler))
|
||||||
{
|
{
|
||||||
return MyRaycastResults::Interupted;
|
return RaycastResults::Interupted;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tx <= ty && tx <= tz)
|
if(tx <= ty && tx <= tz)
|
||||||
@ -126,11 +126,11 @@ namespace PolyVox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return MyRaycastResults::Completed;
|
return RaycastResults::Completed;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename VolumeType, typename Callback>
|
template<typename VolumeType, typename Callback>
|
||||||
MyRaycastResult raycastWithDirection(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirectionAndLength, Callback& callback)
|
RaycastResult raycastWithDirection(VolumeType* volData, const Vector3DFloat& v3dStart, const Vector3DFloat& v3dDirectionAndLength, Callback& callback)
|
||||||
{
|
{
|
||||||
Vector3DFloat v3dEnd = v3dStart + v3dDirectionAndLength;
|
Vector3DFloat v3dEnd = v3dStart + v3dDirectionAndLength;
|
||||||
return raycastWithEndpoints<VolumeType, Callback>(volData, v3dStart, v3dEnd, callback);
|
return raycastWithEndpoints<VolumeType, Callback>(volData, v3dStart, v3dEnd, callback);
|
||||||
|
@ -38,10 +38,10 @@ using namespace PolyVox;
|
|||||||
// ray has hit a solid voxel). Because the instance of this class is passed to the raycast() function
|
// ray has hit a solid voxel). Because the instance of this class is passed to the raycast() function
|
||||||
// by reference we can also use it to encapsulate some state. We're testing this by counting the total
|
// by reference we can also use it to encapsulate some state. We're testing this by counting the total
|
||||||
// number of voxels touched.
|
// number of voxels touched.
|
||||||
class MyFunctor
|
class RaycastTestFunctor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyFunctor()
|
RaycastTestFunctor()
|
||||||
:m_uTotalVoxelsTouched(0)
|
:m_uTotalVoxelsTouched(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ void TestRaycast::testExecute()
|
|||||||
|
|
||||||
// For demonstration purposes we are using the same function object for all raycasts.
|
// For demonstration purposes we are using the same function object for all raycasts.
|
||||||
// Therefore, the state it maintains (total voxels touched) is accumulated over all raycsts.
|
// Therefore, the state it maintains (total voxels touched) is accumulated over all raycsts.
|
||||||
MyFunctor myFunctor;
|
RaycastTestFunctor raycastTestFunctor;
|
||||||
|
|
||||||
// We could have counted the total number of hits in the same way as the total number of voxels
|
// We could have counted the total number of hits in the same way as the total number of voxels
|
||||||
// touched, but for demonstration and testing purposes we are making use of the raycast return value
|
// touched, but for demonstration and testing purposes we are making use of the raycast return value
|
||||||
@ -95,9 +95,9 @@ void TestRaycast::testExecute()
|
|||||||
// Cast a large number of random rays
|
// Cast a large number of random rays
|
||||||
for(int ct = 0; ct < 1000000; ct++)
|
for(int ct = 0; ct < 1000000; ct++)
|
||||||
{
|
{
|
||||||
MyRaycastResult result = raycastWithDirection(&volData, start, randomUnitVectors[ct % 1024] * 1000.0f, myFunctor);
|
RaycastResult result = raycastWithDirection(&volData, start, randomUnitVectors[ct % 1024] * 1000.0f, raycastTestFunctor);
|
||||||
|
|
||||||
if(result == MyRaycastResults::Interupted)
|
if(result == RaycastResults::Interupted)
|
||||||
{
|
{
|
||||||
hits++;
|
hits++;
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ void TestRaycast::testExecute()
|
|||||||
QCOMPARE(hits, 687494);
|
QCOMPARE(hits, 687494);
|
||||||
|
|
||||||
// Check the total number of voxels touched
|
// Check the total number of voxels touched
|
||||||
QCOMPARE(myFunctor.m_uTotalVoxelsTouched, static_cast<uint32_t>(486219343));
|
QCOMPARE(raycastTestFunctor.m_uTotalVoxelsTouched, static_cast<uint32_t>(486219343));
|
||||||
}
|
}
|
||||||
|
|
||||||
QTEST_MAIN(TestRaycast)
|
QTEST_MAIN(TestRaycast)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user