debug drawing for ParallelPhysicsEnvironment
This commit is contained in:
@@ -60,6 +60,8 @@ void StaticPlaneShape::ProcessAllTriangles(TriangleCallback* callback,const Simd
|
|||||||
//this is where the triangles are generated, given AABB and plane equation (normal/constant)
|
//this is where the triangles are generated, given AABB and plane equation (normal/constant)
|
||||||
|
|
||||||
SimdVector3 tangentDir0,tangentDir1;
|
SimdVector3 tangentDir0,tangentDir1;
|
||||||
|
|
||||||
|
//tangentDir0/tangentDir1 can be precalculated
|
||||||
SimdPlaneSpace1(m_planeNormal,tangentDir0,tangentDir1);
|
SimdPlaneSpace1(m_planeNormal,tangentDir0,tangentDir1);
|
||||||
|
|
||||||
SimdVector3 supVertex0,supVertex1;
|
SimdVector3 supVertex0,supVertex1;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ subject to the following restrictions:
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define USE_PARALLEL_DISPATCHER 1
|
#define USE_PARALLEL_DISPATCHER 1
|
||||||
|
|
||||||
|
|
||||||
#include "CcdPhysicsEnvironment.h"
|
#include "CcdPhysicsEnvironment.h"
|
||||||
@@ -111,8 +111,12 @@ CollisionShape* shapePtr[numShapes] =
|
|||||||
///Please don't make the box sizes larger then 1000: the collision detection will be inaccurate.
|
///Please don't make the box sizes larger then 1000: the collision detection will be inaccurate.
|
||||||
///See http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=346
|
///See http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=346
|
||||||
|
|
||||||
|
#define USE_GROUND_PLANE 1
|
||||||
|
#ifdef USE_GROUND_PLANE
|
||||||
|
new StaticPlaneShape(SimdVector3(0,1,0),10),
|
||||||
|
#else
|
||||||
new BoxShape (SimdVector3(450,10,450)),
|
new BoxShape (SimdVector3(450,10,450)),
|
||||||
//new StaticPlaneShape(SimdVector3(0,1,0),10),
|
#endif
|
||||||
|
|
||||||
new BoxShape (SimdVector3(CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS)),
|
new BoxShape (SimdVector3(CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS,CUBE_HALF_EXTENTS)),
|
||||||
new SphereShape (CUBE_HALF_EXTENTS- 0.05f),
|
new SphereShape (CUBE_HALF_EXTENTS- 0.05f),
|
||||||
|
|||||||
@@ -48,9 +48,10 @@ class CcdPhysicsEnvironment : public PHY_IPhysicsEnvironment
|
|||||||
{
|
{
|
||||||
SimdVector3 m_gravity;
|
SimdVector3 m_gravity;
|
||||||
|
|
||||||
IDebugDraw* m_debugDrawer;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
IDebugDraw* m_debugDrawer;
|
||||||
//solver iterations
|
//solver iterations
|
||||||
int m_numIterations;
|
int m_numIterations;
|
||||||
|
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ bool ParallelPhysicsEnvironment::proceedDeltaTimeOneStep(float timeStep)
|
|||||||
{
|
{
|
||||||
if (simulationIslands[k].m_controllers.size())
|
if (simulationIslands[k].m_controllers.size())
|
||||||
{
|
{
|
||||||
simulationIslands[k].Simulate(m_numIterations, constraintBase ,&scene->GetOverlappingPair(0),dispatcher,GetBroadphase(),m_solver,timeStep);
|
simulationIslands[k].Simulate(m_debugDrawer,m_numIterations, constraintBase ,&scene->GetOverlappingPair(0),dispatcher,GetBroadphase(),m_solver,timeStep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,10 +22,11 @@ subject to the following restrictions:
|
|||||||
#include "ConstraintSolver/ContactSolverInfo.h"
|
#include "ConstraintSolver/ContactSolverInfo.h"
|
||||||
#include "ConstraintSolver/ConstraintSolver.h"
|
#include "ConstraintSolver/ConstraintSolver.h"
|
||||||
#include "ConstraintSolver/TypedConstraint.h"
|
#include "ConstraintSolver/TypedConstraint.h"
|
||||||
|
#include "IDebugDraw.h"
|
||||||
|
|
||||||
extern float gContactBreakingTreshold;
|
extern float gContactBreakingTreshold;
|
||||||
|
|
||||||
bool SimulationIsland::Simulate(int numSolverIterations,TypedConstraint** constraintsBaseAddress,BroadphasePair* overlappingPairBaseAddress, Dispatcher* dispatcher,BroadphaseInterface* broadphase,class ConstraintSolver* solver,float timeStep)
|
bool SimulationIsland::Simulate(IDebugDraw* debugDrawer,int numSolverIterations,TypedConstraint** constraintsBaseAddress,BroadphasePair* overlappingPairBaseAddress, Dispatcher* dispatcher,BroadphaseInterface* broadphase,class ConstraintSolver* solver,float timeStep)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -82,7 +83,8 @@ bool SimulationIsland::Simulate(int numSolverIterations,TypedConstraint** constr
|
|||||||
dispatchInfo.m_timeStep = timeStep;
|
dispatchInfo.m_timeStep = timeStep;
|
||||||
dispatchInfo.m_stepCount = 0;
|
dispatchInfo.m_stepCount = 0;
|
||||||
dispatchInfo.m_enableSatConvex = false;//m_enableSatCollisionDetection;
|
dispatchInfo.m_enableSatConvex = false;//m_enableSatCollisionDetection;
|
||||||
|
dispatchInfo.m_debugDraw = debugDrawer;
|
||||||
|
|
||||||
std::vector<BroadphasePair> overlappingPairs;
|
std::vector<BroadphasePair> overlappingPairs;
|
||||||
overlappingPairs.resize(this->m_overlappingPairIndices.size());
|
overlappingPairs.resize(this->m_overlappingPairIndices.size());
|
||||||
|
|
||||||
@@ -208,7 +210,7 @@ bool SimulationIsland::Simulate(int numSolverIterations,TypedConstraint** constr
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
UpdateAabbs(broadphase,timeStep);
|
UpdateAabbs(debugDrawer,broadphase,timeStep);
|
||||||
|
|
||||||
|
|
||||||
float toi = 1.f;
|
float toi = 1.f;
|
||||||
@@ -364,7 +366,7 @@ void SimulationIsland::SyncMotionStates(float timeStep)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SimulationIsland::UpdateAabbs(BroadphaseInterface* scene,float timeStep)
|
void SimulationIsland::UpdateAabbs(IDebugDraw* debugDrawer,BroadphaseInterface* scene,float timeStep)
|
||||||
{
|
{
|
||||||
std::vector<CcdPhysicsController*>::iterator i;
|
std::vector<CcdPhysicsController*>::iterator i;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ subject to the following restrictions:
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
class BroadphaseInterface;
|
class BroadphaseInterface;
|
||||||
class Dispatcher;
|
class Dispatcher;
|
||||||
|
class IDebugDraw;
|
||||||
|
|
||||||
///SimulationIsland groups all computations and data (for collision detection and dynamics) that can execute in parallel with other SimulationIsland's
|
///SimulationIsland groups all computations and data (for collision detection and dynamics) that can execute in parallel with other SimulationIsland's
|
||||||
///The ParallelPhysicsEnvironment and ParallelIslandDispatcher will dispatch SimulationIsland's
|
///The ParallelPhysicsEnvironment and ParallelIslandDispatcher will dispatch SimulationIsland's
|
||||||
@@ -34,7 +35,7 @@ class SimulationIsland
|
|||||||
std::vector<int> m_overlappingPairIndices;
|
std::vector<int> m_overlappingPairIndices;
|
||||||
std::vector<int> m_constraintIndices;
|
std::vector<int> m_constraintIndices;
|
||||||
|
|
||||||
bool Simulate(int numSolverIterations,class TypedConstraint** constraintsBaseAddress,struct BroadphasePair* overlappingPairBaseAddress, Dispatcher* dispatcher,BroadphaseInterface* broadphase, class ConstraintSolver* solver, float timeStep);
|
bool Simulate(IDebugDraw* debugDrawer,int numSolverIterations,class TypedConstraint** constraintsBaseAddress,struct BroadphasePair* overlappingPairBaseAddress, Dispatcher* dispatcher,BroadphaseInterface* broadphase, class ConstraintSolver* solver, float timeStep);
|
||||||
|
|
||||||
|
|
||||||
int GetNumControllers()
|
int GetNumControllers()
|
||||||
@@ -46,7 +47,7 @@ class SimulationIsland
|
|||||||
|
|
||||||
|
|
||||||
void SyncMotionStates(float timeStep);
|
void SyncMotionStates(float timeStep);
|
||||||
void UpdateAabbs(BroadphaseInterface* broadphase,float timeStep);
|
void UpdateAabbs(IDebugDraw* debugDrawer,BroadphaseInterface* broadphase,float timeStep);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //SIMULATION_ISLAND_H
|
#endif //SIMULATION_ISLAND_H
|
||||||
Reference in New Issue
Block a user