Tweaks to SpuBatchRaycast code
This commit is contained in:
@@ -16,23 +16,39 @@ subject to the following restrictions:
|
|||||||
#include <new>
|
#include <new>
|
||||||
#include "SpuBatchRaycaster.h"
|
#include "SpuBatchRaycaster.h"
|
||||||
|
|
||||||
SpuBatchRaycaster::SpuBatchRaycaster (class btThreadSupportInterface* threadInterface, int maxNumOutstandingTasks, btCollisionObjectArray& castUponObjects, int numCastUponObjects)
|
SpuBatchRaycaster::SpuBatchRaycaster (class btThreadSupportInterface* threadInterface, int maxNumOutstandingTasks)
|
||||||
{
|
{
|
||||||
numCastUponObjectWrappers = numCastUponObjects;
|
|
||||||
m_threadInterface = threadInterface;
|
m_threadInterface = threadInterface;
|
||||||
|
|
||||||
castUponObjectWrappers = new SpuCollisionObjectWrapper[numCastUponObjects];
|
castUponObjectWrappers = NULL;
|
||||||
|
numCastUponObjectWrappers = 0;
|
||||||
for (int i = 0; i < numCastUponObjectWrappers; i++)
|
|
||||||
{
|
|
||||||
new (&castUponObjectWrappers[i]) SpuCollisionObjectWrapper(castUponObjects[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_spuRaycastTaskProcess = new SpuRaycastTaskProcess(m_threadInterface,maxNumOutstandingTasks); // FIXME non constant
|
m_spuRaycastTaskProcess = new SpuRaycastTaskProcess(m_threadInterface,maxNumOutstandingTasks); // FIXME non constant
|
||||||
}
|
}
|
||||||
|
|
||||||
SpuBatchRaycaster::~SpuBatchRaycaster ()
|
SpuBatchRaycaster::~SpuBatchRaycaster ()
|
||||||
{
|
{
|
||||||
|
if (castUponObjectWrappers)
|
||||||
|
{
|
||||||
|
delete [] castUponObjectWrappers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SpuBatchRaycaster::setCollisionObjects (btCollisionObjectArray& castUponObjects, int numCastUponObjects)
|
||||||
|
{
|
||||||
|
if (castUponObjectWrappers)
|
||||||
|
{
|
||||||
|
delete [] castUponObjectWrappers;
|
||||||
|
}
|
||||||
|
|
||||||
|
castUponObjectWrappers = new SpuCollisionObjectWrapper[numCastUponObjects];
|
||||||
|
numCastUponObjectWrappers = numCastUponObjects;
|
||||||
|
|
||||||
|
for (int i = 0; i < numCastUponObjectWrappers; i++)
|
||||||
|
{
|
||||||
|
new (&castUponObjectWrappers[i]) SpuCollisionObjectWrapper(castUponObjects[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -35,8 +35,10 @@ protected:
|
|||||||
SpuRaycastTaskProcess* m_spuRaycastTaskProcess;
|
SpuRaycastTaskProcess* m_spuRaycastTaskProcess;
|
||||||
class btThreadSupportInterface* m_threadInterface;
|
class btThreadSupportInterface* m_threadInterface;
|
||||||
public:
|
public:
|
||||||
SpuBatchRaycaster (class btThreadSupportInterface* threadInterface, int maxNumOutstandingTasks, btCollisionObjectArray& castUponObjects, int numCastUponObjects);
|
SpuBatchRaycaster (class btThreadSupportInterface* threadInterface, int maxNumOutstandingTasks);
|
||||||
~SpuBatchRaycaster ();
|
~SpuBatchRaycaster ();
|
||||||
|
void setCollisionObjects (btCollisionObjectArray& castUponObjects, int numCastUponObjects);
|
||||||
|
|
||||||
void addRay (const btVector3& rayFrom, const btVector3& rayTo);
|
void addRay (const btVector3& rayFrom, const btVector3& rayTo);
|
||||||
void clearRays ();
|
void clearRays ();
|
||||||
void performBatchRaycast ();
|
void performBatchRaycast ();
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include "../PlatformDefinitions.h"
|
||||||
#include "SpuRaycastTask.h"
|
#include "SpuRaycastTask.h"
|
||||||
#include "SpuCollisionObjectWrapper.h"
|
#include "../SpuCollisionObjectWrapper.h"
|
||||||
#include "SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h"
|
#include "../SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h"
|
||||||
#include "SpuSubSimplexConvexCast.h"
|
#include "SpuSubSimplexConvexCast.h"
|
||||||
#include "LinearMath/btAabbUtil2.h"
|
#include "LinearMath/btAabbUtil2.h"
|
||||||
|
|
||||||
@@ -288,7 +289,7 @@ void spuWalkStacklessQuantizedTreeAgainstRay(RaycastTask_LocalStoreMemory* lsMem
|
|||||||
bounds[0] = lsMemPtr->bvhShapeData.getOptimizedBvh()->unQuantize(rootNode->m_quantizedAabbMin);
|
bounds[0] = lsMemPtr->bvhShapeData.getOptimizedBvh()->unQuantize(rootNode->m_quantizedAabbMin);
|
||||||
bounds[1] = lsMemPtr->bvhShapeData.getOptimizedBvh()->unQuantize(rootNode->m_quantizedAabbMax);
|
bounds[1] = lsMemPtr->bvhShapeData.getOptimizedBvh()->unQuantize(rootNode->m_quantizedAabbMax);
|
||||||
#ifdef RAYAABB2
|
#ifdef RAYAABB2
|
||||||
rayBoxOverlap = btRayAabb2 (raySource, rayDirection, sign, bounds, param, 0.0, lambda_max);
|
rayBoxOverlap = true;//btRayAabb2 (raySource, rayDirection, sign, bounds, param, 0.0, lambda_max);
|
||||||
#else
|
#else
|
||||||
rayBoxOverlap = btRayAabb(raySource, rayTarget, bounds[0], bounds[1], param, normal);
|
rayBoxOverlap = btRayAabb(raySource, rayTarget, bounds[0], bounds[1], param, normal);
|
||||||
#endif
|
#endif
|
||||||
@@ -414,7 +415,7 @@ void performRaycastAgainstConcave (RaycastGatheredObjectData* gatheredObjectData
|
|||||||
|
|
||||||
void performRaycastAgainstCompound (RaycastGatheredObjectData* gatheredObjectData, const SpuRaycastTaskWorkUnit& workUnit, SpuRaycastTaskWorkUnitOut* workUnitOut, RaycastTask_LocalStoreMemory* lsMemPtr)
|
void performRaycastAgainstCompound (RaycastGatheredObjectData* gatheredObjectData, const SpuRaycastTaskWorkUnit& workUnit, SpuRaycastTaskWorkUnitOut* workUnitOut, RaycastTask_LocalStoreMemory* lsMemPtr)
|
||||||
{
|
{
|
||||||
spu_printf ("Currently no support for ray. vs compound objects. Support coming soon.\n");
|
//XXX spu_printf ("Currently no support for ray. vs compound objects. Support coming soon.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -485,7 +486,7 @@ void processRaycastTask(void* userPtr, void* lsMemory)
|
|||||||
|
|
||||||
if (btBroadphaseProxy::isConvex (gatheredObjectData.m_shapeType))
|
if (btBroadphaseProxy::isConvex (gatheredObjectData.m_shapeType))
|
||||||
{
|
{
|
||||||
//performRaycastAgainstConvex (&gatheredObjectData, workUnit, &tWorkUnitOut, localMemory);
|
performRaycastAgainstConvex (&gatheredObjectData, workUnit, &tWorkUnitOut, localMemory);
|
||||||
} else if (btBroadphaseProxy::isCompound (gatheredObjectData.m_shapeType)) {
|
} else if (btBroadphaseProxy::isCompound (gatheredObjectData.m_shapeType)) {
|
||||||
performRaycastAgainstCompound (&gatheredObjectData, workUnit, &tWorkUnitOut, localMemory);
|
performRaycastAgainstCompound (&gatheredObjectData, workUnit, &tWorkUnitOut, localMemory);
|
||||||
} else if (btBroadphaseProxy::isConcave (gatheredObjectData.m_shapeType)) {
|
} else if (btBroadphaseProxy::isConcave (gatheredObjectData.m_shapeType)) {
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ subject to the following restrictions:
|
|||||||
#ifndef SPU_SUBSIMPLEX_RAY_CAST_H
|
#ifndef SPU_SUBSIMPLEX_RAY_CAST_H
|
||||||
#define SPU_SUBSIMPLEX_RAY_CAST_H
|
#define SPU_SUBSIMPLEX_RAY_CAST_H
|
||||||
|
|
||||||
#include "SpuNarrowPhaseCollisionTask/SpuVoronoiSimplexSolver.h"
|
#include "../SpuNarrowPhaseCollisionTask/SpuVoronoiSimplexSolver.h"
|
||||||
#include "SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h"
|
#include "../SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h"
|
||||||
#include "SpuRaycastTask.h"
|
#include "SpuRaycastTask.h"
|
||||||
|
|
||||||
class btConvexShape;
|
class btConvexShape;
|
||||||
|
|||||||
Reference in New Issue
Block a user