aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/PhysX/src/buffering
diff options
context:
space:
mode:
authorsschirm <[email protected]>2016-12-23 14:20:36 +0100
committersschirm <[email protected]>2016-12-23 14:56:17 +0100
commitef6937e69e8ee3f409cf9d460d5ad300a65d5924 (patch)
tree710426e8daa605551ce3f34b581897011101c30f /PhysX_3.4/Source/PhysX/src/buffering
parentInitial commit: (diff)
downloadphysx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.tar.xz
physx-3.4-ef6937e69e8ee3f409cf9d460d5ad300a65d5924.zip
PhysX 3.4 / APEX 1.4 release candidate @21506124
Diffstat (limited to 'PhysX_3.4/Source/PhysX/src/buffering')
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbActor.cpp34
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbActor.h16
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbAggregate.cpp35
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbAggregate.h39
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbArticulation.h60
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbArticulationJoint.h34
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbBase.cpp1
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbBase.h45
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbBody.h145
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbCloth.cpp8
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbCloth.h266
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbConstraint.h53
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbDefs.h50
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbMetaData.cpp1
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbParticleSystem.cpp14
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbParticleSystem.h107
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbRigidObject.h103
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbRigidStatic.h22
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbScene.cpp122
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbScene.h216
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbSceneBuffer.h98
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbScenePvdClient.cpp196
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbScenePvdClient.h25
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbShape.cpp55
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbShape.h102
-rw-r--r--PhysX_3.4/Source/PhysX/src/buffering/ScbType.h27
26 files changed, 717 insertions, 1157 deletions
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbActor.cpp b/PhysX_3.4/Source/PhysX/src/buffering/ScbActor.cpp
index 9c91235a..25f39af3 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbActor.cpp
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbActor.cpp
@@ -27,58 +27,42 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#include "ScbBase.h"
using namespace physx;
using namespace Scb;
-using namespace physx;
-using namespace Scb;
-
#include "ScbActor.h"
#include "ScbRigidStatic.h"
#include "ScbBody.h"
#include "ScbParticleSystem.h"
#include "ScbCloth.h"
-namespace physx
-{
-namespace Scb
-{
-
Actor::Offsets::Offsets()
{
- size_t staticOffset = reinterpret_cast<size_t>(&(reinterpret_cast<Scb::RigidStatic*>(0)->getScStatic()));
- size_t bodyOffset = reinterpret_cast<size_t>(&(reinterpret_cast<Scb::Body*>(0)->getScBody()));
+ const size_t staticOffset = reinterpret_cast<size_t>(&(reinterpret_cast<Scb::RigidStatic*>(0)->getScStatic()));
+ const size_t bodyOffset = reinterpret_cast<size_t>(&(reinterpret_cast<Scb::Body*>(0)->getScBody()));
scToScb[PxActorType::eRIGID_STATIC] = staticOffset;
scToScb[PxActorType::eRIGID_DYNAMIC] = bodyOffset;
scToScb[PxActorType::eARTICULATION_LINK] = bodyOffset;
- scbToSc[ScbType::RIGID_STATIC] = staticOffset;
- scbToSc[ScbType::BODY] = bodyOffset;
- scbToSc[ScbType::BODY_FROM_ARTICULATION_LINK] = bodyOffset;
+ scbToSc[ScbType::eRIGID_STATIC] = staticOffset;
+ scbToSc[ScbType::eBODY] = bodyOffset;
+ scbToSc[ScbType::eBODY_FROM_ARTICULATION_LINK] = bodyOffset;
#if PX_USE_PARTICLE_SYSTEM_API
- size_t particleOffset = reinterpret_cast<size_t>(&(reinterpret_cast<Scb::ParticleSystem*>(0)->getScParticleSystem()));
+ const size_t particleOffset = reinterpret_cast<size_t>(&(reinterpret_cast<Scb::ParticleSystem*>(0)->getScParticleSystem()));
scToScb[PxActorType::ePARTICLE_FLUID] = particleOffset;
scToScb[PxActorType::ePARTICLE_SYSTEM] = particleOffset;
- scbToSc[ScbType::PARTICLE_SYSTEM] = particleOffset;
+ scbToSc[ScbType::ePARTICLE_SYSTEM] = particleOffset;
#endif
#if PX_USE_CLOTH_API
- size_t clothOffset = reinterpret_cast<size_t>(&(reinterpret_cast<Scb::Cloth*>(0)->getScCloth()));
+ const size_t clothOffset = reinterpret_cast<size_t>(&(reinterpret_cast<Scb::Cloth*>(0)->getScCloth()));
scToScb[PxActorType::eCLOTH] = clothOffset;
- scbToSc[ScbType::CLOTH] = clothOffset;
+ scbToSc[ScbType::eCLOTH] = clothOffset;
#endif
-
-
}
-
-
-
const Actor::Offsets Actor::sOffsets;
-}
-}
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbActor.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbActor.h
index 364972b1..21f623e5 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbActor.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbActor.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_FSACTOR
#define PX_PHYSICS_SCB_FSACTOR
@@ -58,7 +57,6 @@ protected:
~ActorBuffer(){}
};
-
class Actor : public Base
{
//= ATTENTION! =====================================================================================
@@ -97,7 +95,6 @@ public:
//---------------------------------------------------------------------------------
// Miscellaneous
//---------------------------------------------------------------------------------
-
PX_FORCE_INLINE const Core& getActorCore() const { return *reinterpret_cast<const Core*>(reinterpret_cast<size_t>(this) + sOffsets.scbToSc[getScbType()]); }
PX_FORCE_INLINE Core& getActorCore() { return *reinterpret_cast<Core*>(reinterpret_cast<size_t>(this) + sOffsets.scbToSc[getScbType()]); }
@@ -124,19 +121,18 @@ protected:
struct Offsets
{
size_t scToScb[PxActorType::eACTOR_COUNT];
- size_t scbToSc[ScbType::TYPE_COUNT];
+ size_t scbToSc[ScbType::eTYPE_COUNT];
Offsets();
};
static const Offsets sOffsets;
};
-
PX_INLINE void Actor::setActorFlags(PxActorFlags v)
{
#if PX_CHECKED
PxActorFlags aFlags = getActorFlags();
PxActorType::Enum aType = getActorType();
- if ((!aFlags.isSet(PxActorFlag::eDISABLE_SIMULATION)) && v.isSet(PxActorFlag::eDISABLE_SIMULATION) &&
+ if((!aFlags.isSet(PxActorFlag::eDISABLE_SIMULATION)) && v.isSet(PxActorFlag::eDISABLE_SIMULATION) &&
(aType != PxActorType::eRIGID_DYNAMIC) && (aType != PxActorType::eRIGID_STATIC))
{
Ps::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__,
@@ -147,11 +143,11 @@ PX_INLINE void Actor::setActorFlags(PxActorFlags v)
write<Buf::BF_ActorFlags>(v);
}
-PX_INLINE void Actor::setOwnerClient( PxClientID inId )
+PX_INLINE void Actor::setOwnerClient(PxClientID inId)
{
//This call is only valid if we aren't in a scene.
//Thus we can't be buffering yet
- if (!isBuffering())
+ if(!isBuffering())
{
getActorCore().setOwnerClient( inId );
UPDATE_PVD_PROPERTIES_OBJECT()
@@ -168,10 +164,10 @@ PX_INLINE void Actor::syncState()
//this should be called from syncState() of derived classes
const PxU32 flags = getBufferFlags();
- if (flags & (Buf::BF_ActorFlags|Buf::BF_DominanceGroup|Buf::BF_ClientBehaviorFlags))
+ if(flags & (Buf::BF_ActorFlags|Buf::BF_DominanceGroup|Buf::BF_ClientBehaviorFlags))
{
Core& core = getActorCore();
- Buf& buffer = *reinterpret_cast<Buf*>(getStream());
+ const Buf& buffer = *reinterpret_cast<const Buf*>(getStream());
flush<Buf::BF_ActorFlags>(core, buffer);
flush<Buf::BF_DominanceGroup>(core, buffer);
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbAggregate.cpp b/PhysX_3.4/Source/PhysX/src/buffering/ScbAggregate.cpp
index 22a26abd..e79b10b5 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbAggregate.cpp
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbAggregate.cpp
@@ -27,13 +27,11 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#include "ScbAggregate.h"
#include "ScbActor.h"
using namespace physx;
-
void Scb::Aggregate::addActor(Scb::Actor& actor)
{
const ControlState::Enum state = getControlState();
@@ -44,16 +42,16 @@ void Scb::Aggregate::addActor(Scb::Actor& actor)
PvdAttachActorToAggregate( this, &actor );
PvdUpdateProperties( this );
}
- else if ((state != ControlState::eREMOVE_PENDING)) // If the aggregate is pending for deletion, adding/removing an actor should not be double buffered because the aggregateID must not be set for the actors
+ else if((state != ControlState::eREMOVE_PENDING)) // If the aggregate is pending for deletion, adding/removing an actor should not be double buffered because the aggregateID must not be set for the actors
{
// if available, search in list of removed actors to cover the remove-add case
Scb::AggregateBuffer* PX_RESTRICT bufferedData = getBufferedData();
- if (bufferedData->removeBufferIdx != 0xffffffff)
+ if(bufferedData->removeBufferIdx != 0xffffffff)
{
Scb::Actor** removeBuffer = getScbScene()->getActorBuffer(bufferedData->removeBufferIdx);
- for(PxU32 i=0; i < bufferedData->removeCount; i++)
+ for(PxU32 i=0; i<bufferedData->removeCount; i++)
{
- if (removeBuffer[i] == &actor)
+ if(removeBuffer[i] == &actor)
{
removeBuffer[i] = removeBuffer[bufferedData->removeCount - 1];
PX_ASSERT(bufferedData->removeCount > 0);
@@ -64,20 +62,16 @@ void Scb::Aggregate::addActor(Scb::Actor& actor)
}
Scb::Actor** actorBuffer;
- if (bufferedData->addBufferIdx == 0xffffffff)
- {
+ if(bufferedData->addBufferIdx == 0xffffffff)
actorBuffer = getScbScene()->allocActorBuffer(mMaxNbActors, bufferedData->addBufferIdx);
- }
else
- {
actorBuffer = getScbScene()->getActorBuffer(bufferedData->addBufferIdx);
- }
PX_ASSERT(bufferedData->addCount < mMaxNbActors);
actorBuffer[bufferedData->addCount] = &actor;
bufferedData->addCount++;
- if (state != ControlState::eINSERT_PENDING)
+ if(state != ControlState::eINSERT_PENDING)
markUpdated(BF_ADD_ACTOR);
else
{
@@ -88,7 +82,6 @@ void Scb::Aggregate::addActor(Scb::Actor& actor)
}
}
-
void Scb::Aggregate::removeActor(Scb::Actor& actor, bool reinsert)
{
const ControlState::Enum state = getControlState();
@@ -100,20 +93,18 @@ void Scb::Aggregate::removeActor(Scb::Actor& actor, bool reinsert)
ac.setAggregateID(PX_INVALID_U32);
if(getScbSceneForAPI() && reinsert)
- {
ac.reinsertShapes();
- }
}
- else if ((state != ControlState::eREMOVE_PENDING))
+ else if((state != ControlState::eREMOVE_PENDING))
{
// if available, search in list of added actors to cover the add-remove case
Scb::AggregateBuffer* PX_RESTRICT bufferedData = getBufferedData();
- if (bufferedData->addBufferIdx != 0xffffffff)
+ if(bufferedData->addBufferIdx != 0xffffffff)
{
Scb::Actor** addBuffer = getScbScene()->getActorBuffer(bufferedData->addBufferIdx);
- for(PxU32 i=0; i < bufferedData->addCount; i++)
+ for(PxU32 i=0; i<bufferedData->addCount; i++)
{
- if (addBuffer[i] == &actor)
+ if(addBuffer[i] == &actor)
{
addBuffer[i] = addBuffer[bufferedData->addCount - 1];
PX_ASSERT(bufferedData->addCount > 0);
@@ -124,14 +115,10 @@ void Scb::Aggregate::removeActor(Scb::Actor& actor, bool reinsert)
}
Scb::Actor** actorBuffer;
- if (bufferedData->removeBufferIdx == 0xffffffff)
- {
+ if(bufferedData->removeBufferIdx == 0xffffffff)
actorBuffer = getScbScene()->allocActorBuffer(mMaxNbActors, bufferedData->removeBufferIdx);
- }
else
- {
actorBuffer = getScbScene()->getActorBuffer(bufferedData->removeBufferIdx);
- }
PX_ASSERT(bufferedData->removeCount < mMaxNbActors);
actorBuffer[bufferedData->removeCount] = &actor;
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbAggregate.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbAggregate.h
index 55911d22..8e55deb5 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbAggregate.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbAggregate.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_AGGREGATE
#define PX_PHYSICS_SCB_AGGREGATE
@@ -58,7 +57,6 @@ struct AggregateBuffer
PxU32 removeCount;
};
-
class Aggregate : public Base
{
//= ATTENTION! =====================================================================================
@@ -86,7 +84,6 @@ public:
void addActor(Scb::Actor&);
void removeActor(Scb::Actor& actor, bool reinsert);
-
//---------------------------------------------------------------------------------
// Data synchronization
//---------------------------------------------------------------------------------
@@ -112,17 +109,15 @@ private:
PX_FORCE_INLINE Scb::AggregateBuffer* getBufferedData() { return reinterpret_cast<Scb::AggregateBuffer*>(getStream()); }
};
-
PX_INLINE Aggregate::Aggregate(PxAggregate* px, PxU32 maxActors, bool selfCollision) :
mPxAggregate (px),
mAggregateID (PX_INVALID_U32),
mMaxNbActors (maxActors),
mSelfCollide (selfCollision)
{
- setScbType(ScbType::AGGREGATE);
+ setScbType(ScbType::eAGGREGATE);
}
-
PX_INLINE Aggregate::~Aggregate()
{
}
@@ -151,33 +146,27 @@ namespace
PX_FORCE_INLINE void PvdAttachActorToAggregate(Scb::Aggregate* pAggregate, Scb::Actor* pScbActor)
{
Scb::Scene* scbScene = pAggregate->getScbSceneForAPI();
- if( scbScene/* && scbScene->getScenePvdClient().isInstanceValid(pAggregate)*/)
- {
+ if(scbScene/* && scbScene->getScenePvdClient().isInstanceValid(pAggregate)*/)
scbScene->getScenePvdClient().attachAggregateActor( pAggregate, pScbActor );
- }
}
PX_FORCE_INLINE void PvdDetachActorFromAggregate(Scb::Aggregate* pAggregate, Scb::Actor* pScbActor)
{
Scb::Scene* scbScene = pAggregate->getScbSceneForAPI();
- if( scbScene/*&& scbScene->getScenePvdClient().isInstanceValid(pAggregate)*/)
- {
+ if(scbScene/*&& scbScene->getScenePvdClient().isInstanceValid(pAggregate)*/)
scbScene->getScenePvdClient().detachAggregateActor( pAggregate, pScbActor );
- }
}
PX_FORCE_INLINE void PvdUpdateProperties(Scb::Aggregate* pAggregate)
{
Scb::Scene* scbScene = pAggregate->getScbSceneForAPI();
- if( scbScene /*&& scbScene->getScenePvdClient().isInstanceValid(pAggregate)*/)
- {
+ if(scbScene /*&& scbScene->getScenePvdClient().isInstanceValid(pAggregate)*/)
scbScene->getScenePvdClient().updatePvdProperties( pAggregate );
- }
}
#else
-#define PvdAttachActorToAggregate(aggregate, scbActor) {}
-#define PvdDetachActorFromAggregate(aggregate, scbActor) {}
-#define PvdUpdateProperties(aggregate) {}
+#define PvdAttachActorToAggregate(aggregate, scbActor) {}
+#define PvdDetachActorFromAggregate(aggregate, scbActor) {}
+#define PvdUpdateProperties(aggregate) {}
#endif
}
@@ -189,7 +178,7 @@ namespace
PX_INLINE void Aggregate::syncState(Scb::Scene& scene)
{
- PxU32 flags = getBufferFlags();
+ const PxU32 flags = getBufferFlags();
enum AggregateSyncDirtyType
{
@@ -200,30 +189,30 @@ PX_INLINE void Aggregate::syncState(Scb::Scene& scene)
PxU32 dirtyType = DIRTY_NONE;
- if (flags)
+ if(flags)
{
const Scb::AggregateBuffer* PX_RESTRICT bufferedData = getBufferedData();
- if (flags & BF_ADD_ACTOR)
+ if(flags & BF_ADD_ACTOR)
{
dirtyType |= DIRTY_ADD_ACTOR;
Scb::Actor* const* actorBuffer = scene.getActorBuffer(bufferedData->addBufferIdx);
PX_ASSERT(mAggregateID != PX_INVALID_U32);
- for(PxU32 i=0; i < bufferedData->addCount; i++)
+ for(PxU32 i=0; i<bufferedData->addCount; i++)
{
actorBuffer[i]->getActorCore().setAggregateID(mAggregateID);
PvdAttachActorToAggregate( this, actorBuffer[i] );
}
}
- if (flags & BF_REMOVE_ACTOR)
+ if(flags & BF_REMOVE_ACTOR)
{
dirtyType |= DIRTY_REMOVE_ACTOR;
Scb::Actor* const* actorBuffer = scene.getActorBuffer(bufferedData->removeBufferIdx);
- for(PxU32 i=0; i < bufferedData->removeCount; i++)
+ for(PxU32 i=0; i<bufferedData->removeCount; i++)
{
const ControlState::Enum state = actorBuffer[i]->getControlState();
@@ -231,7 +220,7 @@ PX_INLINE void Aggregate::syncState(Scb::Scene& scene)
ac.setAggregateID(PX_INVALID_U32);
if(state != ControlState::eREMOVE_PENDING)
PvdDetachActorFromAggregate( this, actorBuffer[i] );
- if (state == ControlState::eINSERT_PENDING || state == ControlState::eIN_SCENE)
+ if(state == ControlState::eINSERT_PENDING || state == ControlState::eIN_SCENE)
ac.reinsertShapes();
}
}
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbArticulation.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbArticulation.h
index 424cf34b..16d20070 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbArticulation.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbArticulation.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_ARTICULATION
#define PX_PHYSICS_SCB_ARTICULATION
@@ -58,7 +57,6 @@ struct ArticulationBuffer
enum { BF_WakeCounter = 1<<7 };
enum { BF_PutToSleep = 1<<8 };
enum { BF_WakeUp = 1<<9 };
-
};
class Articulation : public Base
@@ -127,10 +125,8 @@ public:
PX_FORCE_INLINE static Articulation& fromSc(Core &a) { return *reinterpret_cast<Articulation*>(reinterpret_cast<PxU8*>(&a)-getScOffset()); }
PX_FORCE_INLINE static const Articulation& fromSc(const Core &a) { return *reinterpret_cast<const Articulation*>(reinterpret_cast<const PxU8*>(&a)-getScOffset()); }
- static size_t getScOffset()
- {
- return reinterpret_cast<size_t>(&reinterpret_cast<Articulation*>(0)->mArticulation);
- }
+
+ static size_t getScOffset() { return reinterpret_cast<size_t>(&reinterpret_cast<Articulation*>(0)->mArticulation); }
PX_FORCE_INLINE void wakeUpInternal(PxReal wakeCounter);
@@ -146,7 +142,6 @@ private:
PX_FORCE_INLINE const Buf* getArticulationBuffer() const { return reinterpret_cast<const Buf*>(getStream()); }
PX_FORCE_INLINE Buf* getArticulationBuffer() { return reinterpret_cast<Buf*>(getStream()); }
-
//---------------------------------------------------------------------------------
// Infrastructure for regular attributes
//---------------------------------------------------------------------------------
@@ -155,33 +150,30 @@ private:
template<PxU32 f> PX_FORCE_INLINE typename Buf::Fns<f,0>::Arg read() const { return Access::read<Buf::Fns<f,0> >(*this, mArticulation); }
template<PxU32 f> PX_FORCE_INLINE void write(typename Buf::Fns<f,0>::Arg v) { Access::write<Buf::Fns<f,0> >(*this, mArticulation, v); }
template<PxU32 f> PX_FORCE_INLINE void flush(const Buf& buf) { Access::flush<Buf::Fns<f,0> >(*this, mArticulation, buf); }
-
};
-
Articulation::Articulation()
{
- setScbType(ScbType::ARTICULATION);
- mBufferedWakeCounter = getScArticulation().getWakeCounter();
+ setScbType(ScbType::eARTICULATION);
+ mBufferedWakeCounter = mArticulation.getWakeCounter();
mBufferedIsSleeping = 1; // this is the specified value for free standing objects
}
-
PX_INLINE void Articulation::setWakeCounter(PxReal counter)
{
mBufferedWakeCounter = counter;
- if (!isBuffering())
+ if(!isBuffering())
{
- if (getScbScene() && (counter > 0.0f))
+ if(getScbScene() && (counter > 0.0f))
mBufferedIsSleeping = 0;
- getScArticulation().setWakeCounter(counter);
+ mArticulation.setWakeCounter(counter);
UPDATE_PVD_PROPERTIES_OBJECT()
}
else
{
- if (counter > 0.0f)
+ if(counter > 0.0f)
{
mBufferedIsSleeping = 0;
markUpdated(Buf::BF_WakeUp | Buf::BF_WakeCounter);
@@ -192,7 +184,6 @@ PX_INLINE void Articulation::setWakeCounter(PxReal counter)
}
}
-
PX_FORCE_INLINE void Articulation::wakeUp()
{
Scene* scene = getScbScene();
@@ -201,7 +192,6 @@ PX_FORCE_INLINE void Articulation::wakeUp()
wakeUpInternal(scene->getWakeCounterResetValue());
}
-
PX_FORCE_INLINE void Articulation::wakeUpInternal(PxReal wakeCounter)
{
PX_ASSERT(getScbScene());
@@ -209,9 +199,9 @@ PX_FORCE_INLINE void Articulation::wakeUpInternal(PxReal wakeCounter)
mBufferedWakeCounter = wakeCounter;
mBufferedIsSleeping = 0;
- if (!isBuffering())
+ if(!isBuffering())
{
- getScArticulation().wakeUp(wakeCounter);
+ mArticulation.wakeUp(wakeCounter);
}
else
{
@@ -220,15 +210,14 @@ PX_FORCE_INLINE void Articulation::wakeUpInternal(PxReal wakeCounter)
}
}
-
PX_FORCE_INLINE void Articulation::putToSleep()
{
mBufferedWakeCounter = 0.0f;
mBufferedIsSleeping = 1;
- if (!isBuffering())
+ if(!isBuffering())
{
- getScArticulation().putToSleep();
+ mArticulation.putToSleep();
}
else
{
@@ -237,12 +226,11 @@ PX_FORCE_INLINE void Articulation::putToSleep()
}
}
-
PX_FORCE_INLINE void Articulation::initBufferedState()
{
PX_ASSERT(mBufferedIsSleeping); // this method is only meant to get called when an object is added to the scene
- if (getWakeCounter() == 0.0f)
+ if(getWakeCounter() == 0.0f)
mBufferedIsSleeping = 1;
else
mBufferedIsSleeping = 0;
@@ -251,13 +239,11 @@ PX_FORCE_INLINE void Articulation::initBufferedState()
// are added, an additional check will wake the articulation up if necessary.
}
-
PX_FORCE_INLINE void Articulation::clearBufferedState()
{
mBufferedIsSleeping = 1; // the expected state when an object gets removed from the scene
}
-
PX_FORCE_INLINE void Articulation::clearBufferedSleepStateChange()
{
resetBufferFlag(Buf::BF_WakeUp | Buf::BF_PutToSleep);
@@ -275,26 +261,26 @@ PX_INLINE void Articulation::syncState()
PX_ASSERT( (getControlState() != ControlState::eREMOVE_PENDING) ||
(mBufferedIsSleeping && (!isBuffered(Buf::BF_WakeUp | Buf::BF_PutToSleep))) );
- PxU32 flags = getBufferFlags();
+ const PxU32 flags = getBufferFlags();
//----
- if ((flags & Buf::BF_WakeCounter) == 0)
- mBufferedWakeCounter = getScArticulation().getWakeCounter();
+ if((flags & Buf::BF_WakeCounter) == 0)
+ mBufferedWakeCounter = mArticulation.getWakeCounter();
else if (!(flags & (Buf::BF_WakeUp | Buf::BF_PutToSleep))) // if there has been at least one buffered sleep state transition, then there is no use in adjusting the wake counter separately because it will
// get done in the sleep state update.
{
PX_ASSERT(mBufferedWakeCounter == 0.0f); // a wake counter change is always connected to a sleep state change, except one case: if setWakeCounter(0.0f) was called
- getScArticulation().setWakeCounter(mBufferedWakeCounter);
+ mArticulation.setWakeCounter(mBufferedWakeCounter);
}
//----
- bool isSimObjectSleeping = getScArticulation().isSleeping();
- if ((flags & (Buf::BF_WakeUp | Buf::BF_PutToSleep)) == 0)
+ if((flags & (Buf::BF_WakeUp | Buf::BF_PutToSleep)) == 0)
{
- if (getControlState() != ControlState::eREMOVE_PENDING) // we do not want the simulation sleep state to take effect if the object was removed (free standing objects have buffered state sleeping)
+ const bool isSimObjectSleeping = mArticulation.isSleeping();
+ if(getControlState() != ControlState::eREMOVE_PENDING) // we do not want the simulation sleep state to take effect if the object was removed (free standing objects have buffered state sleeping)
mBufferedIsSleeping = PxU8(isSimObjectSleeping);
else
PX_ASSERT(mBufferedIsSleeping); // this must get set immediately at remove
@@ -304,19 +290,19 @@ PX_INLINE void Articulation::syncState()
PX_ASSERT(flags & Buf::BF_WakeCounter); // sleep state transitions always mark the wake counter dirty
PX_ASSERT(getControlState() != ControlState::eREMOVE_PENDING); // removing an object should clear pending wakeUp/putToSleep operations since the state for a free standing object gets set according to specification.
- if (flags & Buf::BF_PutToSleep)
+ if(flags & Buf::BF_PutToSleep)
{
PX_ASSERT(mBufferedIsSleeping);
PX_ASSERT(!(flags & Buf::BF_WakeUp));
PX_ASSERT(mBufferedWakeCounter == 0.0f);
- getScArticulation().putToSleep();
+ mArticulation.putToSleep();
}
else
{
PX_ASSERT(!mBufferedIsSleeping);
PX_ASSERT(flags & Buf::BF_WakeUp);
- getScArticulation().wakeUp(mBufferedWakeCounter);
+ mArticulation.wakeUp(mBufferedWakeCounter);
}
}
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbArticulationJoint.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbArticulationJoint.h
index 04a49f1c..b6437371 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbArticulationJoint.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbArticulationJoint.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_ARTICULATION_JOINT
#define PX_PHYSICS_SCB_ARTICULATION_JOINT
@@ -175,35 +174,31 @@ private:
template<PxU32 f> PX_FORCE_INLINE void flush(const Buf& buf) { Access::flush<Buf::Fns<f,0> >(*this, mJoint, buf); }
};
-
-ArticulationJoint::ArticulationJoint(const PxTransform& parentFrame,
- const PxTransform& childFrame) :
+ArticulationJoint::ArticulationJoint(const PxTransform& parentFrame, const PxTransform& childFrame) :
mJoint(parentFrame, childFrame)
{
- setScbType(ScbType::ARTICULATION_JOINT);
+ setScbType(ScbType::eARTICULATION_JOINT);
}
-
ArticulationJoint::~ArticulationJoint()
{
}
PX_INLINE void ArticulationJoint::getSwingLimit(PxReal &yLimit, PxReal &zLimit) const
{
- if (isBuffered(Buf::BF_SwingLimit))
+ if(isBuffered(Buf::BF_SwingLimit))
{
yLimit = getBuffer()->mSwingLimitY;
zLimit = getBuffer()->mSwingLimitZ;
}
else
- getScArticulationJoint().getSwingLimit(yLimit, zLimit);
+ mJoint.getSwingLimit(yLimit, zLimit);
}
-
PX_INLINE void ArticulationJoint::setSwingLimit(PxReal yLimit, PxReal zLimit)
{
- if (!isBuffering())
- getScArticulationJoint().setSwingLimit(yLimit, zLimit);
+ if(!isBuffering())
+ mJoint.setSwingLimit(yLimit, zLimit);
else
{
getBuffer()->mSwingLimitY = yLimit;
@@ -212,10 +207,9 @@ PX_INLINE void ArticulationJoint::setSwingLimit(PxReal yLimit, PxReal zLimit)
}
}
-
PX_INLINE void ArticulationJoint::getTwistLimit(PxReal &lower, PxReal &upper) const
{
- if (isBuffered(Buf::BF_TwistLimit))
+ if(isBuffered(Buf::BF_TwistLimit))
{
lower = getBuffer()->mTwistLimitLower;
upper = getBuffer()->mTwistLimitUpper;
@@ -224,10 +218,9 @@ PX_INLINE void ArticulationJoint::getTwistLimit(PxReal &lower, PxReal &upper) co
mJoint.getTwistLimit(lower, upper);
}
-
PX_INLINE void ArticulationJoint::setTwistLimit(PxReal lower, PxReal upper)
{
- if (!isBuffering())
+ if(!isBuffering())
mJoint.setTwistLimit(lower, upper);
else
{
@@ -237,7 +230,6 @@ PX_INLINE void ArticulationJoint::setTwistLimit(PxReal lower, PxReal upper)
}
}
-
//--------------------------------------------------------------
//
// Data synchronization
@@ -246,7 +238,7 @@ PX_INLINE void ArticulationJoint::setTwistLimit(PxReal lower, PxReal upper)
PX_INLINE void ArticulationJoint::syncState()
{
- PxU32 flags = getBufferFlags();
+ const PxU32 flags = getBufferFlags();
if(flags) // Optimization to avoid all the if-statements below if possible
{
const Buf& buffer = *getBuffer();
@@ -266,11 +258,11 @@ PX_INLINE void ArticulationJoint::syncState()
flush<Buf::BF_TangentialStiffness>(buffer);
flush<Buf::BF_TangentialDamping>(buffer);
- if (isBuffered(Buf::BF_SwingLimit))
- getScArticulationJoint().setSwingLimit( buffer.mSwingLimitY, buffer.mSwingLimitZ);
+ if(isBuffered(Buf::BF_SwingLimit))
+ mJoint.setSwingLimit(buffer.mSwingLimitY, buffer.mSwingLimitZ);
- if (isBuffered(Buf::BF_TwistLimit))
- getScArticulationJoint().setTwistLimit( buffer.mTwistLimitLower, buffer.mTwistLimitUpper);
+ if(isBuffered(Buf::BF_TwistLimit))
+ mJoint.setTwistLimit(buffer.mTwistLimitLower, buffer.mTwistLimitUpper);
}
postSyncState();
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbBase.cpp b/PhysX_3.4/Source/PhysX/src/buffering/ScbBase.cpp
index fb23dad6..03fb6537 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbBase.cpp
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbBase.cpp
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#include "ScbBase.h"
#include "ScbNpDeps.h"
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbBase.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbBase.h
index 15fb0f75..3c6b8f79 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbBase.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbBase.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_BASE
#define PX_PHYSICS_SCB_BASE
@@ -36,13 +35,12 @@
namespace physx
{
-
#if PX_SUPPORT_PVD
// PT: updatePvdProperties() is overloaded and the compiler needs to know 'this' type to do the right thing.
// Thus we can't just move this as an inlined Base function.
- #define UPDATE_PVD_PROPERTIES_OBJECT() { \
- Scb::Scene* scene_ = getScbSceneForAPI(); \
- if(scene_ && !insertPending() ) \
+ #define UPDATE_PVD_PROPERTIES_OBJECT() { \
+ Scb::Scene* scene_ = getScbSceneForAPI(); \
+ if(scene_ && !insertPending() ) \
scene_->getScenePvdClient().updatePvdProperties(this); }
#else
#define UPDATE_PVD_PROPERTIES_OBJECT() {}
@@ -125,7 +123,6 @@ namespace Scb
};
};
-
/**
\brief Base class for objects that should support buffering.
@@ -148,8 +145,8 @@ namespace Scb
// PX_SERIALIZATION
Base(const PxEMPTY) :
- mScene (NULL),
- mStreamPtr(NULL)
+ mScene (NULL),
+ mStreamPtr (NULL)
{
resetAllBufferFlags();
resetControl(ControlState::eNOT_IN_SCENE);
@@ -157,10 +154,10 @@ namespace Scb
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
Base() :
- mScene (NULL),
- mStreamPtr (NULL)
+ mScene (NULL),
+ mStreamPtr (NULL)
{
- setScbType(ScbType::UNDEFINED);
+ setScbType(ScbType::eUNDEFINED);
resetControl(ControlState::eNOT_IN_SCENE);
resetAllBufferFlags();
}
@@ -172,7 +169,6 @@ namespace Scb
(state == ControlState::eIN_SCENE && mScene->isPhysicsBuffering());
}
-
PX_FORCE_INLINE Ps::IntBool insertPending() const { return getControlState() == ControlState::eINSERT_PENDING; }
PX_FORCE_INLINE ScbType::Enum getScbType() const { return ScbType::Enum((mControlState&eTYPE_MASK)>>eTYPE_SHIFT); }
PX_FORCE_INLINE void setScbType(ScbType::Enum type) { mControlState = (mControlState&~eTYPE_MASK)|(type<<eTYPE_SHIFT); }
@@ -180,15 +176,10 @@ namespace Scb
// the scene value field set if the object is either inserted, in simulation, or waiting for removal. If any of these things
// is true, it can't be added to a different scene
- PX_FORCE_INLINE void setScbScene(Scb::Scene* scene)
- {
- mScene = scene;
- }
-
- PX_FORCE_INLINE Scb::Scene* getScbScene() const
- {
- return mScene;
- }
+ PX_FORCE_INLINE void setScbScene(Scb::Scene* scene) { mScene = scene; }
+ PX_FORCE_INLINE Scb::Scene* getScbScene() const { return mScene; }
+ // PT: TODO: remove this redundant function
+ PX_FORCE_INLINE void resetScbScene() { mScene = NULL; }
/**
\brief Get scene pointer from a users perspective.
@@ -200,12 +191,10 @@ namespace Scb
*/
PX_FORCE_INLINE Scb::Scene* getScbSceneForAPI() const
{
- ControlState::Enum state = getControlState();
- return state == ControlState::eINSERT_PENDING || state == ControlState::eIN_SCENE ? mScene : NULL;
+ const ControlState::Enum state = getControlState();
+ return state == ControlState::eINSERT_PENDING || state == ControlState::eIN_SCENE ? mScene : NULL;
}
- PX_FORCE_INLINE void resetScbScene() { mScene = NULL; }
-
PX_FORCE_INLINE bool hasUpdates() const { return getControlFlags() & ControlFlag::eIS_UPDATED; }
PX_FORCE_INLINE PxU32 getControlFlags() const { return (mControlState&eCONTROLFLAG_MASK)>>eCONTROLFLAG_SHIFT; }
PX_FORCE_INLINE void setControlFlag(ControlFlag::Enum f) { mControlState |= (f<<eCONTROLFLAG_SHIFT); }
@@ -254,7 +243,6 @@ namespace Scb
scheduleForUpdate();
mControlState |= flag;
}
-
protected:
~Base(){}
@@ -263,7 +251,6 @@ namespace Scb
PX_FORCE_INLINE void resetBufferFlag(PxU32 flag) { PX_ASSERT((flag & eBUFFERFLAG_MASK) == flag); mControlState &= ~flag; }
PX_FORCE_INLINE void resetAllBufferFlags() { mControlState &=~eBUFFERFLAG_MASK; }
-
/**
\brief Cleanup method after the object has been synced.
@@ -275,12 +262,12 @@ namespace Scb
// DS: this can get called even when mScene == NULL, by removeAggregate (see AggregateFreeStandingCreateDelete test)
// TODO(dsequeira): investigate that when the dust settles on shape refactoring
PX_ASSERT(getControlState()!=ControlState::eNOT_IN_SCENE || mScene == NULL);
- PX_ASSERT(getScbType()!=ScbType::UNDEFINED);
+ PX_ASSERT(getScbType()!=ScbType::eUNDEFINED);
mStreamPtr = NULL;
resetAllBufferFlags();
+// resetControlFlag(ControlFlag::eIS_UPDATED);
}
-
private:
enum { eBUFFERFLAG_MASK = (1<<24) - 1,
eTYPE_MASK = 15<<24,
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbBody.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbBody.h
index 00ce9f52..eec9a032 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbBody.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbBody.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_BODY
#define PX_PHYSICS_SCB_BODY
@@ -110,7 +109,6 @@ struct BodyBuffer : public RigidObjectBuffer //once RigidObject has its own buf
BodyBuffer(): mLinAcceleration(0), mAngAcceleration(0), mLinDeltaVelocity(0), mAngDeltaVelocity(0) {}
};
-
#if PX_VC
#pragma warning(pop)
#endif
@@ -138,8 +136,6 @@ public:
//---------------------------------------------------------------------------------
// Wrapper for Sc::BodyCore interface
//---------------------------------------------------------------------------------
-
-
PX_FORCE_INLINE const PxTransform& getBody2World() const { return mBufferedBody2World; } // PT: important: keep returning an address here (else update prefetch in SceneQueryManager::addShapes)
PX_INLINE void setBody2World(const PxTransform& p, bool asPartOfBody2ActorChange);
@@ -215,10 +211,7 @@ public:
PX_INLINE void syncState();
PX_INLINE void syncCollisionWriteThroughState();
- static size_t getScOffset()
- {
- return reinterpret_cast<size_t>(&reinterpret_cast<Body*>(0)->mBodyCore);
- }
+ static size_t getScOffset() { return reinterpret_cast<size_t>(&reinterpret_cast<Body*>(0)->mBodyCore); }
/**
\brief Shadowed method of #Scb::Base::markUpdated() to store the buffered property flags in a separate location (ran out of flag space)
@@ -340,13 +333,12 @@ private:
template<PxU32 f> PX_FORCE_INLINE typename Buf::Fns<f,0>::Arg read() const { return Access::read<Buf::Fns<f,0> >(*this, mBodyCore); }
template<PxU32 f> PX_FORCE_INLINE void write(typename Buf::Fns<f,0>::Arg v) { Access::write<Buf::Fns<f,0> >(*this, mBodyCore, v); }
template<PxU32 f> PX_FORCE_INLINE void flush(const Buf& buf) { Access::flush<Buf::Fns<f,0> >(*this, mBodyCore, buf); }
-
};
PX_INLINE Body::Body(PxActorType::Enum type, const PxTransform& bodyPose) : mBodyCore(type, bodyPose)
{
- setScbType(ScbType::BODY);
+ setScbType(ScbType::eBODY);
mBufferedBody2World = mBodyCore.getBody2World();
mBufferedLinVelocity = mBodyCore.getLinearVelocity();
@@ -360,21 +352,21 @@ PX_INLINE void Body::setBody2World(const PxTransform& p, bool asPartOfBody2Actor
{
mBufferedBody2World = p;
- if (!isBuffering())
+ if(!isBuffering())
{
mBodyCore.setBody2World(p);
UPDATE_PVD_PROPERTIES_OBJECT()
}
else
{
- if (!asPartOfBody2ActorChange)
+ if(!asPartOfBody2ActorChange)
{
// call was triggered by a setGlobalPose(). This means the simulated body pose will get
// overwritten by the user value, so we do not need to adjust it.
mBodyBufferFlags &= ~Buf::BF_Body2World_CoM;
}
- else if (!(mBodyBufferFlags & Buf::BF_Body2World))
+ else if(!(mBodyBufferFlags & Buf::BF_Body2World))
{
// there has been no setGlobalPose() on the body yet and the center of mass changes.
// This case needs special treatment because the simulation results for such a body will be based on
@@ -391,7 +383,7 @@ PX_INLINE void Body::setLinearVelocity(const PxVec3& v)
{
mBufferedLinVelocity = v;
- if (!isBuffering())
+ if(!isBuffering())
{
mBodyCore.setLinearVelocity(v);
UPDATE_PVD_PROPERTIES_OBJECT()
@@ -404,7 +396,7 @@ PX_INLINE void Body::setAngularVelocity(const PxVec3& v)
{
mBufferedAngVelocity = v;
- if (!isBuffering())
+ if(!isBuffering())
{
mBodyCore.setAngularVelocity(v);
UPDATE_PVD_PROPERTIES_OBJECT()
@@ -418,7 +410,7 @@ PX_INLINE void Body::wakeUpInternal(PxReal wakeCounter)
{
PX_ASSERT(getScbScene());
- if (!isBuffering())
+ if(!isBuffering())
{
setBufferedParamsForAwake(wakeCounter);
mBodyCore.wakeUp(wakeCounter);
@@ -441,10 +433,9 @@ PX_FORCE_INLINE void Body::wakeUp()
wakeUpInternal(scene->getWakeCounterResetValue());
}
-
PX_INLINE void Body::putToSleepInternal()
{
- if (!isBuffering())
+ if(!isBuffering())
{
setBufferedParamsForAsleep();
mBodyCore.putToSleep();
@@ -465,7 +456,6 @@ PX_INLINE void Body::putToSleepInternal()
}
}
-
PX_FORCE_INLINE void Body::putToSleep()
{
PX_ASSERT(!(getFlags() & PxRigidBodyFlag::eKINEMATIC));
@@ -473,16 +463,15 @@ PX_FORCE_INLINE void Body::putToSleep()
putToSleepInternal();
}
-
PX_INLINE void Body::setWakeCounter(PxReal w)
{
PX_ASSERT(!(getFlags() & PxRigidBodyFlag::eKINEMATIC));
mBufferedWakeCounter = w;
- if (!isBuffering())
+ if(!isBuffering())
{
- if (getScbScene() && (w > 0.0f))
+ if(getScbScene() && (w > 0.0f))
mBufferedIsSleeping = 0;
mBodyCore.setWakeCounter(w);
@@ -491,24 +480,23 @@ PX_INLINE void Body::setWakeCounter(PxReal w)
}
else
{
- if (w > 0.0f)
+ if(w > 0.0f)
wakeUpInternal(w);
else
markUpdated(Buf::BF_WakeCounter);
}
}
-
PX_INLINE void Body::setFlags(PxRigidBodyFlags f)
{
- PxU32 wasKinematic = getFlags() & PxRigidBodyFlag::eKINEMATIC;
- PxU32 isKinematic = f & PxRigidBodyFlag::eKINEMATIC;
- bool switchToKinematic = ((!wasKinematic) && isKinematic);
- bool switchToDynamic = (wasKinematic && (!isKinematic));
+ const PxU32 wasKinematic = getFlags() & PxRigidBodyFlag::eKINEMATIC;
+ const PxU32 isKinematic = f & PxRigidBodyFlag::eKINEMATIC;
+ const bool switchToKinematic = ((!wasKinematic) && isKinematic);
+ const bool switchToDynamic = (wasKinematic && (!isKinematic));
- if (!isBuffering())
+ if(!isBuffering())
{
- if (switchToKinematic)
+ if(switchToKinematic)
setBufferedParamsForAsleep();
mBodyCore.setFlags(getScbScene() ? getScbScene()->getScScene().getSimStateDataPool() : NULL, f);
@@ -516,9 +504,9 @@ PX_INLINE void Body::setFlags(PxRigidBodyFlags f)
}
else
{
- if (switchToKinematic)
+ if(switchToKinematic)
putToSleepInternal();
- else if (switchToDynamic)
+ else if(switchToDynamic)
mBodyBufferFlags &= ~Buf::BF_KinematicTarget;
getBodyBuffer()->mRigidBodyFlags = f;
@@ -526,10 +514,9 @@ PX_INLINE void Body::setFlags(PxRigidBodyFlags f)
}
}
-
PX_INLINE void Body::addSpatialAcceleration(const PxVec3* linAcc, const PxVec3* angAcc)
{
- if (!isBuffering())
+ if(!isBuffering())
{
mBodyCore.addSpatialAcceleration(getScbScene()->getScScene().getSimStateDataPool(), linAcc, angAcc);
//Spatial acceleration isn't sent to PVD.
@@ -541,10 +528,9 @@ PX_INLINE void Body::addSpatialAcceleration(const PxVec3* linAcc, const PxVec3*
}
}
-
PX_INLINE void Body::clearSpatialAcceleration(bool force, bool torque)
{
- if (!isBuffering())
+ if(!isBuffering())
{
mBodyCore.clearSpatialAcceleration(force, torque);
//Spatial acceleration isn't sent to PVD.
@@ -556,10 +542,9 @@ PX_INLINE void Body::clearSpatialAcceleration(bool force, bool torque)
}
}
-
PX_INLINE void Body::addSpatialVelocity(const PxVec3* linVelDelta, const PxVec3* angVelDelta)
{
- if (!isBuffering())
+ if(!isBuffering())
{
mBodyCore.addSpatialVelocity(getScbScene()->getScScene().getSimStateDataPool(), linVelDelta, angVelDelta);
UPDATE_PVD_PROPERTIES_OBJECT()
@@ -571,10 +556,9 @@ PX_INLINE void Body::addSpatialVelocity(const PxVec3* linVelDelta, const PxVec3*
}
}
-
PX_INLINE void Body::clearSpatialVelocity(bool force, bool torque)
{
- if (!isBuffering())
+ if(!isBuffering())
{
mBodyCore.clearSpatialVelocity(force, torque);
UPDATE_PVD_PROPERTIES_OBJECT()
@@ -586,28 +570,26 @@ PX_INLINE void Body::clearSpatialVelocity(bool force, bool torque)
}
}
-
PX_INLINE bool Body::getKinematicTarget(PxTransform& p) const
{
- if (isBuffered(Buf::BF_KinematicTarget))
+ if(isBuffered(Buf::BF_KinematicTarget))
{
p = getBodyBuffer()->mKinematicTarget;
return true;
}
- else if (getControlState() != ControlState::eREMOVE_PENDING)
+ else if(getControlState() != ControlState::eREMOVE_PENDING)
return mBodyCore.getKinematicTarget(p);
else
return false;
}
-
PX_INLINE void Body::setKinematicTarget(const PxTransform& p)
{
Scene* scene = getScbScene();
PX_ASSERT(scene); // only allowed for an object in a scene
PxReal wakeCounterResetValue = scene->getWakeCounterResetValue();
- if (!isBuffering())
+ if(!isBuffering())
{
mBodyCore.setKinematicTarget(scene->getScScene().getSimStateDataPool(), p, wakeCounterResetValue);
setBufferedParamsForAwake(wakeCounterResetValue);
@@ -624,21 +606,16 @@ PX_INLINE void Body::setKinematicTarget(const PxTransform& p)
}
#if PX_SUPPORT_PVD
if(getControlState() == ControlState::eIN_SCENE)
- {
scene->getScenePvdClient().updateKinematicTarget(this, p);
- }
#endif
}
-
PX_FORCE_INLINE void Body::onOriginShift(const PxVec3& shift)
{
mBufferedBody2World.p -= shift;
mBodyCore.onOriginShift(shift);
}
-
-
//--------------------------------------------------------------
//
// Miscellaneous
@@ -647,23 +624,19 @@ PX_FORCE_INLINE void Body::onOriginShift(const PxVec3& shift)
PX_FORCE_INLINE bool Body::hasKinematicTarget() const
{
- return
- (
- isBuffered(BodyBuffer::BF_KinematicTarget) || mBodyCore.getHasValidKinematicTarget()
- );
+ return (isBuffered(BodyBuffer::BF_KinematicTarget) || mBodyCore.getHasValidKinematicTarget());
}
-
PX_FORCE_INLINE void Body::clearSimStateDataForPendingInsert()
{
- Sc::BodyCore& core = getScBody();
- if (insertPending())
+ if(insertPending())
{
// not-so-nice-code to cover the following cases:
// - user adds a kinematic to the scene, sets a target and removes the kinematic from scene again (all while the sim is running)
// - same as above but instead of removing the kinematic it gets switched to dynamic
// - user adds a dynamic to the scene, sets a target and removes the dynamic from scene again (all while the sim is running)
+ Sc::BodyCore& core = mBodyCore;
if(core.getSimStateData(true))
core.tearDownSimStateData(getScbScene()->getScScene().getSimStateDataPool(), true);
else if(core.getSimStateData(false))
@@ -671,23 +644,19 @@ PX_FORCE_INLINE void Body::clearSimStateDataForPendingInsert()
}
}
-
PX_FORCE_INLINE void Body::transitionSimStateDataForPendingInsert()
{
- Sc::BodyCore& core = getScBody();
- if (insertPending())
+ if(insertPending())
{
// not-so-nice-code to cover the following case:
// - user adds a dynamic, adds force, then switches to kinematic (all while the sim is running)
+ Sc::BodyCore& core = mBodyCore;
if(core.getSimStateData(false))
- {
core.setupSimStateData(getScbScene()->getScScene().getSimStateDataPool(), true); // note: this won't allocate the memory twice
- }
}
}
-
PX_INLINE PxMat33 Body::getGlobalInertiaTensorInverse() const
{
PxMat33 inverseInertiaWorldSpace;
@@ -695,28 +664,25 @@ PX_INLINE PxMat33 Body::getGlobalInertiaTensorInverse() const
return inverseInertiaWorldSpace;
}
-
PX_FORCE_INLINE bool Body::checkSleepReadinessBesidesWakeCounter()
{
return (getLinearVelocity().isZero() && getAngularVelocity().isZero());
// no need to test for pending force updates yet since currently this is not supported on scene insertion
}
-
PX_FORCE_INLINE void Body::initBufferedState()
{
PX_ASSERT(mBufferedIsSleeping); // this method is only meant to get called when an object is added to the scene
- if ((getWakeCounter() == 0.0f) && checkSleepReadinessBesidesWakeCounter())
+ if((getWakeCounter() == 0.0f) && checkSleepReadinessBesidesWakeCounter())
mBufferedIsSleeping = 1;
else
mBufferedIsSleeping = 0;
}
-
PX_FORCE_INLINE void Body::clearBufferedState()
{
- if (!(getFlags() & PxRigidBodyFlag::eKINEMATIC))
+ if(!(getFlags() & PxRigidBodyFlag::eKINEMATIC))
{
mBufferedIsSleeping = 1; // the expected state when an object gets removed from the scene.
mBodyBufferFlags &= ~(Buf::BF_Acceleration | Buf::BF_DeltaVelocity);
@@ -734,32 +700,29 @@ PX_FORCE_INLINE void Body::clearBufferedState()
RigidObject::clearBufferedState();
}
-
PX_FORCE_INLINE void Body::clearBufferedSleepStateChange()
{
mBodyBufferFlags &= ~(Buf::BF_WakeUp | Buf::BF_PutToSleep);
}
-
PX_FORCE_INLINE void Body::switchBodyToNoSim()
{
Scb::Scene* scene = getScbScene();
switchToNoSim(true);
- if ((!scene) || (!getScbScene()->isPhysicsBuffering()))
+ if((!scene) || (!getScbScene()->isPhysicsBuffering()))
{
setBufferedParamsForAsleep();
- getScBody().putToSleep();
+ mBodyCore.putToSleep();
}
else
putToSleepInternal();
- if (scene)
+ if(scene)
clearSimStateDataForPendingInsert();
}
-
//--------------------------------------------------------------
//
// Data synchronization
@@ -782,7 +745,7 @@ PX_INLINE void Body::syncCollisionWriteThroughState()
PxU32 bufferFlags = mBodyBufferFlags;
//----
- if ((bufferFlags & Buf::BF_LinearVelocity) == 0)
+ if((bufferFlags & Buf::BF_LinearVelocity) == 0)
mBufferedLinVelocity = mBodyCore.getLinearVelocity();
else
{
@@ -800,7 +763,7 @@ PX_INLINE void Body::syncCollisionWriteThroughState()
//----
- if ((bufferFlags & Buf::BF_AngularVelocity) == 0)
+ if((bufferFlags & Buf::BF_AngularVelocity) == 0)
mBufferedAngVelocity = mBodyCore.getAngularVelocity();
else
{
@@ -818,7 +781,7 @@ PX_INLINE void Body::syncCollisionWriteThroughState()
//----
- if (bufferFlags & Buf::BF_KinematicTarget)
+ if(bufferFlags & Buf::BF_KinematicTarget)
{
//don't apply kinematic target unless the actor is kinematic already. setKinematicTarget is write-through properties for split sim but setRigidBodyFlag transition from rigid body to kinematic isn't write-through
if(mBodyCore.getFlags() & PxRigidBodyFlag::eKINEMATIC)
@@ -889,10 +852,10 @@ PX_INLINE void Body::syncCollisionWriteThroughState()
//----
- if ((bufferFlags & Buf::BF_WakeCounter) == 0)
+ if((bufferFlags & Buf::BF_WakeCounter) == 0)
mBufferedWakeCounter = mBodyCore.getWakeCounter();
- else if (!(bufferFlags & (Buf::BF_WakeUp | Buf::BF_PutToSleep))) // if there has been at least one buffered sleep state transition, then there is no use in adjusting the wake counter separately because it will
- // get done in the sleep state update.
+ else if(!(bufferFlags & (Buf::BF_WakeUp | Buf::BF_PutToSleep))) // if there has been at least one buffered sleep state transition, then there is no use in adjusting the wake counter separately because it will
+ // get done in the sleep state update.
{
PX_ASSERT((getControlState() == ControlState::eREMOVE_PENDING) || (mBufferedWakeCounter == 0.0f)); // a wake counter change is always connected to a sleep state change, except if setWakeCounter(0.0f) was called or an object gets removed from the scene after it was woken up.
@@ -943,7 +906,6 @@ PX_INLINE void Body::syncState()
PX_ASSERT( (getControlState() != ControlState::eREMOVE_PENDING) ||
(mBufferedIsSleeping && (!isBuffered(Buf::BF_WakeUp | Buf::BF_PutToSleep))) );
-
//
// IMPORTANT: Since we ran out of space for buffered property flags, the Scb::Body property related flags are stored in mBodyBufferFlags.
// To get the buffer flags from the base classes, use getBufferFlags()
@@ -951,9 +913,9 @@ PX_INLINE void Body::syncState()
const PxU32 bufferFlags = mBodyBufferFlags;
const PxU32 baseBufferFlags = getBufferFlags();
- if ((bufferFlags & Buf::BF_Body2World) == 0)
+ if((bufferFlags & Buf::BF_Body2World) == 0)
mBufferedBody2World = mBodyCore.getBody2World();
- else if ((bufferFlags & Buf::BF_Body2World_CoM) == 0)
+ else if((bufferFlags & Buf::BF_Body2World_CoM) == 0)
mBodyCore.setBody2World(mBufferedBody2World);
else
{
@@ -971,7 +933,7 @@ PX_INLINE void Body::syncState()
//----
- if (baseBufferFlags & Buf::BF_ActorFlags)
+ if(baseBufferFlags & Buf::BF_ActorFlags)
syncNoSimSwitch(*getBodyBuffer(), mBodyCore, true);
//----
@@ -979,7 +941,7 @@ PX_INLINE void Body::syncState()
if(bufferFlags & ~( Buf::BF_WakeCounter|Buf::BF_Body2World|Buf::BF_LinearVelocity|Buf::BF_AngularVelocity
|Buf::BF_WakeUp|Buf::BF_PutToSleep)) // Optimization to avoid all the if-statements below if possible
{
- Buf& buffer = *getBodyBuffer();
+ const Buf& buffer = *getBodyBuffer();
flush<Buf::BF_InverseMass>(buffer);
flush<Buf::BF_InverseInertia>(buffer);
@@ -993,22 +955,19 @@ PX_INLINE void Body::syncState()
flush<Buf::BF_FreezeThreshold>(buffer);
flush<Buf::BF_MaxPenetrationBias>(buffer);
flush<Buf::BF_MaxContactImpulse>(buffer);
- if (bufferFlags & Buf::BF_RigidBodyFlags)
- {
+ if(bufferFlags & Buf::BF_RigidBodyFlags)
mBodyCore.setFlags(getScbScene()->getScScene().getSimStateDataPool(), buffer.mRigidBodyFlags);
- }
}
-
//This method sync all the write through properties in collision and is called in fetchCollision()
syncCollisionWriteThroughState();
//----
- bool isSimObjectSleeping = mBodyCore.isSleeping();
- if ((bufferFlags & (Buf::BF_PutToSleep)) == 0)
+ if((bufferFlags & (Buf::BF_PutToSleep)) == 0)
{
- if (getControlState() != ControlState::eREMOVE_PENDING) // we do not want to sync the simulation sleep state if the object was removed (free standing objects have buffered state sleeping)
+ const bool isSimObjectSleeping = mBodyCore.isSleeping();
+ if(getControlState() != ControlState::eREMOVE_PENDING) // we do not want to sync the simulation sleep state if the object was removed (free standing objects have buffered state sleeping)
mBufferedIsSleeping = PxU32(isSimObjectSleeping);
else
PX_ASSERT(mBufferedIsSleeping); // this must get set immediately at remove
@@ -1046,7 +1005,7 @@ PX_INLINE void Body::syncState()
PX_ASSERT((getControlState() != ControlState::eREMOVE_PENDING) || mBufferedIsSleeping); // nothing in this method should change this
#ifdef _DEBUG
// make sure that for a removed kinematic, the buffered params hold the values as defined in our specification
- if ((mBodyCore.getFlags() & PxRigidBodyFlag::eKINEMATIC) && (getControlState() == ControlState::eREMOVE_PENDING))
+ if((mBodyCore.getFlags() & PxRigidBodyFlag::eKINEMATIC) && (getControlState() == ControlState::eREMOVE_PENDING))
{
PX_ASSERT(mBufferedLinVelocity.isZero());
PX_ASSERT(mBufferedAngVelocity.isZero());
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbCloth.cpp b/PhysX_3.4/Source/PhysX/src/buffering/ScbCloth.cpp
index ecee8baa..7aaf9f83 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbCloth.cpp
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbCloth.cpp
@@ -38,21 +38,17 @@ using namespace physx;
Scb::Cloth::Cloth(const PxTransform& globalPose, Sc::ClothFabricCore& fabric, const PxClothParticle* particles, PxClothFlags flags) :
mCloth(globalPose, fabric, particles, flags)
{
- setScbType(ScbType::CLOTH);
+ setScbType(ScbType::eCLOTH);
}
-
Scb::Cloth::~Cloth()
{
}
-
void Scb::Cloth::syncState()
{
- if (getBufferFlags()) // Optimization to avoid all the if-statements below if possible
- {
+ if(getBufferFlags()) // Optimization to avoid all the if-statements below if possible
Actor::syncState();
- }
postSyncState();
}
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbCloth.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbCloth.h
index 238df91f..31f505dc 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbCloth.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbCloth.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_CLOTH
#define PX_PHYSICS_SCB_CLOTH
@@ -42,12 +41,10 @@
namespace physx
{
-
struct PxClothCollisionSphere;
namespace Scb
{
-
class Cloth : public Scb::Actor
{
//= ATTENTION! =====================================================================================
@@ -72,8 +69,8 @@ public:
// Wrapper for Sc::ClothCore interface
//---------------------------------------------------------------------------------
- PX_INLINE Sc::ClothFabricCore* getFabric() const;
- PX_INLINE void resetFabric();
+ PX_INLINE Sc::ClothFabricCore* getFabric() const { return mCloth.getFabric(); }
+ PX_INLINE void resetFabric() { return mCloth.resetFabric(); }
PX_INLINE void setParticles(const PxClothParticle* currentParticles, const PxClothParticle* previousParticles);
PX_INLINE PxU32 getNbParticles() const;
@@ -215,7 +212,6 @@ public:
PX_INLINE void setRestOffset(PxReal);
PX_INLINE PxReal getRestOffset() const;
-
//---------------------------------------------------------------------------------
// Data synchronization
//---------------------------------------------------------------------------------
@@ -229,29 +225,15 @@ public:
PX_FORCE_INLINE const Sc::ClothCore& getScCloth() const { return mCloth; } // Only use if you know what you're doing!
PX_FORCE_INLINE Sc::ClothCore& getScCloth() { return mCloth; } // Only use if you know what you're doing!
- static size_t getScOffset()
- {
- return reinterpret_cast<size_t>(&reinterpret_cast<Cloth*>(0)->mCloth);
- }
+ static size_t getScOffset() { return reinterpret_cast<size_t>(&reinterpret_cast<Cloth*>(0)->mCloth); }
private:
Sc::ClothCore mCloth;
};
-
-PX_INLINE Sc::ClothFabricCore* Cloth::getFabric() const
-{
- return mCloth.getFabric();
-}
-
-PX_INLINE void Cloth::resetFabric()
-{
- return mCloth.resetFabric();
-}
-
PX_INLINE void Cloth::setParticles(const PxClothParticle* currentParticles, const PxClothParticle* previousParticles)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setParticles(currentParticles, previousParticles);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setParticles() not allowed while simulation is running.");
@@ -264,16 +246,15 @@ PX_INLINE PxU32 Cloth::getNbParticles() const
PX_INLINE void Cloth::setMotionConstraints(const PxClothParticleMotionConstraint* motionConstraints)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setMotionConstraints(motionConstraints);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setMotionConstraints() not allowed while simulation is running.");
}
-
PX_INLINE bool Cloth::getMotionConstraints(PxClothParticleMotionConstraint* motionConstraintsBuffer) const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getMotionConstraints(motionConstraintsBuffer);
else
{
@@ -289,7 +270,7 @@ PX_INLINE PxU32 Cloth::getNbMotionConstraints() const
PX_INLINE PxClothMotionConstraintConfig Cloth::getMotionConstraintConfig() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getMotionConstraintConfig();
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getMotionConstraintScaleBias() not allowed while simulation is running.");
@@ -297,10 +278,9 @@ PX_INLINE PxClothMotionConstraintConfig Cloth::getMotionConstraintConfig() const
return PxClothMotionConstraintConfig();
}
-
PX_INLINE void Cloth::setMotionConstraintConfig(const PxClothMotionConstraintConfig& config)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setMotionConstraintConfig(config);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setMotionConstraintConfig() not allowed while simulation is running.");
@@ -308,16 +288,15 @@ PX_INLINE void Cloth::setMotionConstraintConfig(const PxClothMotionConstraintCon
PX_INLINE void Cloth::setSeparationConstraints(const PxClothParticleSeparationConstraint* separationConstraints)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setSeparationConstraints(separationConstraints);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSeparationConstraints() not allowed while simulation is running.");
}
-
PX_INLINE bool Cloth::getSeparationConstraints(PxClothParticleSeparationConstraint* separationConstraintsBuffer) const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getSeparationConstraints(separationConstraintsBuffer);
else
{
@@ -338,16 +317,15 @@ PX_INLINE void Cloth::clearInterpolation()
PX_INLINE void Cloth::setParticleAccelerations(const PxVec4* particleAccelerations)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setParticleAccelerations(particleAccelerations);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setParticleAccelerations() not allowed while simulation is running.");
}
-
PX_INLINE bool Cloth::getParticleAccelerations(PxVec4* particleAccelerationsBuffer) const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getParticleAccelerations(particleAccelerationsBuffer);
else
{
@@ -363,28 +341,31 @@ PX_INLINE PxU32 Cloth::getNbParticleAccelerations() const
PX_INLINE void Cloth::addCollisionSphere(const PxClothCollisionSphere& sphere)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.addCollisionSphere(sphere);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::addCollisionSphere() not allowed while simulation is running.");
}
+
PX_INLINE void Cloth::removeCollisionSphere(PxU32 index)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.removeCollisionSphere(index);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::removeCollisionSphere() not allowed while simulation is running.");
}
+
PX_INLINE void Cloth::setCollisionSpheres(const PxClothCollisionSphere* spheresBuffer, PxU32 count)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setCollisionSpheres(spheresBuffer, count);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setCollisionSpheres() not allowed while simulation is running.");
}
+
PX_INLINE PxU32 Cloth::getNbCollisionSpheres() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getNbCollisionSpheres();
else
{
@@ -396,30 +377,31 @@ PX_INLINE PxU32 Cloth::getNbCollisionSpheres() const
PX_INLINE void Cloth::getCollisionData( PxClothCollisionSphere* spheresBuffer, PxU32* capsulesBuffer,
PxClothCollisionPlane* planesBuffer, PxU32* convexesBuffer, PxClothCollisionTriangle* trianglesBuffer ) const
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.getCollisionData(spheresBuffer, capsulesBuffer, planesBuffer, convexesBuffer, trianglesBuffer);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getCollisionData() not allowed while simulation is running.");
}
-
PX_INLINE void Cloth::addCollisionCapsule(PxU32 first, PxU32 second)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.addCollisionCapsule(first, second);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::addCollisionCapsule() not allowed while simulation is running.");
}
+
PX_INLINE void Cloth::removeCollisionCapsule(PxU32 index)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.removeCollisionCapsule(index);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::removeCollisionCapsule() not allowed while simulation is running.");
}
+
PX_INLINE PxU32 Cloth::getNbCollisionCapsules() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getNbCollisionCapsules();
else
{
@@ -430,28 +412,31 @@ PX_INLINE PxU32 Cloth::getNbCollisionCapsules() const
PX_INLINE void Cloth::addCollisionTriangle(const PxClothCollisionTriangle& triangle)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.addCollisionTriangle(triangle);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::addCollisionTriangle() not allowed while simulation is running.");
}
+
PX_INLINE void Cloth::removeCollisionTriangle(PxU32 index)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.removeCollisionTriangle(index);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::removeCollisionTriangle() not allowed while simulation is running.");
}
+
PX_INLINE void Cloth::setCollisionTriangles(const PxClothCollisionTriangle* trianglesBuffer, PxU32 count)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setCollisionTriangles(trianglesBuffer, count);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setCollisionTriangles() not allowed while simulation is running.");
}
+
PX_INLINE PxU32 Cloth::getNbCollisionTriangles() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getNbCollisionTriangles();
else
{
@@ -462,28 +447,31 @@ PX_INLINE PxU32 Cloth::getNbCollisionTriangles() const
PX_INLINE void Cloth::addCollisionPlane(const PxClothCollisionPlane& plane)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.addCollisionPlane(plane);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::addCollisionPlane() not allowed while simulation is running.");
}
+
PX_INLINE void Cloth::removeCollisionPlane(PxU32 index)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.removeCollisionPlane(index);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::removeCollisionPlane() not allowed while simulation is running.");
}
+
PX_INLINE void Cloth::setCollisionPlanes(const PxClothCollisionPlane* planesBuffer, PxU32 count)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setCollisionPlanes(planesBuffer, count);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setCollisionPlanes() not allowed while simulation is running.");
}
+
PX_INLINE PxU32 Cloth::getNbCollisionPlanes() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getNbCollisionPlanes();
else
{
@@ -494,21 +482,23 @@ PX_INLINE PxU32 Cloth::getNbCollisionPlanes() const
PX_INLINE void Cloth::addCollisionConvex(PxU32 mask)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.addCollisionConvex(mask);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::addCollisionConvex() not allowed while simulation is running.");
}
+
PX_INLINE void Cloth::removeCollisionConvex(PxU32 index)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.removeCollisionConvex(index);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::removeCollisionConvex() not allowed while simulation is running.");
}
+
PX_INLINE PxU32 Cloth::getNbCollisionConvexes() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getNbCollisionConvexes();
else
{
@@ -517,19 +507,17 @@ PX_INLINE PxU32 Cloth::getNbCollisionConvexes() const
}
}
-
PX_INLINE void Cloth::setVirtualParticles(PxU32 numParticles, const PxU32* indices, PxU32 numWeights, const PxVec3* weights)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setVirtualParticles(numParticles, indices, numWeights, weights);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setVirtualParticles() not allowed while simulation is running.");
}
-
PX_INLINE PxU32 Cloth::getNbVirtualParticles() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getNbVirtualParticles();
else
{
@@ -538,19 +526,17 @@ PX_INLINE PxU32 Cloth::getNbVirtualParticles() const
}
}
-
PX_INLINE void Cloth::getVirtualParticles(PxU32* indicesBuffer) const
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.getVirtualParticles(indicesBuffer);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getVirtualParticles() not allowed while simulation is running.");
}
-
PX_INLINE PxU32 Cloth::getNbVirtualParticleWeights() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getNbVirtualParticleWeights();
else
{
@@ -559,19 +545,17 @@ PX_INLINE PxU32 Cloth::getNbVirtualParticleWeights() const
}
}
-
PX_INLINE void Cloth::getVirtualParticleWeights(PxVec3* weightsBuffer) const
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.getVirtualParticleWeights(weightsBuffer);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::getVirtualParticleWeights() not allowed while simulation is running.");
}
-
PX_INLINE PxTransform Cloth::getGlobalPose() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getGlobalPose();
else
{
@@ -580,28 +564,25 @@ PX_INLINE PxTransform Cloth::getGlobalPose() const
}
}
-
PX_INLINE void Cloth::setGlobalPose(const PxTransform& pose)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setGlobalPose(pose);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setGlobalPose() not allowed while simulation is running.");
}
-
PX_INLINE void Cloth::setTargetPose(const PxTransform& pose)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setTargetPose(pose);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setTargetPose() not allowed while simulation is running.");
}
-
PX_INLINE PxVec3 Cloth::getExternalAcceleration() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getExternalAcceleration();
else
{
@@ -610,10 +591,9 @@ PX_INLINE PxVec3 Cloth::getExternalAcceleration() const
}
}
-
PX_INLINE void Cloth::setExternalAcceleration(PxVec3 acceleration)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setExternalAcceleration(acceleration);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setExternalAcceleration() not allowed while simulation is running.");
@@ -621,7 +601,7 @@ PX_INLINE void Cloth::setExternalAcceleration(PxVec3 acceleration)
PX_INLINE PxVec3 Cloth::getLinearInertiaScale() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getLinearInertiaScale();
else
{
@@ -630,10 +610,9 @@ PX_INLINE PxVec3 Cloth::getLinearInertiaScale() const
}
}
-
PX_INLINE void Cloth::setLinearInertiaScale(PxVec3 scale)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setLinearInertiaScale(scale);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setLinearInertiaScale() not allowed while simulation is running.");
@@ -641,7 +620,7 @@ PX_INLINE void Cloth::setLinearInertiaScale(PxVec3 scale)
PX_INLINE PxVec3 Cloth::getAngularInertiaScale() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getAngularInertiaScale();
else
{
@@ -650,10 +629,9 @@ PX_INLINE PxVec3 Cloth::getAngularInertiaScale() const
}
}
-
PX_INLINE void Cloth::setAngularInertiaScale(PxVec3 scale)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setAngularInertiaScale(scale);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setAngularInertiaScale() not allowed while simulation is running.");
@@ -661,7 +639,7 @@ PX_INLINE void Cloth::setAngularInertiaScale(PxVec3 scale)
PX_INLINE PxVec3 Cloth::getCentrifugalInertiaScale() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getCentrifugalInertiaScale();
else
{
@@ -670,10 +648,9 @@ PX_INLINE PxVec3 Cloth::getCentrifugalInertiaScale() const
}
}
-
PX_INLINE void Cloth::setCentrifugalInertiaScale(PxVec3 scale)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setCentrifugalInertiaScale(scale);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setCentrifugalInertiaScale() not allowed while simulation is running.");
@@ -681,7 +658,7 @@ PX_INLINE void Cloth::setCentrifugalInertiaScale(PxVec3 scale)
PX_INLINE PxVec3 Cloth::getDampingCoefficient() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getDampingCoefficient();
else
{
@@ -690,10 +667,9 @@ PX_INLINE PxVec3 Cloth::getDampingCoefficient() const
}
}
-
PX_INLINE void Cloth::setDampingCoefficient(PxVec3 dampingCoefficient)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setDampingCoefficient(dampingCoefficient);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setDampingCoefficient() not allowed while simulation is running.");
@@ -701,7 +677,7 @@ PX_INLINE void Cloth::setDampingCoefficient(PxVec3 dampingCoefficient)
PX_INLINE PxReal Cloth::getFrictionCoefficient() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getFrictionCoefficient();
else
{
@@ -710,10 +686,9 @@ PX_INLINE PxReal Cloth::getFrictionCoefficient() const
}
}
-
PX_INLINE void Cloth::setFrictionCoefficient(PxReal frictionCoefficient)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setFrictionCoefficient(frictionCoefficient);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setFrictionCoefficient() not allowed while simulation is running.");
@@ -721,7 +696,7 @@ PX_INLINE void Cloth::setFrictionCoefficient(PxReal frictionCoefficient)
PX_INLINE PxVec3 Cloth::getLinearDragCoefficient() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getLinearDragCoefficient();
else
{
@@ -730,10 +705,9 @@ PX_INLINE PxVec3 Cloth::getLinearDragCoefficient() const
}
}
-
PX_INLINE void Cloth::setLinearDragCoefficient(PxVec3 dampingCoefficient)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setLinearDragCoefficient(dampingCoefficient);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setLinearDragCoefficient() not allowed while simulation is running.");
@@ -741,7 +715,7 @@ PX_INLINE void Cloth::setLinearDragCoefficient(PxVec3 dampingCoefficient)
PX_INLINE PxVec3 Cloth::getAngularDragCoefficient() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getAngularDragCoefficient();
else
{
@@ -750,10 +724,9 @@ PX_INLINE PxVec3 Cloth::getAngularDragCoefficient() const
}
}
-
PX_INLINE void Cloth::setAngularDragCoefficient(PxVec3 dampingCoefficient)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setAngularDragCoefficient(dampingCoefficient);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setAngularDragCoefficient() not allowed while simulation is running.");
@@ -761,7 +734,7 @@ PX_INLINE void Cloth::setAngularDragCoefficient(PxVec3 dampingCoefficient)
PX_INLINE PxReal Cloth::getCollisionMassScale() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getCollisionMassScale();
else
{
@@ -769,9 +742,10 @@ PX_INLINE PxReal Cloth::getCollisionMassScale() const
return 0.0f;
}
}
+
PX_INLINE void Cloth::setCollisionMassScale(PxReal scalingCoefficient)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setCollisionMassScale(scalingCoefficient);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setCollisionMassScale() not allowed while simulation is running.");
@@ -779,7 +753,7 @@ PX_INLINE void Cloth::setCollisionMassScale(PxReal scalingCoefficient)
PX_INLINE PxReal Cloth::getSelfCollisionDistance() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getSelfCollisionDistance();
else
{
@@ -787,16 +761,18 @@ PX_INLINE PxReal Cloth::getSelfCollisionDistance() const
return 0.0f;
}
}
+
PX_INLINE void Cloth::setSelfCollisionDistance(PxReal distance)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setSelfCollisionDistance(distance);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSelfCollisionDistance() not allowed while simulation is running.");
}
+
PX_INLINE PxReal Cloth::getSelfCollisionStiffness() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getSelfCollisionStiffness();
else
{
@@ -804,9 +780,10 @@ PX_INLINE PxReal Cloth::getSelfCollisionStiffness() const
return 0.0f;
}
}
+
PX_INLINE void Cloth::setSelfCollisionStiffness(PxReal stiffness)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setSelfCollisionStiffness(stiffness);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSelfCollisionStiffness() not allowed while simulation is running.");
@@ -814,7 +791,7 @@ PX_INLINE void Cloth::setSelfCollisionStiffness(PxReal stiffness)
PX_INLINE void Cloth::setSelfCollisionIndices(const PxU32* indices, PxU32 nbIndices)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setSelfCollisionIndices(indices, nbIndices);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSelfCollisionIndices() not allowed while simulation is running.");
@@ -822,7 +799,7 @@ PX_INLINE void Cloth::setSelfCollisionIndices(const PxU32* indices, PxU32 nbIndi
PX_INLINE bool Cloth::getSelfCollisionIndices(PxU32* indices) const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getSelfCollisionIndices(indices);
else
{
@@ -836,10 +813,9 @@ PX_INLINE PxU32 Cloth::getNbSelfCollisionIndices() const
return mCloth.getNbSelfCollisionIndices();
}
-
PX_INLINE void Cloth::setRestPositions(const PxVec4* restPositions)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setRestPositions(restPositions);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setRestPositions() not allowed while simulation is running.");
@@ -847,7 +823,7 @@ PX_INLINE void Cloth::setRestPositions(const PxVec4* restPositions)
PX_INLINE bool Cloth::getRestPositions(PxVec4* restPositions) const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getRestPositions(restPositions);
else
{
@@ -863,7 +839,7 @@ PX_INLINE PxU32 Cloth::getNbRestPositions() const
PX_INLINE PxReal Cloth::getSolverFrequency() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getSolverFrequency();
else
{
@@ -872,10 +848,9 @@ PX_INLINE PxReal Cloth::getSolverFrequency() const
}
}
-
PX_INLINE void Cloth::setSolverFrequency(PxReal solverFreq)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setSolverFrequency(solverFreq);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSolverFrequency() not allowed while simulation is running.");
@@ -883,7 +858,7 @@ PX_INLINE void Cloth::setSolverFrequency(PxReal solverFreq)
PX_INLINE PxReal Cloth::getStiffnessFrequency() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getStiffnessFrequency();
else
{
@@ -892,19 +867,17 @@ PX_INLINE PxReal Cloth::getStiffnessFrequency() const
}
}
-
PX_INLINE void Cloth::setStiffnessFrequency(PxReal solverFreq)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setStiffnessFrequency(solverFreq);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setStiffnessFrequency() not allowed while simulation is running.");
}
-
PX_INLINE void Cloth::setStretchConfig(PxClothFabricPhaseType::Enum type, const PxClothStretchConfig& config)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setStretchConfig(type, config);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setStretchConfig() not allowed while simulation is running.");
@@ -912,7 +885,7 @@ PX_INLINE void Cloth::setStretchConfig(PxClothFabricPhaseType::Enum type, const
PX_INLINE void Cloth::setTetherConfig(const PxClothTetherConfig& config)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setTetherConfig(config);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setTetherConfig() not allowed while simulation is running.");
@@ -920,7 +893,7 @@ PX_INLINE void Cloth::setTetherConfig(const PxClothTetherConfig& config)
PX_INLINE PxClothStretchConfig Cloth::getStretchConfig(PxClothFabricPhaseType::Enum type) const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getStretchConfig(type);
else
{
@@ -931,7 +904,7 @@ PX_INLINE PxClothStretchConfig Cloth::getStretchConfig(PxClothFabricPhaseType::E
PX_INLINE PxClothTetherConfig Cloth::getTetherConfig() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getTetherConfig();
else
{
@@ -942,7 +915,7 @@ PX_INLINE PxClothTetherConfig Cloth::getTetherConfig() const
PX_INLINE PxClothFlags Cloth::getClothFlags() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getClothFlags();
else
{
@@ -951,10 +924,9 @@ PX_INLINE PxClothFlags Cloth::getClothFlags() const
}
}
-
PX_INLINE void Cloth::setClothFlags(PxClothFlags flags)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setClothFlags(flags);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setClothFlag() not allowed while simulation is running.");
@@ -962,7 +934,7 @@ PX_INLINE void Cloth::setClothFlags(PxClothFlags flags)
PX_INLINE PxVec3 Cloth::getWindVelocity() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getWindVelocity();
else
{
@@ -973,7 +945,7 @@ PX_INLINE PxVec3 Cloth::getWindVelocity() const
PX_INLINE void Cloth::setWindVelocity(PxVec3 wind)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setWindVelocity(wind);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setWindVelocity() not allowed while simulation is running.");
@@ -981,7 +953,7 @@ PX_INLINE void Cloth::setWindVelocity(PxVec3 wind)
PX_INLINE PxReal Cloth::getDragCoefficient() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getDragCoefficient();
else
{
@@ -992,7 +964,7 @@ PX_INLINE PxReal Cloth::getDragCoefficient() const
PX_INLINE void Cloth::setDragCoefficient(PxReal value)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setDragCoefficient(value);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setDragCoefficient() not allowed while simulation is running.");
@@ -1000,7 +972,7 @@ PX_INLINE void Cloth::setDragCoefficient(PxReal value)
PX_INLINE PxReal Cloth::getLiftCoefficient() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getLiftCoefficient();
else
{
@@ -1011,16 +983,15 @@ PX_INLINE PxReal Cloth::getLiftCoefficient() const
PX_INLINE void Cloth::setLiftCoefficient(PxReal value)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setLiftCoefficient(value);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setLiftCoefficient() not allowed while simulation is running.");
}
-
PX_INLINE bool Cloth::isSleeping() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.isSleeping();
else
{
@@ -1029,10 +1000,9 @@ PX_INLINE bool Cloth::isSleeping() const
}
}
-
PX_INLINE PxReal Cloth::getSleepLinearVelocity() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getSleepLinearVelocity();
else
{
@@ -1041,28 +1011,25 @@ PX_INLINE PxReal Cloth::getSleepLinearVelocity() const
}
}
-
PX_INLINE void Cloth::setSleepLinearVelocity(PxReal threshold)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setSleepLinearVelocity(threshold);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSleepLinearVelocity() not allowed while simulation is running.");
}
-
PX_INLINE void Cloth::setWakeCounter(PxReal wakeCounterValue)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setWakeCounter(wakeCounterValue);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setWakeCounter() not allowed while simulation is running.");
}
-
PX_INLINE PxReal Cloth::getWakeCounter() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getWakeCounter();
else
{
@@ -1071,31 +1038,28 @@ PX_INLINE PxReal Cloth::getWakeCounter() const
}
}
-
PX_INLINE void Cloth::wakeUp()
{
Scene* scene = getScbScene();
PX_ASSERT(scene); // only allowed for an object in a scene
- if (!isBuffering())
+ if(!isBuffering())
mCloth.wakeUp(scene->getWakeCounterResetValue());
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::wakeUp() not allowed while simulation is running.");
}
-
PX_INLINE void Cloth::putToSleep()
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.putToSleep();
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::putToSleep() not allowed while simulation is running.");
}
-
PX_INLINE void Cloth::getParticleData(NpClothParticleData& particleData)
{
- if (!isBuffering())
+ if(!isBuffering())
return getScCloth().getParticleData(particleData);
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__,
@@ -1105,10 +1069,9 @@ PX_INLINE void Cloth::getParticleData(NpClothParticleData& particleData)
particleData.previousParticles = 0;
}
-
PxReal Cloth::getPreviousTimeStep() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getPreviousTimeStep();
else
{
@@ -1117,10 +1080,9 @@ PxReal Cloth::getPreviousTimeStep() const
}
}
-
PX_INLINE PxBounds3 Cloth::getWorldBounds() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getWorldBounds();
else
{
@@ -1131,7 +1093,7 @@ PX_INLINE PxBounds3 Cloth::getWorldBounds() const
PX_INLINE void Cloth::setSimulationFilterData(const PxFilterData& data)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setSimulationFilterData(data);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setSimulationFilterData() not allowed while simulation is running.");
@@ -1139,7 +1101,7 @@ PX_INLINE void Cloth::setSimulationFilterData(const PxFilterData& data)
PX_INLINE PxFilterData Cloth::getSimulationFilterData() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getSimulationFilterData();
else
{
@@ -1150,7 +1112,7 @@ PX_INLINE PxFilterData Cloth::getSimulationFilterData() const
PX_INLINE void Cloth::setContactOffset(PxReal offset)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setContactOffset(offset);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setContactOffset() not allowed while simulation is running.");
@@ -1158,7 +1120,7 @@ PX_INLINE void Cloth::setContactOffset(PxReal offset)
PX_INLINE PxReal Cloth::getContactOffset() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getContactOffset();
else
{
@@ -1169,7 +1131,7 @@ PX_INLINE PxReal Cloth::getContactOffset() const
PX_INLINE void Cloth::setRestOffset(PxReal offset)
{
- if (!isBuffering())
+ if(!isBuffering())
mCloth.setRestOffset(offset);
else
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Call to PxCloth::setRestOffset() not allowed while simulation is running.");
@@ -1177,7 +1139,7 @@ PX_INLINE void Cloth::setRestOffset(PxReal offset)
PX_INLINE PxReal Cloth::getRestOffset() const
{
- if (!isBuffering())
+ if(!isBuffering())
return mCloth.getRestOffset();
else
{
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbConstraint.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbConstraint.h
index d4661e2d..53dcef8f 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbConstraint.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbConstraint.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_CONSTRAINTSHADER
#define PX_PHYSICS_SCB_CONSTRAINTSHADER
@@ -110,28 +109,22 @@ public:
PX_INLINE bool updateConstants(void* addr);
-
//---------------------------------------------------------------------------------
// Data synchronization
//---------------------------------------------------------------------------------
PX_INLINE void prepareForActorRemoval();
PX_INLINE void syncState();
-
//---------------------------------------------------------------------------------
// Miscellaneous
//---------------------------------------------------------------------------------
- PX_FORCE_INLINE const Core& getScConstraint() const { return mConstraint; } // Only use if you know what you're doing!
- PX_FORCE_INLINE Core& getScConstraint() { return mConstraint; } // Only use if you know what you're doing!
+ PX_FORCE_INLINE const Core& getScConstraint() const { return mConstraint; } // Only use if you know what you're doing!
+ PX_FORCE_INLINE Core& getScConstraint() { return mConstraint; } // Only use if you know what you're doing!
PX_FORCE_INLINE static Constraint& fromSc(Core &a) { return *reinterpret_cast<Constraint*>(reinterpret_cast<PxU8*>(&a)-getScOffset()); }
PX_FORCE_INLINE static const Constraint& fromSc(const Core &a) { return *reinterpret_cast<const Constraint*>(reinterpret_cast<const PxU8*>(&a)-getScOffset()); }
-
- static size_t getScOffset()
- {
- return reinterpret_cast<size_t>(&reinterpret_cast<Constraint*>(0)->mConstraint);
- }
+ static size_t getScOffset() { return reinterpret_cast<size_t>(&reinterpret_cast<Constraint*>(0)->mConstraint); }
private:
Core mConstraint;
@@ -144,18 +137,18 @@ private:
PxConstraintFlags mBrokenFlag;
PX_FORCE_INLINE const Buf* getBufferedData() const { return reinterpret_cast<const Buf*>(getStream()); }
- PX_FORCE_INLINE Buf* getBufferedData() { return reinterpret_cast<Buf*>(getStream()); }
+ PX_FORCE_INLINE Buf* getBufferedData() { return reinterpret_cast<Buf*>(getStream()); }
};
} // namespace Scb
PX_INLINE Scb::Constraint::Constraint(PxConstraintConnector& connector, const PxConstraintShaderTable& shaders, PxU32 dataSize) :
- mConstraint(connector, shaders, dataSize),
- mBufferedForce(0.0f),
- mBufferedTorque(0.0f),
- mBrokenFlag(0)
+ mConstraint (connector, shaders, dataSize),
+ mBufferedForce (0.0f),
+ mBufferedTorque (0.0f),
+ mBrokenFlag (0)
{
- setScbType(ScbType::CONSTRAINT);
+ setScbType(ScbType::eCONSTRAINT);
}
PX_INLINE PxConstraintConnector* Scb::Constraint::getPxConnector() const
@@ -165,7 +158,7 @@ PX_INLINE PxConstraintConnector* Scb::Constraint::getPxConnector() const
PX_INLINE void Scb::Constraint::setFlags(PxConstraintFlags f)
{
- if (!isBuffering())
+ if(!isBuffering())
{
mConstraint.setFlags(f);
UPDATE_PVD_PROPERTIES_OBJECT()
@@ -183,13 +176,12 @@ PX_INLINE PxConstraintFlags Scb::Constraint::getFlags() const
: mConstraint.getFlags() & (~(PxConstraintFlag::eBROKEN | PxConstraintFlag::eGPU_COMPATIBLE) | mBrokenFlag);
}
-
PX_INLINE void Scb::Constraint::setBodies(Scb::RigidObject* r0, Scb::RigidObject* r1)
{
Sc::RigidCore* scR0 = r0 ? &r0->getScRigidCore() : NULL;
Sc::RigidCore* scR1 = r1 ? &r1->getScRigidCore() : NULL;
- if (!isBuffering())
+ if(!isBuffering())
{
mConstraint.prepareForSetBodies();
mConstraint.setBodies(scR0, scR1);
@@ -203,22 +195,19 @@ PX_INLINE void Scb::Constraint::setBodies(Scb::RigidObject* r0, Scb::RigidObject
markUpdated(BF_BODIES);
}
- mBufferedForce = PxVec3(0);
- mBufferedTorque = PxVec3(0);
+ mBufferedForce = PxVec3(0.0f);
+ mBufferedTorque = PxVec3(0.0f);
}
-
-
PX_INLINE void Scb::Constraint::getForce(PxVec3& force, PxVec3& torque) const
{
force = mBufferedForce;
torque = mBufferedTorque;
}
-
PX_INLINE void Scb::Constraint::setBreakForce(PxReal linear, PxReal angular)
{
- if (!isBuffering())
+ if(!isBuffering())
{
mConstraint.setBreakForce(linear, angular);
UPDATE_PVD_PROPERTIES_OBJECT()
@@ -232,10 +221,9 @@ PX_INLINE void Scb::Constraint::setBreakForce(PxReal linear, PxReal angular)
}
}
-
PX_INLINE void Scb::Constraint::getBreakForce(PxReal& linear, PxReal& angular) const
{
- if (isBuffered(BF_BREAK_IMPULSE))
+ if(isBuffered(BF_BREAK_IMPULSE))
{
const Buf* PX_RESTRICT bufferedData = getBufferedData();
linear = bufferedData->linBreakForce;
@@ -245,10 +233,9 @@ PX_INLINE void Scb::Constraint::getBreakForce(PxReal& linear, PxReal& angular) c
mConstraint.getBreakForce(linear, angular);
}
-
PX_INLINE void Scb::Constraint::setMinResponseThreshold(PxReal threshold)
{
- if (!isBuffering())
+ if(!isBuffering())
{
mConstraint.setMinResponseThreshold(threshold);
UPDATE_PVD_PROPERTIES_OBJECT()
@@ -261,10 +248,9 @@ PX_INLINE void Scb::Constraint::setMinResponseThreshold(PxReal threshold)
}
}
-
PX_INLINE PxReal Scb::Constraint::getMinResponseThreshold() const
{
- if (isBuffered(BF_MIN_RESPONSE_THRESHOLD))
+ if(isBuffered(BF_MIN_RESPONSE_THRESHOLD))
{
const Buf* PX_RESTRICT bufferedData = getBufferedData();
return bufferedData->minResponseThreshold;
@@ -273,8 +259,6 @@ PX_INLINE PxReal Scb::Constraint::getMinResponseThreshold() const
return mConstraint.getMinResponseThreshold();
}
-
-
PX_INLINE bool Scb::Constraint::updateConstants(void* addr)
{
PX_ASSERT(!getScbScene()->isPhysicsBuffering());
@@ -282,7 +266,6 @@ PX_INLINE bool Scb::Constraint::updateConstants(void* addr)
return mConstraint.updateConstants(addr);
}
-
//--------------------------------------------------------------
//
// Data synchronization
@@ -306,7 +289,7 @@ PX_INLINE void Scb::Constraint::syncState()
mBrokenFlag = mConstraint.getFlags() & PxConstraintFlag::eBROKEN;
- PxU32 flags = getBufferFlags();
+ const PxU32 flags = getBufferFlags();
if(flags)
{
const Buf* PX_RESTRICT bufferedData = getBufferedData();
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbDefs.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbDefs.h
index bd3fd4cd..cdbc75f6 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbDefs.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbDefs.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_DEFS
#define PX_PHYSICS_SCB_DEFS
@@ -48,37 +47,34 @@
// BufferAccess template (e.g. to compile without buffering), and also to size-reduce that template
// by passing function pointers if necessary
-#define SCB_REGULAR_ATTRIBUTE(_val, _type, _name) \
-enum { BF_##_name = 1<<(_val) }; \
-_type m##_name; \
-template<PxU32 Dummy> struct Fns<1<<(_val),Dummy> \
-{ \
- typedef typename ArgType<_type>::Type Arg; \
- enum { flag = 1<<(_val) }; \
- static PX_FORCE_INLINE Arg getBuffered(const Buf& buf) { return Arg(buf.m##_name);} \
- static PX_FORCE_INLINE void setBuffered(Buf& buf, Arg v) { buf.m##_name = v;} \
- static PX_FORCE_INLINE Arg getCore(const Core& core) { return Arg(core.get##_name());} \
- static PX_FORCE_INLINE void setCore(Core& core, Arg v) { core.set##_name(v);} \
+#define SCB_REGULAR_ATTRIBUTE(_val, _type, _name) \
+enum { BF_##_name = 1<<(_val) }; \
+_type m##_name; \
+template<PxU32 Dummy> struct Fns<1<<(_val),Dummy> \
+{ \
+ typedef typename ArgType<_type>::Type Arg; \
+ enum { flag = 1<<(_val) }; \
+ static PX_FORCE_INLINE Arg getBuffered(const Buf& buf) { return Arg(buf.m##_name);} \
+ static PX_FORCE_INLINE void setBuffered(Buf& buf, Arg v) { buf.m##_name = v;} \
+ static PX_FORCE_INLINE Arg getCore(const Core& core) { return Arg(core.get##_name());} \
+ static PX_FORCE_INLINE void setCore(Core& core, Arg v) { core.set##_name(v);} \
};
-#define SCB_REGULAR_ATTRIBUTE_ALIGNED(_val, _type, _name, _alignment) \
-enum { BF_##_name = 1<<(_val) }; \
-PX_ALIGN(_alignment, _type) m##_name; \
-template<PxU32 Dummy> struct Fns<1<<(_val),Dummy> \
-{ \
- typedef typename ArgType<_type>::Type Arg; \
- enum { flag = 1<<(_val) }; \
- static PX_FORCE_INLINE Arg getBuffered(const Buf& buf) { return buf.m##_name;} \
- static PX_FORCE_INLINE void setBuffered(Buf& buf, Arg v) { buf.m##_name = v;} \
- static PX_FORCE_INLINE Arg getCore(const Core& core) { return core.get##_name();} \
- static PX_FORCE_INLINE void setCore(Core& core, Arg v) { core.set##_name(v);} \
+#define SCB_REGULAR_ATTRIBUTE_ALIGNED(_val, _type, _name, _alignment) \
+enum { BF_##_name = 1<<(_val) }; \
+PX_ALIGN(_alignment, _type) m##_name; \
+template<PxU32 Dummy> struct Fns<1<<(_val),Dummy> \
+{ \
+ typedef typename ArgType<_type>::Type Arg; \
+ enum { flag = 1<<(_val) }; \
+ static PX_FORCE_INLINE Arg getBuffered(const Buf& buf) { return buf.m##_name;} \
+ static PX_FORCE_INLINE void setBuffered(Buf& buf, Arg v) { buf.m##_name = v;} \
+ static PX_FORCE_INLINE Arg getCore(const Core& core) { return core.get##_name();} \
+ static PX_FORCE_INLINE void setCore(Core& core, Arg v) { core.set##_name(v);} \
};
-
-
namespace physx
{
-
namespace Scb
{
class Scene;
@@ -107,7 +103,7 @@ struct BufferedAccess
template<typename Fns>
static PX_FORCE_INLINE void write(BaseClass& base, Core& core, typename Fns::Arg v)
{
- if (!base.isBuffering())
+ if(!base.isBuffering())
{
Fns::setCore(core, v);
#if PX_SUPPORT_PVD
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbMetaData.cpp b/PhysX_3.4/Source/PhysX/src/buffering/ScbMetaData.cpp
index fea9a5f3..8e0895ac 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbMetaData.cpp
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbMetaData.cpp
@@ -40,7 +40,6 @@
using namespace physx;
-
///////////////////////////////////////////////////////////////////////////////
void Scb::Base::getBinaryMetaData(PxOutputStream& stream)
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbParticleSystem.cpp b/PhysX_3.4/Source/PhysX/src/buffering/ScbParticleSystem.cpp
index 078f3a24..4b430183 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbParticleSystem.cpp
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbParticleSystem.cpp
@@ -67,11 +67,11 @@ void Scb::ParticleSystem::ForceUpdates::destroy()
//----------------------------------------------------------------------------//
-Scb::ParticleSystem::ParticleSystem(const PxActorType::Enum& actorType, PxU32 maxParticles, bool perParticleRestOffset)
-: mParticleSystem(actorType, maxParticles, perParticleRestOffset)
-, mReadParticleFluidData(NULL)
+Scb::ParticleSystem::ParticleSystem(const PxActorType::Enum& actorType, PxU32 maxParticles, bool perParticleRestOffset) :
+ mParticleSystem (actorType, maxParticles, perParticleRestOffset),
+ mReadParticleFluidData (NULL)
{
- setScbType(ScbType::PARTICLE_SYSTEM);
+ setScbType(ScbType::ePARTICLE_SYSTEM);
}
//----------------------------------------------------------------------------//
@@ -279,8 +279,8 @@ void Scb::ParticleSystem::syncState()
{
LOCK_PARTICLE_USER_BUFFERS("PxScene::fetchResults()")
- PxU32 flags = getBufferFlags();
- if (flags) // Optimization to avoid all the if-statements below if possible
+ const PxU32 flags = getBufferFlags();
+ if(flags) // Optimization to avoid all the if-statements below if possible
{
const Buf& buffer = *getParticleSystemBuffer();
@@ -294,7 +294,7 @@ void Scb::ParticleSystem::syncState()
flush<Buf::BF_DynamicFriction>(buffer);
flush<Buf::BF_StaticFriction>(buffer);
- if (flags & Buf::BF_ResetFiltering)
+ if(flags & Buf::BF_ResetFiltering)
mParticleSystem.resetFiltering();
flush<Buf::BF_SimulationFilterData>(buffer);
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbParticleSystem.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbParticleSystem.h
index a0d720d1..ff9683cf 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbParticleSystem.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbParticleSystem.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_PARTICLE_SYSTEM
#define PX_PHYSICS_SCB_PARTICLE_SYSTEM
@@ -44,12 +43,10 @@
namespace physx
{
-
struct PxCudaReadWriteParticleBuffers;
namespace Scb
{
-
struct ParticleSystemBuffer : public Scb::ActorBuffer
{
template <PxU32 I, PxU32 Dummy> struct Fns {}; // TODO : make the base class traits visible
@@ -72,10 +69,8 @@ struct ParticleSystemBuffer : public Scb::ActorBuffer
SCB_REGULAR_ATTRIBUTE(BF_Base+12, PxParticleBaseFlags, Flags)
enum { BF_ResetFiltering = 1<<(BF_Base+13) };
-
};
-
class DebugIndexPool;
class ParticleSystem : public Scb::Actor
@@ -92,8 +87,8 @@ class ParticleSystem : public Scb::Actor
struct UserBufferLock
{
- UserBufferLock(NpParticleFluidReadData* db, const char* callerName) : dataBuffer(db) { if (dataBuffer) { dataBuffer->lock(callerName); } }
- ~UserBufferLock() { if (dataBuffer) { dataBuffer->unlock(); } }
+ UserBufferLock(NpParticleFluidReadData* db, const char* callerName) : dataBuffer(db) { if(dataBuffer) { dataBuffer->lock(callerName); } }
+ ~UserBufferLock() { if(dataBuffer) { dataBuffer->unlock(); } }
NpParticleFluidReadData* dataBuffer;
private:
@@ -111,7 +106,7 @@ class ParticleSystem : public Scb::Actor
PX_INLINE void add(PxU32 index, const PxVec3& value)
{
hasUpdates = true;
- if (!map->test(index))
+ if(!map->test(index))
{
map->set(index);
values[index] = value;
@@ -128,7 +123,7 @@ class ParticleSystem : public Scb::Actor
PX_INLINE void clear()
{
- if (!hasUpdates)
+ if(!hasUpdates)
return;
PX_ASSERT(map);
@@ -136,9 +131,9 @@ class ParticleSystem : public Scb::Actor
hasUpdates = false;
}
- Cm::BitMap* map; // can we make this an instance?
- PxVec3* values;
- bool hasUpdates;
+ Cm::BitMap* map; // can we make this an instance?
+ PxVec3* values;
+ bool hasUpdates;
};
public:
@@ -212,7 +207,6 @@ public:
PX_INLINE PxParticleReadDataFlags getParticleReadDataFlags() const;
PX_INLINE void setParticleReadDataFlags(PxParticleReadDataFlags);
-
PX_INLINE PxU32 getParticleCount() const;
PX_INLINE const Cm::BitMap& getParticleMap() const;
@@ -255,13 +249,9 @@ public:
PX_UNUSED(ps);
return static_cast<ParticleSystem&>(Actor::fromSc(a));
-
}
- static size_t getScOffset()
- {
- return reinterpret_cast<size_t>(&reinterpret_cast<ParticleSystem*>(0)->mParticleSystem);
- }
+ static size_t getScOffset() { return reinterpret_cast<size_t>(&reinterpret_cast<ParticleSystem*>(0)->mParticleSystem); }
#if PX_SUPPORT_GPU_PHYSX
PX_INLINE void enableDeviceExclusiveModeGpu();
@@ -292,10 +282,9 @@ private:
PX_INLINE PxParticleBase* ParticleSystem::getPxParticleSystem()
{
- return getScParticleSystem().getPxParticleBase();
+ return mParticleSystem.getPxParticleBase();
}
-
PX_INLINE void ParticleSystem::removeFromScene()
{
PX_ASSERT(!isBuffering() || getControlState()==ControlState::eREMOVE_PENDING);
@@ -304,172 +293,158 @@ PX_INLINE void ParticleSystem::removeFromScene()
mForceUpdatesVel.destroy();
}
-
PX_INLINE PxParticleReadData* ParticleSystem::lockParticleReadData(PxDataAccessFlags flags)
{
// Don't use the macro here since releasing the lock should not be done automatically but by the user
- if (isBuffering())
+ if(isBuffering())
{
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "Particle data read not allowed while simulation is running.");
return NULL;
}
- if (!mReadParticleFluidData)
- {
+ if(!mReadParticleFluidData)
mReadParticleFluidData = PX_NEW(NpParticleFluidReadData)();
- }
mReadParticleFluidData->lock("PxParticleBase::lockParticleReadData()");
mReadParticleFluidData->setDataAccessFlags(flags);
- getScParticleSystem().getParticleReadData(*mReadParticleFluidData);
+ mParticleSystem.getParticleReadData(*mReadParticleFluidData);
return mReadParticleFluidData;
}
-
-
-
PX_INLINE void ParticleSystem::resetFiltering()
{
- if (!isBuffering())
+ if(!isBuffering())
{
- getScParticleSystem().resetFiltering();
+ mParticleSystem.resetFiltering();
UPDATE_PVD_PROPERTIES_OBJECT()
}
else
- {
markUpdated(Buf::BF_ResetFiltering);
- }
}
-
-
PX_INLINE PxParticleReadDataFlags ParticleSystem::getParticleReadDataFlags() const
{
- return getScParticleSystem().getParticleReadDataFlags();
+ return mParticleSystem.getParticleReadDataFlags();
}
PX_INLINE void ParticleSystem::setParticleReadDataFlags(PxParticleReadDataFlags flags)
{
- if (!isBuffering())
+ if(!isBuffering())
{
- getScParticleSystem().setParticleReadDataFlags(flags);
+ mParticleSystem.setParticleReadDataFlags(flags);
UPDATE_PVD_PROPERTIES_OBJECT()
}
}
PX_INLINE PxU32 ParticleSystem::getParticleCount() const
{
- return getScParticleSystem().getParticleCount();
+ return mParticleSystem.getParticleCount();
}
PX_INLINE const Cm::BitMap& ParticleSystem::getParticleMap() const
{
- return getScParticleSystem().getParticleMap();
+ return mParticleSystem.getParticleMap();
}
PX_INLINE PxU32 ParticleSystem::getMaxParticles() const
{
- return getScParticleSystem().getMaxParticles();
+ return mParticleSystem.getMaxParticles();
}
-
PX_INLINE PxReal ParticleSystem::getMaxMotionDistance() const
{
- return getScParticleSystem().getMaxMotionDistance();
+ return mParticleSystem.getMaxMotionDistance();
}
PX_INLINE void ParticleSystem::setMaxMotionDistance(PxReal distance)
{
- if (!isBuffering())
+ if(!isBuffering())
{
- getScParticleSystem().setMaxMotionDistance(distance);
+ mParticleSystem.setMaxMotionDistance(distance);
UPDATE_PVD_PROPERTIES_OBJECT()
}
}
PX_INLINE PxReal ParticleSystem::getRestOffset() const
{
- return getScParticleSystem().getRestOffset();
+ return mParticleSystem.getRestOffset();
}
-
PX_INLINE void ParticleSystem::setRestOffset(PxReal restOffset)
{
- if (!isBuffering())
+ if(!isBuffering())
{
- getScParticleSystem().setRestOffset(restOffset);
+ mParticleSystem.setRestOffset(restOffset);
UPDATE_PVD_PROPERTIES_OBJECT()
}
}
PX_INLINE PxReal ParticleSystem::getContactOffset() const
{
- return getScParticleSystem().getContactOffset();
+ return mParticleSystem.getContactOffset();
}
PX_INLINE void ParticleSystem::setContactOffset(PxReal contactOffset)
{
- if (!isBuffering())
+ if(!isBuffering())
{
- getScParticleSystem().setContactOffset(contactOffset);
+ mParticleSystem.setContactOffset(contactOffset);
UPDATE_PVD_PROPERTIES_OBJECT()
}
}
PX_INLINE PxReal ParticleSystem::getRestParticleDistance() const
{
- return getScParticleSystem().getRestParticleDistance();
+ return mParticleSystem.getRestParticleDistance();
}
PX_INLINE void ParticleSystem::setRestParticleDistance(PxReal restParticleDistance)
{
- if (!isBuffering())
+ if(!isBuffering())
{
- getScParticleSystem().setRestParticleDistance(restParticleDistance);
+ mParticleSystem.setRestParticleDistance(restParticleDistance);
UPDATE_PVD_PROPERTIES_OBJECT()
}
}
-
PX_INLINE PxReal ParticleSystem::getGridSize() const
{
- return getScParticleSystem().getGridSize();
+ return mParticleSystem.getGridSize();
}
PX_INLINE void ParticleSystem::setGridSize(PxReal gridSize)
{
- if (!isBuffering())
+ if(!isBuffering())
{
- getScParticleSystem().setGridSize(gridSize);
+ mParticleSystem.setGridSize(gridSize);
UPDATE_PVD_PROPERTIES_OBJECT()
}
}
PX_INLINE PxBounds3 ParticleSystem::getWorldBounds() const
{
- if (isBuffering())
+ if(isBuffering())
{
Ps::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__,
"PxActor::getWorldBounds(): Can't access particle world bounds during simulation without enabling bulk buffering.");
return PxBounds3();
}
- return getScParticleSystem().getWorldBounds();
+ return mParticleSystem.getWorldBounds();
}
#if PX_SUPPORT_GPU_PHYSX
PX_INLINE void ParticleSystem::enableDeviceExclusiveModeGpu()
{
- getScParticleSystem().enableDeviceExclusiveModeGpu();
+ mParticleSystem.enableDeviceExclusiveModeGpu();
}
PX_INLINE PxParticleDeviceExclusiveAccess* ParticleSystem::getDeviceExclusiveAccessGpu() const
{
- if (getFlags() & PxParticleBaseFlag::eGPU)
- {
- return getScParticleSystem().getDeviceExclusiveAccessGpu();
- }
+ if(getFlags() & PxParticleBaseFlag::eGPU)
+ return mParticleSystem.getDeviceExclusiveAccessGpu();
+
return NULL;
}
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbRigidObject.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbRigidObject.h
index e1ea7a43..49d65bd6 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbRigidObject.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbRigidObject.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_RIGID_OBJECT
#define PX_PHYSICS_SCB_RIGID_OBJECT
@@ -44,7 +43,6 @@ namespace physx
namespace Scb
{
-
struct RemovedShape
{
RemovedShape() : mShape(NULL), mWakeTouching(0) {}
@@ -64,7 +62,6 @@ struct RemovedShape
PxU8 mWakeTouching;
};
-
struct RigidObjectBuffer : public ActorBuffer //once RigidObject has its own buffered elements, derive from that instead
{
RigidObjectBuffer(): mResetFilterShape(0), mResetFilterShapeCount(0) {}
@@ -106,8 +103,8 @@ class RigidObject : public Scb::Actor
public:
// PX_SERIALIZATION
- RigidObject() {}
- RigidObject(const PxEMPTY) : Scb::Actor(PxEmpty) {}
+ RigidObject() {}
+ RigidObject(const PxEMPTY) : Scb::Actor(PxEmpty) {}
static void getBinaryMetaData(PxOutputStream& stream);
//~PX_SERIALIZATION
@@ -148,7 +145,7 @@ public:
#if PX_SUPPORT_PVD
scene->getScenePvdClient().releasePvdInstance(&shape, pxActor);
#endif
- if (!isSimDisabledInternally())
+ if(!isSimDisabledInternally())
{
rc.removeShapeFromScene(shape.getScShape(), (rs.mWakeTouching != 0));
@@ -166,9 +163,9 @@ public:
PX_INLINE void syncState()
{
- PxU32 bufferFlags = getBufferFlags();
+ const PxU32 bufferFlags = getBufferFlags();
- if (bufferFlags & Buf::BF_ResetFiltering)
+ if(bufferFlags & Buf::BF_ResetFiltering)
{
PX_ASSERT(getControlState() != ControlState::eREMOVE_PENDING); // removing the actor should have cleared BF_ResetFiltering
@@ -176,12 +173,12 @@ public:
Sc::RigidCore& scCore = getScRigidCore();
RigidObjectBuffer* b = getBuffer();
Scb::Shape* const* shapes = (b->mResetFilterShapeCount == 1) ? &b->mResetFilterShape : scene->getShapeBuffer(b->mResetFilterShapesIdx);
- for(PxU32 i=0; i < b->mResetFilterShapeCount; i++)
+ for(PxU32 i=0; i<b->mResetFilterShapeCount; i++)
{
Sc::ShapeCore& scShape = shapes[i]->getScShape();
// do not process the call if the shape will not be a broadphase shape any longer
- if (shapes[i]->getFlags() & (PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eTRIGGER_SHAPE))
+ if(shapes[i]->getFlags() & (PxShapeFlag::eSIMULATION_SHAPE | PxShapeFlag::eTRIGGER_SHAPE))
scCore.onShapeChange(scShape, Sc::ShapeChangeNotifyFlag::eRESET_FILTERING, PxShapeFlags());
}
}
@@ -199,11 +196,11 @@ public:
// it can happen that a shape gets attached while the sim is running but then the actor is removed from the scene,
// so we need to distinguish those two cases
- if (cs != ControlState::eREMOVE_PENDING)
+ if(cs != ControlState::eREMOVE_PENDING)
{
shape.setControlStateIfExclusive(getScbScene(), Scb::ControlState::eIN_SCENE);
- if (!(getActorFlags() & PxActorFlag::eDISABLE_SIMULATION)) // important to use the buffered flags since we want the new state.
+ if(!(getActorFlags() & PxActorFlag::eDISABLE_SIMULATION)) // important to use the buffered flags since we want the new state.
{
getScRigidCore().addShapeToScene(shape.getScShape());
NpShapeIncRefCount(shape);
@@ -223,7 +220,11 @@ public:
Actor::syncState();
}
- PX_FORCE_INLINE void scheduleForWakeTouching() { PX_ASSERT(getScbScene() && getScbScene()->isPhysicsBuffering()); setBufferFlag(RigidObjectBuffer::BF_WakeTouching); }
+ PX_FORCE_INLINE void scheduleForWakeTouching()
+ {
+ PX_ASSERT(getScbScene() && getScbScene()->isPhysicsBuffering());
+ setBufferFlag(RigidObjectBuffer::BF_WakeTouching);
+ }
//---------------------------------------------------------------------------------
// Miscellaneous
@@ -232,15 +233,6 @@ public:
PX_INLINE const Sc::RigidCore& getScRigidCore() const { return static_cast<const Sc::RigidCore&>(getActorCore()); } // Only use if you know what you're doing!
PX_INLINE Sc::RigidCore& getScRigidCore() { return static_cast<Sc::RigidCore&>(getActorCore()); } // Only use if you know what you're doing!
- PX_INLINE void setShapeStateIfExclusive(Scb::Shape& shape, ControlState::Enum cs, Scb::Scene& scene)
- {
- if(shape.isExclusive())
- {
- shape.setScbScene(&scene);
- shape.setControlState(cs);
- }
- }
-
PX_INLINE void onShapeAttach(Scb::Shape& shape)
{
// there are two things to do here: add the shape to the sim (if unbuffered) or set it up for
@@ -254,19 +246,19 @@ public:
Scene* scbScene = getScbScene();
if(!scbScene->isPhysicsBuffering())
{
- if (!(getActorFlags() & PxActorFlag::eDISABLE_SIMULATION))
+ if(!(getActorFlags() & PxActorFlag::eDISABLE_SIMULATION))
{
NpShapeIncRefCount(shape);
getScRigidCore().addShapeToScene(shape.getScShape());
}
#if PX_SUPPORT_PVD
- getScbScene()->getScenePvdClient().createPvdInstance(&shape, *getScRigidCore().getPxActor());
+ scbScene->getScenePvdClient().createPvdInstance(&shape, *getScRigidCore().getPxActor());
#endif
shape.setControlStateIfExclusive(scbScene, ControlState::eIN_SCENE);
return;
}
- else if (cs == ControlState::eINSERT_PENDING)
+ else if(cs == ControlState::eINSERT_PENDING)
{
shape.setControlStateIfExclusive(scbScene, ControlState::eINSERT_PENDING);
return;
@@ -280,7 +272,6 @@ public:
shape.setControlStateIfExclusive(scbScene, ControlState::eINSERT_PENDING);
}
-
PX_INLINE void onShapeDetach(Scb::Shape& shape, bool wakeOnLostTouch, bool toBeReleased)
{
// see comments in onShapeAttach
@@ -294,7 +285,7 @@ public:
#if PX_SUPPORT_PVD
scbScene->getScenePvdClient().releasePvdInstance(&shape, *getScRigidCore().getPxActor());
#endif
- if (!(getActorFlags() & PxActorFlag::eDISABLE_SIMULATION))
+ if(!(getActorFlags() & PxActorFlag::eDISABLE_SIMULATION))
{
getScRigidCore().removeShapeFromScene(shape.getScShape(), wakeOnLostTouch);
NpShapeDecRefCount(shape);
@@ -303,7 +294,7 @@ public:
shape.setControlStateIfExclusive(NULL, ControlState::eNOT_IN_SCENE);
return;
}
- else if (cs == ControlState::eINSERT_PENDING)
+ else if(cs == ControlState::eINSERT_PENDING)
{
shape.setControlStateIfExclusive(NULL, ControlState::eNOT_IN_SCENE);
return;
@@ -312,12 +303,12 @@ public:
RigidObjectBuffer* b = getBuffer();
// remove from the resetFiltering list
- PxU32 bufferFlags = getBufferFlags();
- if (bufferFlags & Buf::BF_ResetFiltering)
+ const PxU32 bufferFlags = getBufferFlags();
+ if(bufferFlags & Buf::BF_ResetFiltering)
{
- if (b->mResetFilterShapeCount == 1)
+ if(b->mResetFilterShapeCount == 1)
{
- if (b->mResetFilterShape == &shape)
+ if(b->mResetFilterShape == &shape)
{
b->mResetFilterShapeCount = 0;
b->mResetFilterShape = 0;
@@ -331,7 +322,7 @@ public:
PxU32 lastIdx = b->mResetFilterShapeCount;
for(PxU32 k=0; k < b->mResetFilterShapeCount; k++) // need to iterate over whole list, same shape can be in there multiple times
{
- if (shapes[idx] != &shape)
+ if(shapes[idx] != &shape)
idx++;
else
{
@@ -340,12 +331,12 @@ public:
}
}
b->mResetFilterShapeCount = idx;
- if (idx == 0)
+ if(idx == 0)
{
b->mResetFilterShape = 0;
resetBufferFlag(Buf::BF_ResetFiltering);
}
- else if (idx == 1)
+ else if(idx == 1)
b->mResetFilterShape = shapes[0];
}
}
@@ -354,7 +345,7 @@ public:
shape.setControlStateIfExclusive(scbScene, ControlState::eIN_SCENE);
else
{
- if (!isSimDisabledInternally())
+ if(!isSimDisabledInternally())
{
b->mRemovedShapes.pushBack(RemovedShape(&shape, PxU8(wakeOnLostTouch ? 1 : 0)));
}
@@ -362,7 +353,7 @@ public:
{
PX_ASSERT(scbScene);
PX_ASSERT(scbScene->isPhysicsBuffering());
- if (toBeReleased)
+ if(toBeReleased)
{
shape.checkUpdateOnRemove<false>(scbScene);
#if PX_SUPPORT_PVD
@@ -399,7 +390,6 @@ private:
PX_FORCE_INLINE void copyResetFilterShapes(Scb::Shape** shapePtrs, Scb::Shape*const* oldShapes, PxU32 oldShapeCount, Scb::Shape*const* newShapes, PxU32 newShapeCount);
};
-
PX_INLINE void RigidObject::resetFiltering(Scb::Shape*const* shapes, PxU32 shapeCount)
{
PX_ASSERT(!(getActorFlags() & PxActorFlag::eDISABLE_SIMULATION));
@@ -413,9 +403,9 @@ PX_INLINE void RigidObject::resetFiltering(Scb::Shape*const* shapes, PxU32 shape
{
RigidObjectBuffer* b = getBuffer();
- if (b->mResetFilterShapeCount == 0)
+ if(b->mResetFilterShapeCount == 0)
{
- if (shapeCount == 1)
+ if(shapeCount == 1)
{
b->mResetFilterShape = shapes[0];
b->mResetFilterShapeCount = 1;
@@ -425,7 +415,7 @@ PX_INLINE void RigidObject::resetFiltering(Scb::Shape*const* shapes, PxU32 shape
{
PxU32 bufferIdx;
Scb::Shape** shapePtrs = getScbScene()->allocShapeBuffer(shapeCount, bufferIdx);
- if (shapePtrs)
+ if(shapePtrs)
{
for(PxU32 i=0; i < shapeCount; i++)
shapePtrs[i] = shapes[i];
@@ -440,9 +430,9 @@ PX_INLINE void RigidObject::resetFiltering(Scb::Shape*const* shapes, PxU32 shape
PxU32 newCount = b->mResetFilterShapeCount + shapeCount;
PxU32 bufferIdx;
Scb::Shape** shapePtrs = getScbScene()->allocShapeBuffer(newCount, bufferIdx);
- if (shapePtrs)
+ if(shapePtrs)
{
- if (b->mResetFilterShapeCount == 1)
+ if(b->mResetFilterShapeCount == 1)
copyResetFilterShapes(shapePtrs, &b->mResetFilterShape, 1, shapes, shapeCount);
else
copyResetFilterShapes(shapePtrs, getScbScene()->getShapeBuffer(b->mResetFilterShapesIdx), b->mResetFilterShapeCount, shapes, shapeCount);
@@ -454,12 +444,11 @@ PX_INLINE void RigidObject::resetFiltering(Scb::Shape*const* shapes, PxU32 shape
}
}
-
PX_INLINE bool RigidObject::isAddedShape(Scb::Shape& shape)
{
PX_ASSERT(isBuffered(Buf::BF_Shapes));
- if (shape.isExclusive())
+ if(shape.isExclusive())
{
return (shape.getControlState() == Scb::ControlState::eINSERT_PENDING);
}
@@ -472,48 +461,41 @@ PX_INLINE bool RigidObject::isAddedShape(Scb::Shape& shape)
const PxU32 addedShapeCount = buf->mAddedShapes.size();
for(PxU32 k=0; k < addedShapeCount; k++)
{
- if (&shape == buf->mAddedShapes[k])
- {
+ if(&shape == buf->mAddedShapes[k])
return true;
- }
}
-
return false;
}
}
-
PX_FORCE_INLINE void RigidObject::switchToNoSim(bool isDynamic)
{
Scb::Scene* scene = getScbScene();
- if (scene && (!scene->isPhysicsBuffering()))
+ if(scene && (!scene->isPhysicsBuffering()))
scene->switchRigidToNoSim(*this, isDynamic);
}
-
PX_FORCE_INLINE void RigidObject::switchFromNoSim(bool isDynamic)
{
Scb::Scene* scene = getScbScene();
- if (scene && (!scene->isPhysicsBuffering()))
+ if(scene && (!scene->isPhysicsBuffering()))
scene->switchRigidFromNoSim(*this, isDynamic);
}
-
PX_FORCE_INLINE void RigidObject::syncNoSimSwitch(const Buf& buf, Sc::RigidCore& rc, bool isDynamic)
{
- PxActorFlags oldFlags = rc.getActorFlags();
- bool oldNoSim = oldFlags.isSet(PxActorFlag::eDISABLE_SIMULATION);
- bool newNoSim = buf.mActorFlags.isSet(PxActorFlag::eDISABLE_SIMULATION);
+ const PxActorFlags oldFlags = rc.getActorFlags();
+ const bool oldNoSim = oldFlags.isSet(PxActorFlag::eDISABLE_SIMULATION);
+ const bool newNoSim = buf.mActorFlags.isSet(PxActorFlag::eDISABLE_SIMULATION);
- if (oldNoSim && (!newNoSim))
+ if(oldNoSim && (!newNoSim))
getScbScene()->switchRigidFromNoSim(*this, isDynamic);
- else if ((!oldNoSim) && newNoSim)
+ else if((!oldNoSim) && newNoSim)
getScbScene()->switchRigidToNoSim(*this, isDynamic);
}
-
PX_FORCE_INLINE void RigidObject::copyResetFilterShapes(Scb::Shape** shapePtrs, Scb::Shape*const* oldShapes, PxU32 oldShapeCount, Scb::Shape*const* newShapes, PxU32 newShapeCount)
{
for(PxU32 i=0; i < oldShapeCount; i++)
@@ -522,7 +504,6 @@ PX_FORCE_INLINE void RigidObject::copyResetFilterShapes(Scb::Shape** shapePtrs,
shapePtrs[i+oldShapeCount] = newShapes[i];
}
-
} // namespace Scb
}
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbRigidStatic.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbRigidStatic.h
index d783f203..41263184 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbRigidStatic.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbRigidStatic.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_RIGID_STATIC
#define PX_PHYSICS_SCB_RIGID_STATIC
@@ -38,10 +37,8 @@
namespace physx
{
-
namespace Scb
{
-
#if PX_VC
#pragma warning(push)
#pragma warning( disable : 4324 ) // Padding was added at the end of a structure because of a __declspec(align) value.
@@ -62,7 +59,6 @@ struct RigidStaticBuffer : public RigidObjectBuffer
#pragma warning(pop)
#endif
-
class RigidStatic : public Scb::RigidObject
{
//= ATTENTION! =====================================================================================
@@ -93,10 +89,7 @@ public:
//---------------------------------------------------------------------------------
PX_INLINE void syncState();
- static size_t getScOffset()
- {
- return reinterpret_cast<size_t>(&reinterpret_cast<RigidStatic*>(0)->mStatic);
- }
+ static size_t getScOffset() { return reinterpret_cast<size_t>(&reinterpret_cast<RigidStatic*>(0)->mStatic); }
PX_FORCE_INLINE Sc::StaticCore& getScStatic() { return mStatic; }
@@ -116,33 +109,30 @@ private:
template<PxU32 f> PX_FORCE_INLINE typename Buf::Fns<f,0>::Arg read() const { return Access::read<Buf::Fns<f,0> >(*this, mStatic); }
template<PxU32 f> PX_FORCE_INLINE void write(typename Buf::Fns<f,0>::Arg v) { Access::write<Buf::Fns<f,0> >(*this, mStatic, v); }
- template<PxU32 f> PX_FORCE_INLINE void flush(const Buf& buf) { Access::flush<Buf::Fns<f,0> >(*this, mStatic, buf); }
-
+ template<PxU32 f> PX_FORCE_INLINE void flush(const Buf& buf) { Access::flush<Buf::Fns<f,0> >(*this, mStatic, buf); }
};
RigidStatic::RigidStatic(const PxTransform& actor2World) :
mStatic(actor2World)
{
- setScbType(ScbType::RIGID_STATIC);
+ setScbType(ScbType::eRIGID_STATIC);
}
-
//--------------------------------------------------------------
//
// Data synchronization
//
//--------------------------------------------------------------
-
PX_INLINE void RigidStatic::syncState()
{
- PxU32 bufferFlags = getBufferFlags();
+ const PxU32 bufferFlags = getBufferFlags();
- if (bufferFlags & Buf::BF_ActorFlags)
+ if(bufferFlags & Buf::BF_ActorFlags)
syncNoSimSwitch(*getRigidActorBuffer(), mStatic, false);
RigidObject::syncState();
- if (bufferFlags & Buf::BF_Actor2World)
+ if(bufferFlags & Buf::BF_Actor2World)
flush<Buf::BF_Actor2World>(*getRigidActorBuffer());
postSyncState();
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbScene.cpp b/PhysX_3.4/Source/PhysX/src/buffering/ScbScene.cpp
index 0d0ac638..04b355a4 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbScene.cpp
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbScene.cpp
@@ -880,63 +880,61 @@ void Scb::Scene::preSimulateUpdateAppThread(PxReal timeStep)
void Scb::Scene::syncState()
{
//process client creation -- must be done before BF_CLIENT_BEHAVIOR_FLAGS processing in the below block:
- while (mBufferedData.numClientsCreated)
+ while(mBufferedData.mNumClientsCreated)
{
mScene.createClient();
- mBufferedData.numClientsCreated--;
+ mBufferedData.mNumClientsCreated--;
}
- if (mBufferFlags)
+ if(mBufferFlags)
{
- if (isBuffered(BF_GRAVITY))
- mScene.setGravity(mBufferedData.gravity);
+ if(isBuffered(BF_GRAVITY))
+ mScene.setGravity(mBufferedData.mGravity);
if(isBuffered(BF_BOUNCETHRESHOLDVELOCITY))
- mScene.setBounceThresholdVelocity(mBufferedData.bounceThresholdVelocity);
+ mScene.setBounceThresholdVelocity(mBufferedData.mBounceThresholdVelocity);
- if (isBuffered(BF_FLAGS))
- mScene.setPublicFlags(mBufferedData.flags);
+ if(isBuffered(BF_FLAGS))
+ mScene.setPublicFlags(mBufferedData.mFlags);
- if (isBuffered(BF_DOMINANCE_PAIRS))
+ if(isBuffered(BF_DOMINANCE_PAIRS))
mBufferedData.syncDominancePairs(mScene);
- if (isBuffered(BF_SOLVER_BATCH_SIZE))
- mScene.setSolverBatchSize(mBufferedData.solverBatchSize);
+ if(isBuffered(BF_SOLVER_BATCH_SIZE))
+ mScene.setSolverBatchSize(mBufferedData.mSolverBatchSize);
- if (isBuffered(BF_CLIENT_BEHAVIOR_FLAGS))
+ if(isBuffered(BF_CLIENT_BEHAVIOR_FLAGS))
{
- for (PxU32 i = 0; i < mBufferedData.clientBehaviorFlags.size(); i++)
+ for(PxU32 i=0; i<mBufferedData.mClientBehaviorFlags.size(); i++)
{
- if (mBufferedData.clientBehaviorFlags[i] != PxClientBehaviorFlag_eNOT_BUFFERED) //not PxClientBehaviorFlag_eNOT_BUFFERED means it was written.
+ if(mBufferedData.mClientBehaviorFlags[i] != PxClientBehaviorFlag_eNOT_BUFFERED) //not PxClientBehaviorFlag_eNOT_BUFFERED means it was written.
{
- mScene.setClientBehaviorFlags(PxClientID(i), mBufferedData.clientBehaviorFlags[i]);
- mBufferedData.clientBehaviorFlags[i] = PxClientBehaviorFlag_eNOT_BUFFERED;
+ mScene.setClientBehaviorFlags(PxClientID(i), mBufferedData.mClientBehaviorFlags[i]);
+ mBufferedData.mClientBehaviorFlags[i] = PxClientBehaviorFlag_eNOT_BUFFERED;
}
-
}
}
- if (isBuffered(BF_VISUALIZATION))
+ if(isBuffered(BF_VISUALIZATION))
{
- for(PxU32 i=0; i < PxVisualizationParameter::eNUM_VALUES; i++)
+ for(PxU32 i=0; i<PxVisualizationParameter::eNUM_VALUES; i++)
{
- if (mBufferedData.visualizationParamChanged[i])
- {
- mScene.setVisualizationParameter(static_cast<PxVisualizationParameter::Enum>(i), mBufferedData.visualizationParam[i]);
- }
+ if(mBufferedData.mVisualizationParamChanged[i])
+ mScene.setVisualizationParameter(PxVisualizationParameter::Enum(i), mBufferedData.mVisualizationParam[i]);
}
+
+ mBufferedData.clearVisualizationParams();
}
+ if(isBuffered(BF_CULLING_BOX))
+ mScene.setVisualizationCullingBox(mBufferedData.mVisualizationCullingBox);
+
#if PX_SUPPORT_PVD
if(mScenePvdClient.checkPvdDebugFlag())
mScenePvdClient.updatePvdProperties();
#endif
+ mBufferFlags = 0;
}
-
-
- mBufferFlags = 0;
- mBufferedData.clearDominanceBuffer();
- mBufferedData.clearVisualizationParams();
}
template<typename T>
@@ -1015,11 +1013,11 @@ void Scb::Scene::syncWriteThroughProperties()
mStream.unlock();
}
-void Scb::Scene::syncEntireScene(PxU32* error)
+void Scb::Scene::syncEntireScene()
{
PX_PROFILE_ZONE("Sim.syncState", getContextId());
- if (error)
- *error = mScene.getErrorState();
+
+ setPhysicsBuffering(false); // Clear the buffering flag to allow buffered writes to execute immediately. Once collision detection is running, buffering is automatically forced on
mStream.lock();
syncState();
@@ -1201,9 +1199,9 @@ void Scb::Scene::processRemoves(ObjectTracker& tracker)
bool wakeOnLostTouch = false;
if (wakeOnLostTouchCheck)
{
- PX_ASSERT( (v->getScbType() == ScbType::BODY) ||
- (v->getScbType() == ScbType::BODY_FROM_ARTICULATION_LINK) ||
- (v->getScbType() == ScbType::RIGID_STATIC) );
+ PX_ASSERT( (v->getScbType() == ScbType::eBODY) ||
+ (v->getScbType() == ScbType::eBODY_FROM_ARTICULATION_LINK) ||
+ (v->getScbType() == ScbType::eRIGID_STATIC) );
wakeOnLostTouch = (v->Base::isBuffered(RigidObjectBuffer::BF_WakeTouching) != 0); // important to use Scb::Base::isBuffered() because Scb::Body, for example, has a shadowed implementation of this method
}
@@ -1275,31 +1273,29 @@ void Scb::Scene::processPendingRemove()
#endif
}
}
-
-
}
void Scb::Scene::scheduleForUpdate(Scb::Base& object)
{
switch(object.getScbType())
{
- case ScbType::SHAPE_EXCLUSIVE:
- case ScbType::SHAPE_SHARED: { mShapeManager.scheduleForUpdate(object); }break;
- case ScbType::BODY: { mBodyManager.scheduleForUpdate(object); }break;
- case ScbType::BODY_FROM_ARTICULATION_LINK: { mBodyManager.scheduleForUpdate(object); }break;
- case ScbType::RIGID_STATIC: { mRigidStaticManager.scheduleForUpdate(object); }break;
- case ScbType::CONSTRAINT: { mConstraintManager.scheduleForUpdate(object); }break;
+ case ScbType::eSHAPE_EXCLUSIVE:
+ case ScbType::eSHAPE_SHARED: { mShapeManager.scheduleForUpdate(object); }break;
+ case ScbType::eBODY: { mBodyManager.scheduleForUpdate(object); }break;
+ case ScbType::eBODY_FROM_ARTICULATION_LINK: { mBodyManager.scheduleForUpdate(object); }break;
+ case ScbType::eRIGID_STATIC: { mRigidStaticManager.scheduleForUpdate(object); }break;
+ case ScbType::eCONSTRAINT: { mConstraintManager.scheduleForUpdate(object); }break;
#if PX_USE_PARTICLE_SYSTEM_API
- case ScbType::PARTICLE_SYSTEM: { mParticleSystemManager.scheduleForUpdate(object); }break;
+ case ScbType::ePARTICLE_SYSTEM: { mParticleSystemManager.scheduleForUpdate(object); }break;
#endif
- case ScbType::ARTICULATION: { mArticulationManager.scheduleForUpdate(object); }break;
- case ScbType::ARTICULATION_JOINT: { mArticulationJointManager.scheduleForUpdate(object); }break;
- case ScbType::AGGREGATE: { mAggregateManager.scheduleForUpdate(object); }break;
+ case ScbType::eARTICULATION: { mArticulationManager.scheduleForUpdate(object); }break;
+ case ScbType::eARTICULATION_JOINT: { mArticulationJointManager.scheduleForUpdate(object); }break;
+ case ScbType::eAGGREGATE: { mAggregateManager.scheduleForUpdate(object); }break;
#if PX_USE_CLOTH_API
- case ScbType::CLOTH: { mClothManager.scheduleForUpdate(object); }break;
+ case ScbType::eCLOTH: { mClothManager.scheduleForUpdate(object); }break;
#endif
- case ScbType::UNDEFINED:
- case ScbType::TYPE_COUNT:
+ case ScbType::eUNDEFINED:
+ case ScbType::eTYPE_COUNT:
PX_ALWAYS_ASSERT_MESSAGE( "scheduleForUpdate: missing type!");
break;
}
@@ -1310,24 +1306,24 @@ PxU8* Scb::Scene::getStream(ScbType::Enum type)
PxU8* memory = NULL;
switch(type)
{
- case ScbType::SHAPE_EXCLUSIVE:
- case ScbType::SHAPE_SHARED: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::ShapeBuffer))); new (memory) Scb::ShapeBuffer; }break;
- case ScbType::BODY: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::BodyBuffer))); new (memory) Scb::BodyBuffer; }break;
- case ScbType::BODY_FROM_ARTICULATION_LINK: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::BodyBuffer))); new (memory) Scb::BodyBuffer; }break;
- case ScbType::RIGID_STATIC: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::RigidStaticBuffer))); new (memory) Scb::RigidStaticBuffer; }break;
- case ScbType::CONSTRAINT: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::ConstraintBuffer))); new (memory) Scb::ConstraintBuffer; }break;
+ case ScbType::eSHAPE_EXCLUSIVE:
+ case ScbType::eSHAPE_SHARED: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::ShapeBuffer))); new (memory) Scb::ShapeBuffer; }break;
+ case ScbType::eBODY: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::BodyBuffer))); new (memory) Scb::BodyBuffer; }break;
+ case ScbType::eBODY_FROM_ARTICULATION_LINK: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::BodyBuffer))); new (memory) Scb::BodyBuffer; }break;
+ case ScbType::eRIGID_STATIC: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::RigidStaticBuffer))); new (memory) Scb::RigidStaticBuffer; }break;
+ case ScbType::eCONSTRAINT: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::ConstraintBuffer))); new (memory) Scb::ConstraintBuffer; }break;
#if PX_USE_PARTICLE_SYSTEM_API
- case ScbType::PARTICLE_SYSTEM: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::ParticleSystemBuffer))); new (memory) Scb::ParticleSystemBuffer; }break;
+ case ScbType::ePARTICLE_SYSTEM: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::ParticleSystemBuffer))); new (memory) Scb::ParticleSystemBuffer; }break;
#endif
- case ScbType::ARTICULATION: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::ArticulationBuffer))); new (memory) Scb::ArticulationBuffer; }break;
- case ScbType::ARTICULATION_JOINT: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::ArticulationJointBuffer))); new (memory) Scb::ArticulationJointBuffer; }break;
- case ScbType::AGGREGATE: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::AggregateBuffer))); new (memory) Scb::AggregateBuffer; }break;
+ case ScbType::eARTICULATION: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::ArticulationBuffer))); new (memory) Scb::ArticulationBuffer; }break;
+ case ScbType::eARTICULATION_JOINT: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::ArticulationJointBuffer))); new (memory) Scb::ArticulationJointBuffer; }break;
+ case ScbType::eAGGREGATE: { memory = reinterpret_cast<PxU8*>(mStream.allocateNotThreadSafe(sizeof(Scb::AggregateBuffer))); new (memory) Scb::AggregateBuffer; }break;
#if PX_USE_CLOTH_API
- case ScbType::CLOTH:
+ case ScbType::eCLOTH:
#endif
- case ScbType::UNDEFINED:
- case ScbType::TYPE_COUNT:
+ case ScbType::eUNDEFINED:
+ case ScbType::eTYPE_COUNT:
PX_ALWAYS_ASSERT_MESSAGE("getStream: missing type!");
return NULL;
}
@@ -1389,7 +1385,7 @@ bool Scb::Scene::removeBroadPhaseRegion(PxU32 handle)
template <bool TSimRunning, bool TAdd, bool TIsDynamic, bool TIsNonSimObject, class T>
PX_FORCE_INLINE static void addOrRemoveRigidObject(Sc::Scene& s, T& rigidObject, bool wakeOnLostTouch, PxBounds3* uninflatedBounds)
{
- PX_ASSERT(TIsDynamic || (rigidObject.getScbType() == ScbType::RIGID_STATIC));
+ PX_ASSERT(TIsDynamic || (rigidObject.getScbType() == ScbType::eRIGID_STATIC));
if (TSimRunning && TIsNonSimObject && TAdd)
PX_ASSERT(rigidObject.getActorFlags() & PxActorFlag::eDISABLE_SIMULATION);
if (TSimRunning && TIsNonSimObject&& !TAdd)
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbScene.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbScene.h
index 3a3ae43d..eca47c0f 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbScene.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbScene.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_SCENE
#define PX_PHYSICS_SCB_SCENE
@@ -162,8 +161,7 @@ namespace Scb
BF_SOLVER_BATCH_SIZE = (1 << 4),
BF_CLIENT_BEHAVIOR_FLAGS = (1 << 5),
BF_VISUALIZATION = (1 << 6),
- BF_SCENE_PARAMS = (1 << 7)
-
+ BF_CULLING_BOX = (1 << 7)
};
public:
@@ -186,8 +184,8 @@ namespace Scb
PX_INLINE void setFlags(PxSceneFlags flags);
PX_INLINE PxSceneFlags getFlags() const;
- PX_INLINE void setFrictionType(PxFrictionType::Enum);
- PX_INLINE PxFrictionType::Enum getFrictionType() const;
+ PX_INLINE void setFrictionType(PxFrictionType::Enum type) { mScene.setFrictionType(type); }
+ PX_INLINE PxFrictionType::Enum getFrictionType() const { return mScene.getFrictionType(); }
void addActor(Scb::RigidStatic&, bool noSim, PxBounds3* uninflatedBounds);
void removeActor(Scb::RigidStatic&, bool wakeOnLostTouch, bool noSim);
@@ -222,8 +220,9 @@ namespace Scb
void removeMaterial(const Sc::MaterialCore& mat);
void updateLowLevelMaterial(NpMaterial** masterMaterials);
// These methods are only to be called at fetchResults!
- PX_INLINE PxU32 getNumActiveBodies() const;
- PX_INLINE Sc::BodyCore* const* getActiveBodiesArray() const;
+ PX_INLINE PxU32 getNumActiveBodies() const { return mScene.getNumActiveBodies(); }
+ PX_INLINE Sc::BodyCore* const* getActiveBodiesArray() const { return mScene.getActiveBodiesArray(); }
+
PX_INLINE PxSimulationEventCallback* getSimulationEventCallback(PxClientID client) const;
PX_INLINE void setSimulationEventCallback(PxSimulationEventCallback* callback, PxClientID client);
PX_INLINE PxContactModifyCallback* getContactModifyCallback() const;
@@ -255,10 +254,11 @@ namespace Scb
PX_INLINE void setSolverBatchSize(PxU32 solverBatchSize);
PX_INLINE PxU32 getSolverBatchSize() const;
- PX_INLINE void simulate(PxReal timeStep, PxBaseTask* continuation);
- PX_INLINE void collide(PxReal timeStep, PxBaseTask* continuation);
- PX_INLINE void advance(PxReal timeStep, PxBaseTask* continuation);
- PX_INLINE void endSimulation();
+ PX_INLINE void simulate(PxReal timeStep, PxBaseTask* continuation) { mScene.simulate(timeStep, continuation); }
+ PX_INLINE void collide(PxReal timeStep, PxBaseTask* continuation) { mScene.collide(timeStep, continuation); }
+ PX_INLINE void advance(PxReal timeStep, PxBaseTask* continuation) { mScene.advance(timeStep, continuation); }
+ PX_INLINE void endSimulation() { mScene.endSimulation(); }
+
PX_INLINE void flush(bool sendPendingReports);
PX_INLINE void fireBrokenConstraintCallbacks() { mScene.fireBrokenConstraintCallbacks(); }
PX_INLINE void fireTriggerCallbacks() { mScene.fireTriggerCallbacks(); }
@@ -267,12 +267,11 @@ namespace Scb
getQueuedContactPairHeaders() { return mScene.getQueuedContactPairHeaders(); }
PX_FORCE_INLINE void postCallbacksPreSync() { mScene.postCallbacksPreSync(); } //cleanup tasks after the pre-sync callbacks have fired
-
PX_INLINE void fireCallBacksPostSync() { mScene.fireCallbacksPostSync(); } //callbacks that are fired on the core side, after the buffers get synced
PX_INLINE void postReportsCleanup();
- PX_INLINE const PxSceneLimits& getLimits() const;
- PX_INLINE void setLimits(const PxSceneLimits& limits);
+ PX_INLINE const PxSceneLimits& getLimits() const { return mScene.getLimits(); }
+ PX_INLINE void setLimits(const PxSceneLimits& limits) { mScene.setLimits(limits); }
PX_INLINE void getStats(PxSimulationStatistics& stats) const;
@@ -308,7 +307,7 @@ namespace Scb
//---------------------------------------------------------------------------------
public:
void syncWriteThroughProperties();
- void syncEntireScene(PxU32* error);
+ void syncEntireScene();
void processPendingRemove();
PX_FORCE_INLINE PxU16* allocShapeMaterialBuffer(PxU32 count, PxU32& startIdx) { return allocArrayBuffer(mShapeMaterialBuffer, count, startIdx); }
@@ -330,7 +329,7 @@ namespace Scb
private:
void syncState();
PX_FORCE_INLINE Ps::IntBool isBuffered(BufferFlag f) const { return Ps::IntBool(mBufferFlags& f); }
- PX_FORCE_INLINE void markUpdated(BufferFlag f) { mBufferFlags |= f; }
+ PX_FORCE_INLINE void markUpdated(BufferFlag f) { mBufferFlags |= f; }
//---------------------------------------------------------------------------------
// Miscellaneous
@@ -360,7 +359,6 @@ namespace Scb
PX_FORCE_INLINE Vd::ScbScenePvdClient& getScenePvdClient() { return mScenePvdClient; }
PX_FORCE_INLINE const Vd::ScbScenePvdClient& getScenePvdClient() const { return mScenePvdClient; }
#endif
-
PX_FORCE_INLINE PxU64 getContextId() const { return mScene.getContextId(); }
private:
@@ -374,10 +372,10 @@ namespace Scb
template<bool TIsDynamic, class T>
PX_FORCE_INLINE void addActorT(T& actor, ObjectTracker& tracker, bool noSim, PxBounds3* uninflatedBounds);
- template<typename T> void add(T& v, ObjectTracker &tracker, PxBounds3* uninflatedBounds);
- template<typename T> void remove(T& v, ObjectTracker &tracker, bool wakeOnLostTouch = false);
- template<bool TIsDynamic, typename T> void addRigidNoSim(T& v, ObjectTracker &tracker);
- template<bool TIsDynamic, typename T> void removeRigidNoSim(T& v, ObjectTracker &tracker);
+ template<typename T> void add(T& v, ObjectTracker& tracker, PxBounds3* uninflatedBounds);
+ template<typename T> void remove(T& v, ObjectTracker& tracker, bool wakeOnLostTouch = false);
+ template<bool TIsDynamic, typename T> void addRigidNoSim(T& v, ObjectTracker& tracker);
+ template<bool TIsDynamic, typename T> void removeRigidNoSim(T& v, ObjectTracker& tracker);
template<typename T, typename S> void processSimUpdates(S*const * scObjects, PxU32 nbObjects);
template<typename T> void processUserUpdates(ObjectTracker& tracker);
template<typename T, bool syncOnRemove, bool wakeOnLostTouchCheck> void processRemoves(ObjectTracker& tracker);
@@ -436,7 +434,6 @@ namespace Scb
} // namespace Scb
-
template<typename T>
T* Scb::Scene::allocArrayBuffer(Ps::Array<T>& buffer, PxU32 count, PxU32& startIdx)
{
@@ -448,62 +445,51 @@ T* Scb::Scene::allocArrayBuffer(Ps::Array<T>& buffer, PxU32 count, PxU32& startI
PX_INLINE void Scb::Scene::setGravity(const PxVec3& gravity)
{
- if (!isPhysicsBuffering())
+ if(!isPhysicsBuffering())
{
mScene.setGravity(gravity);
updatePvdProperties();
}
else
{
- mBufferedData.gravity = gravity;
+ mBufferedData.mGravity = gravity;
markUpdated(BF_GRAVITY);
}
}
PX_INLINE PxVec3 Scb::Scene::getGravity() const
{
- if (isBuffered(BF_GRAVITY))
- return mBufferedData.gravity;
+ if(isBuffered(BF_GRAVITY))
+ return mBufferedData.mGravity;
else
return mScene.getGravity();
}
void Scb::Scene::setBounceThresholdVelocity(const PxReal t)
{
- if (!isPhysicsBuffering())
+ if(!isPhysicsBuffering())
{
mScene.setBounceThresholdVelocity(t);
updatePvdProperties();
}
else
{
- mBufferedData.bounceThresholdVelocity = t;
+ mBufferedData.mBounceThresholdVelocity = t;
markUpdated(BF_BOUNCETHRESHOLDVELOCITY);
}
}
PxReal Scb::Scene::getBounceThresholdVelocity() const
{
- if (isBuffered(BF_BOUNCETHRESHOLDVELOCITY))
- return mBufferedData.bounceThresholdVelocity;
+ if(isBuffered(BF_BOUNCETHRESHOLDVELOCITY))
+ return mBufferedData.mBounceThresholdVelocity;
else
return mScene.getBounceThresholdVelocity();
}
-PX_INLINE void Scb::Scene::setFrictionType(PxFrictionType::Enum frictionType)
-{
- mScene.setFrictionType(frictionType);
-}
-
-PX_INLINE PxFrictionType::Enum Scb::Scene::getFrictionType() const
-{
- return mScene.getFrictionType();
-}
-
-
PX_INLINE void Scb::Scene::setFlags(PxSceneFlags flags)
{
- if (!isPhysicsBuffering())
+ if(!isPhysicsBuffering())
{
mScene.setPublicFlags(flags);
const bool pcm = (flags & PxSceneFlag::eENABLE_PCM);
@@ -514,16 +500,15 @@ PX_INLINE void Scb::Scene::setFlags(PxSceneFlags flags)
}
else
{
- mBufferedData.flags = flags;
+ mBufferedData.mFlags = flags;
markUpdated(BF_FLAGS);
}
}
-
PX_INLINE PxSceneFlags Scb::Scene::getFlags() const
{
- if (isBuffered(BF_FLAGS))
- return mBufferedData.flags;
+ if(isBuffered(BF_FLAGS))
+ return mBufferedData.mFlags;
else
return mScene.getPublicFlags();
}
@@ -605,52 +590,26 @@ PX_INLINE void Scb::Scene::setFilterShaderData(const void* data, PxU32 dataSize)
Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxScene::setFilterShaderData() not allowed while simulation is running. Call will be ignored.");
}
-
PX_INLINE const void* Scb::Scene::getFilterShaderData() const
{
return mScene.getFilterShaderDataFast();
}
-
PX_INLINE PxU32 Scb::Scene::getFilterShaderDataSize() const
{
return mScene.getFilterShaderDataSizeFast();
}
-
-PX_INLINE PxSimulationFilterShader Scb::Scene::getFilterShader() const
+PX_INLINE PxSimulationFilterShader Scb::Scene::getFilterShader() const
{
return mScene.getFilterShaderFast();
}
-
PX_INLINE PxSimulationFilterCallback* Scb::Scene::getFilterCallback() const
{
return mScene.getFilterCallbackFast();
}
-
-PX_INLINE void Scb::Scene::simulate(PxReal timeStep, PxBaseTask* continuation)
-{
- mScene.simulate(timeStep, continuation);
-}
-
-PX_INLINE void Scb::Scene::advance(PxReal timeStep, PxBaseTask* continuation)
-{
- mScene.advance(timeStep, continuation);
-}
-
-PX_INLINE void Scb::Scene::collide(PxReal timeStep, PxBaseTask* continuation)
-{
- mScene.collide(timeStep, continuation);
-}
-
-PX_INLINE void Scb::Scene::endSimulation()
-{
- mScene.endSimulation();
-}
-
-
PX_INLINE void Scb::Scene::flush(bool sendPendingReports)
{
PX_ASSERT(!isPhysicsBuffering());
@@ -664,27 +623,15 @@ PX_INLINE void Scb::Scene::flush(bool sendPendingReports)
mScene.flush(sendPendingReports);
}
-
PX_INLINE void Scb::Scene::postReportsCleanup()
{
PX_ASSERT(!isPhysicsBuffering());
mScene.postReportsCleanup();
}
-
-PX_INLINE const PxSceneLimits& Scb::Scene::getLimits() const
-{
- return mScene.getLimits();
-}
-
-PX_INLINE void Scb::Scene::setLimits(const PxSceneLimits& limits)
-{
- mScene.setLimits(limits);
-}
-
PX_INLINE void Scb::Scene::setDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2, const PxDominanceGroupPair& dominance)
{
- if (!isPhysicsBuffering())
+ if(!isPhysicsBuffering())
{
mScene.setDominanceGroupPair(group1, group2, dominance);
updatePvdProperties();
@@ -696,43 +643,40 @@ PX_INLINE void Scb::Scene::setDominanceGroupPair(PxDominanceGroup group1, PxDomi
}
}
-
PX_INLINE PxDominanceGroupPair Scb::Scene::getDominanceGroupPair(PxDominanceGroup group1, PxDominanceGroup group2) const
{
- if (isBuffered(BF_DOMINANCE_PAIRS))
+ if(isBuffered(BF_DOMINANCE_PAIRS))
{
PxDominanceGroupPair dominance(0, 0);
- if (mBufferedData.getDominancePair(group1, group2, dominance))
+ if(mBufferedData.getDominancePair(group1, group2, dominance))
return dominance;
}
return mScene.getDominanceGroupPair(group1, group2);
}
-
PX_INLINE void Scb::Scene::setSolverBatchSize(PxU32 solverBatchSize)
{
- if (!isPhysicsBuffering())
+ if(!isPhysicsBuffering())
{
mScene.setSolverBatchSize(solverBatchSize);
updatePvdProperties();
}
else
{
- mBufferedData.solverBatchSize = solverBatchSize;
+ mBufferedData.mSolverBatchSize = solverBatchSize;
markUpdated(BF_SOLVER_BATCH_SIZE);
}
}
PX_INLINE PxU32 Scb::Scene::getSolverBatchSize() const
{
- if (isBuffered(BF_SOLVER_BATCH_SIZE))
- return mBufferedData.solverBatchSize;
+ if(isBuffered(BF_SOLVER_BATCH_SIZE))
+ return mBufferedData.mSolverBatchSize;
else
return mScene.getSolverBatchSize();
}
-
PX_INLINE void Scb::Scene::getStats(PxSimulationStatistics& stats) const
{
PX_ASSERT(!isPhysicsBuffering());
@@ -740,7 +684,6 @@ PX_INLINE void Scb::Scene::getStats(PxSimulationStatistics& stats) const
mScene.getStats(stats);
}
-
PX_DEPRECATED PX_INLINE void Scb::Scene::buildActiveTransforms()
{
PX_ASSERT(!isPhysicsBuffering());
@@ -748,13 +691,10 @@ PX_DEPRECATED PX_INLINE void Scb::Scene::buildActiveTransforms()
mScene.buildActiveTransforms();
}
-
PX_DEPRECATED PX_INLINE PxActiveTransform* Scb::Scene::getActiveTransforms(PxU32& nbTransformsOut, PxClientID client)
{
- if (!isPhysicsBuffering())
- {
+ if(!isPhysicsBuffering())
return mScene.getActiveTransforms(nbTransformsOut, client);
- }
else
{
Ps::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PxScene::getActiveTransforms() not allowed while simulation is running. Call will be ignored.");
@@ -772,10 +712,8 @@ PX_INLINE void Scb::Scene::buildActiveActors()
PX_INLINE PxActor** Scb::Scene::getActiveActors(PxU32& nbActorsOut, PxClientID client)
{
- if (!isPhysicsBuffering())
- {
+ if(!isPhysicsBuffering())
return mScene.getActiveActors(nbActorsOut, client);
- }
else
{
Ps::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PxScene::getActiveActors() not allowed while simulation is running. Call will be ignored.");
@@ -784,44 +722,43 @@ PX_INLINE PxActor** Scb::Scene::getActiveActors(PxU32& nbActorsOut, PxClientID c
}
}
-
PX_INLINE PxClientID Scb::Scene::createClient()
{
- mBufferedData.clientBehaviorFlags.pushBack(PxClientBehaviorFlag_eNOT_BUFFERED); //PxClientBehaviorFlag_eNOT_BUFFERED means its not storing anything. Do this either way to make sure this buffer is big enough for behavior bit set/gets later.
+ mBufferedData.mClientBehaviorFlags.pushBack(PxClientBehaviorFlag_eNOT_BUFFERED); //PxClientBehaviorFlag_eNOT_BUFFERED means its not storing anything. Do this either way to make sure this buffer is big enough for behavior bit set/gets later.
- if (!isPhysicsBuffering())
+ if(!isPhysicsBuffering())
{
PxClientID i = mScene.createClient();
- PX_ASSERT(mBufferedData.clientBehaviorFlags.size()-1 == i);
+ PX_ASSERT(mBufferedData.mClientBehaviorFlags.size()-1 == i);
return i;
}
else
{
- mBufferedData.numClientsCreated++;
- return PxClientID(mBufferedData.clientBehaviorFlags.size()-1); //mScene.createClient();
+ mBufferedData.mNumClientsCreated++;
+ return PxClientID(mBufferedData.mClientBehaviorFlags.size()-1); //mScene.createClient();
}
}
PX_INLINE void Scb::Scene::setClientBehaviorFlags(PxClientID client, PxClientBehaviorFlags clientBehaviorFlags)
{
- if (!isPhysicsBuffering())
+ if(!isPhysicsBuffering())
{
mScene.setClientBehaviorFlags(client, clientBehaviorFlags);
updatePvdProperties();
}
else
{
- PX_ASSERT(mBufferedData.clientBehaviorFlags.size() > client);
- mBufferedData.clientBehaviorFlags[client] = clientBehaviorFlags;
+ PX_ASSERT(mBufferedData.mClientBehaviorFlags.size() > client);
+ mBufferedData.mClientBehaviorFlags[client] = clientBehaviorFlags;
markUpdated(BF_CLIENT_BEHAVIOR_FLAGS);
}
}
PX_INLINE PxClientBehaviorFlags Scb::Scene::getClientBehaviorFlags(PxClientID client) const
{
- PX_ASSERT(mBufferedData.clientBehaviorFlags.size() > client);
- if (isBuffered(BF_CLIENT_BEHAVIOR_FLAGS) && (mBufferedData.clientBehaviorFlags[client] != PxClientBehaviorFlag_eNOT_BUFFERED))
- return mBufferedData.clientBehaviorFlags[client];
+ PX_ASSERT(mBufferedData.mClientBehaviorFlags.size() > client);
+ if(isBuffered(BF_CLIENT_BEHAVIOR_FLAGS) && (mBufferedData.mClientBehaviorFlags[client] != PxClientBehaviorFlag_eNOT_BUFFERED))
+ return mBufferedData.mClientBehaviorFlags[client];
else
return mScene.getClientBehaviorFlags(client);
}
@@ -830,14 +767,10 @@ PX_INLINE PxClientBehaviorFlags Scb::Scene::getClientBehaviorFlags(PxClientID cl
PX_INLINE void Scb::Scene::setClothInterCollisionDistance(PxF32 distance)
{
- if (!isPhysicsBuffering())
- {
+ if(!isPhysicsBuffering())
mScene.setClothInterCollisionDistance(distance);
- }
else
- {
Ps::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PxScene::setClothInterCollisionDistance() not allowed while simulation is running. Call will be ignored.");
- }
}
PX_INLINE PxF32 Scb::Scene::getClothInterCollisionDistance() const
@@ -847,14 +780,10 @@ PX_INLINE PxF32 Scb::Scene::getClothInterCollisionDistance() const
PX_INLINE void Scb::Scene::setClothInterCollisionStiffness(PxF32 stiffness)
{
- if (!isPhysicsBuffering())
- {
+ if(!isPhysicsBuffering())
mScene.setClothInterCollisionStiffness(stiffness);
- }
else
- {
Ps::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PxScene::setClothInterCollisionStiffness() not allowed while simulation is running. Call will be ignored.");
- }
}
PX_INLINE PxF32 Scb::Scene::getClothInterCollisionStiffness() const
@@ -864,14 +793,10 @@ PX_INLINE PxF32 Scb::Scene::getClothInterCollisionStiffness() const
PX_INLINE void Scb::Scene::setClothInterCollisionNbIterations(PxU32 nbIterations)
{
- if (!isPhysicsBuffering())
- {
+ if(!isPhysicsBuffering())
mScene.setClothInterCollisionNbIterations(nbIterations);
- }
else
- {
Ps::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, "PxScene::setClothInterCollisionNbIterations() not allowed while simulation is running. Call will be ignored.");
- }
}
PX_INLINE PxU32 Scb::Scene::getClothInterCollisionNbIterations() const
@@ -881,16 +806,15 @@ PX_INLINE PxU32 Scb::Scene::getClothInterCollisionNbIterations() const
#endif
-
PX_INLINE void Scb::Scene::setVisualizationParameter(PxVisualizationParameter::Enum param, PxReal value)
{
- if (!isPhysicsBuffering())
+ if(!isPhysicsBuffering())
mScene.setVisualizationParameter(param, value);
else
{
PX_ASSERT(param < PxVisualizationParameter::eNUM_VALUES);
- mBufferedData.visualizationParamChanged[param] = 1;
- mBufferedData.visualizationParam[param] = value;
+ mBufferedData.mVisualizationParamChanged[param] = 1;
+ mBufferedData.mVisualizationParam[param] = value;
markUpdated(BF_VISUALIZATION);
}
}
@@ -899,41 +823,31 @@ PX_INLINE PxReal Scb::Scene::getVisualizationParameter(PxVisualizationParameter:
{
PX_ASSERT(param < PxVisualizationParameter::eNUM_VALUES);
- if (isBuffered(BF_VISUALIZATION) && mBufferedData.visualizationParamChanged[param])
- return mBufferedData.visualizationParam[param];
+ if(isBuffered(BF_VISUALIZATION) && mBufferedData.mVisualizationParamChanged[param])
+ return mBufferedData.mVisualizationParam[param];
else
return mScene.getVisualizationParameter(param);
}
PX_INLINE void Scb::Scene::setVisualizationCullingBox(const PxBounds3& box)
{
- if (!isPhysicsBuffering())
+ if(!isPhysicsBuffering())
mScene.setVisualizationCullingBox(box);
else
{
- mBufferedData.visualizationCullingBoxChanged = 1;
- mBufferedData.visualizationCullingBox = box;
- markUpdated(BF_VISUALIZATION);
+ mBufferedData.mVisualizationCullingBox = box;
+ markUpdated(BF_CULLING_BOX);
}
}
PX_INLINE const PxBounds3& Scb::Scene::getVisualizationCullingBox() const
{
- if (isBuffered(BF_VISUALIZATION) && mBufferedData.visualizationCullingBoxChanged)
- return mBufferedData.visualizationCullingBox;
+ if(isBuffered(BF_CULLING_BOX))
+ return mBufferedData.mVisualizationCullingBox;
else
return mScene.getVisualizationCullingBox();
}
-PX_INLINE PxU32 Scb::Scene::getNumActiveBodies() const
-{
- return mScene.getNumActiveBodies();
-}
-PX_INLINE Sc::BodyCore* const* Scb::Scene::getActiveBodiesArray() const
-{
- return mScene.getActiveBodiesArray();
-}
-
}
#endif
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbSceneBuffer.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbSceneBuffer.h
index 61fea2af..b9b03a07 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbSceneBuffer.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbSceneBuffer.h
@@ -56,104 +56,98 @@ public:
PX_INLINE void clearVisualizationParams();
- PxReal visualizationParam[PxVisualizationParameter::eNUM_VALUES];
- PxU8 visualizationParamChanged[PxVisualizationParameter::eNUM_VALUES];
- PxBounds3 visualizationCullingBox;
- PxU8 visualizationCullingBoxChanged;
- PxU32 dominancePairFlag[sMaxNbDominanceGroups - 1];
- PxU32 dominancePairValues[sMaxNbDominanceGroups];
- PxVec3 gravity;
- PxReal bounceThresholdVelocity;
- PxSceneFlags flags;
- PxU32 solverBatchSize;
- PxU32 numClientsCreated;
- Ps::Array<PxClientBehaviorFlags> clientBehaviorFlags; //a value is buffered if it is not -1.
+ PxReal mVisualizationParam[PxVisualizationParameter::eNUM_VALUES];
+ PxU8 mVisualizationParamChanged[PxVisualizationParameter::eNUM_VALUES];
+ PxBounds3 mVisualizationCullingBox;
+private:
+ PxU32 mDominancePairFlag[sMaxNbDominanceGroups - 1];
+ PxU32 mDominancePairValues[sMaxNbDominanceGroups];
+public:
+ PxVec3 mGravity;
+ PxReal mBounceThresholdVelocity;
+ PxSceneFlags mFlags;
+ PxU32 mSolverBatchSize;
+ PxU32 mNumClientsCreated;
+ Ps::Array<PxClientBehaviorFlags> mClientBehaviorFlags; //a value is buffered if it is not -1.
};
-
-PX_INLINE SceneBuffer::SceneBuffer() : clientBehaviorFlags(PX_DEBUG_EXP("clientBehaviorFlags"))
+PX_INLINE SceneBuffer::SceneBuffer() :
+ mNumClientsCreated (0),
+ mClientBehaviorFlags(PX_DEBUG_EXP("clientBehaviorFlags"))
{
clearDominanceBuffer();
clearVisualizationParams();
- numClientsCreated = 0;
- clientBehaviorFlags.pushBack(PxClientBehaviorFlag_eNOT_BUFFERED); //need member for default client, PxClientBehaviorFlag_eNOT_BUFFERED means its not storing anything.
+ mClientBehaviorFlags.pushBack(PxClientBehaviorFlag_eNOT_BUFFERED); //need member for default client, PxClientBehaviorFlag_eNOT_BUFFERED means its not storing anything.
}
-
-PX_INLINE void SceneBuffer::clearDominanceBuffer()
+PX_FORCE_INLINE void SceneBuffer::clearDominanceBuffer()
{
- PxMemSet(&dominancePairFlag, 0, (sMaxNbDominanceGroups - 1) * sizeof(PxU32));
+ PxMemZero(&mDominancePairFlag, (sMaxNbDominanceGroups - 1) * sizeof(PxU32));
}
-
-PX_INLINE void SceneBuffer::clearVisualizationParams()
+PX_FORCE_INLINE void SceneBuffer::clearVisualizationParams()
{
- PxMemZero(visualizationParamChanged, PxVisualizationParameter::eNUM_VALUES * sizeof(PxU8));
+ PxMemZero(mVisualizationParamChanged, PxVisualizationParameter::eNUM_VALUES * sizeof(PxU8));
}
-
PX_INLINE void SceneBuffer::setDominancePair(PxU32 group1, PxU32 group2, const PxDominanceGroupPair& dominance)
{
PX_ASSERT(group1 != group2);
PX_ASSERT(group1 < sMaxNbDominanceGroups);
PX_ASSERT(group2 < sMaxNbDominanceGroups);
- if (group1 < group2)
- dominancePairFlag[group1] = dominancePairFlag[group1] | (1 << group2);
+ if(group1 < group2)
+ mDominancePairFlag[group1] |= (1 << group2);
else
- dominancePairFlag[group2] = dominancePairFlag[group2] | (1 << group1);
+ mDominancePairFlag[group2] |= (1 << group1);
- if (dominance.dominance0 != 0.0f)
- dominancePairValues[group1] = dominancePairValues[group1] | (1 << group2);
+ if(dominance.dominance0 != 0.0f)
+ mDominancePairValues[group1] |= (1 << group2);
else
- dominancePairValues[group1] = dominancePairValues[group1] & (~(1 << group2));
+ mDominancePairValues[group1] &= ~(1 << group2);
- if (dominance.dominance1 != 0.0f)
- dominancePairValues[group2] = dominancePairValues[group2] | (1 << group1);
+ if(dominance.dominance1 != 0.0f)
+ mDominancePairValues[group2] |= (1 << group1);
else
- dominancePairValues[group2] = dominancePairValues[group2] & (~(1 << group1));
+ mDominancePairValues[group2] &= ~(1 << group1);
}
-
PX_INLINE bool SceneBuffer::getDominancePair(PxU32 group1, PxU32 group2, PxDominanceGroupPair& dominance) const
{
PX_ASSERT(group1 != group2);
PX_ASSERT(group1 < sMaxNbDominanceGroups);
PX_ASSERT(group2 < sMaxNbDominanceGroups);
- PxU32 isBuffered = 0;
- if (group1 < group2)
- isBuffered = dominancePairFlag[group1] & (1 << group2);
+ PxU32 isBuffered;
+ if(group1 < group2)
+ isBuffered = mDominancePairFlag[group1] & (1 << group2);
else
- isBuffered = dominancePairFlag[group2] & (1 << group1);
+ isBuffered = mDominancePairFlag[group2] & (1 << group1);
- if (isBuffered)
- {
- dominance.dominance0 = PxU8((dominancePairValues[group1] & (1 << group2)) >> group2 );
- dominance.dominance1 = PxU8((dominancePairValues[group2] & (1 << group1)) >> group1 );
- return true;
- }
-
- return false;
-}
+ if(!isBuffered)
+ return false;
+ dominance.dominance0 = PxU8((mDominancePairValues[group1] & (1 << group2)) >> group2);
+ dominance.dominance1 = PxU8((mDominancePairValues[group2] & (1 << group1)) >> group1);
+ return true;
+}
PX_INLINE void SceneBuffer::syncDominancePairs(Sc::Scene& scene)
{
- for(PxU32 i=0; i < (sMaxNbDominanceGroups - 1); i++)
+ for(PxU32 i=0; i<(sMaxNbDominanceGroups - 1); i++)
{
- if (dominancePairFlag[i])
+ if(mDominancePairFlag[i])
{
- for(PxU32 j=(i+1); j < sMaxNbDominanceGroups; j++)
+ for(PxU32 j=(i+1); j<sMaxNbDominanceGroups; j++)
{
PxDominanceGroupPair dominance(0, 0);
- if (getDominancePair(i, j, dominance))
- {
+ if(getDominancePair(i, j, dominance))
scene.setDominanceGroupPair(PxDominanceGroup(i), PxDominanceGroup(j), dominance);
- }
}
}
}
+
+ clearDominanceBuffer();
}
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbScenePvdClient.cpp b/PhysX_3.4/Source/PhysX/src/buffering/ScbScenePvdClient.cpp
index 03161149..7a59c8aa 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbScenePvdClient.cpp
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbScenePvdClient.cpp
@@ -55,7 +55,6 @@ using namespace physx::Vd;
using namespace physx::pvdsdk;
using namespace Scb;
-
namespace
{
PX_FORCE_INLINE PxU64 getContextId(Scb::Scene& scene) { return scene.getContextId(); }
@@ -71,14 +70,12 @@ namespace
}
#if PX_USE_PARTICLE_SYSTEM_API
-
// Sc-to-Scb
PX_FORCE_INLINE static Scb::ParticleSystem* getScbParticleSystem(Sc::ParticleSystemCore* scParticleSystem)
{
const size_t offset = reinterpret_cast<size_t>(&(reinterpret_cast<Scb::ParticleSystem*>(0)->getScParticleSystem()));
return reinterpret_cast<Scb::ParticleSystem*>(reinterpret_cast<char*>(scParticleSystem) - offset);
}
-
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -87,34 +84,21 @@ namespace
{
const PxActorType::Enum type = scbActor->getActorCore().getActorCoreType();
if(type == PxActorType::eRIGID_DYNAMIC)
- {
return getNpRigidDynamic(static_cast<const Scb::Body*>(scbActor));
- }
else if(type == PxActorType::eRIGID_STATIC)
- {
return getNpRigidStatic(static_cast<const Scb::RigidStatic*>(scbActor));
- }
#if PX_USE_PARTICLE_SYSTEM_API
else if(type == PxActorType::ePARTICLE_SYSTEM)
- {
return getNpParticleSystem(static_cast<const Scb::ParticleSystem*>(scbActor));
- }
else if(type == PxActorType::ePARTICLE_FLUID)
- {
return getNpParticleFluid(static_cast<const Scb::ParticleSystem*>(scbActor));
- }
#endif
else if(type == PxActorType::eARTICULATION_LINK)
- {
return getNpArticulationLink(static_cast<const Scb::Body*>(scbActor));
- }
#if PX_USE_CLOTH_API
else if(type == PxActorType::eCLOTH)
- {
return getNpCloth(const_cast<Scb::Cloth*>(static_cast<const Scb::Cloth*>(scbActor)));
- }
#endif
-
return NULL;
}
@@ -132,7 +116,7 @@ namespace
template <typename TDataType>
void operator()(const TDataType& dtype)
{
- mBinding.createInstance(mStream, dtype, mScene, mPvd);
+ mBinding.createInstance(mStream, dtype, mScene, PxGetPhysics(), mPvd);
}
void operator()(const PxArticulationLink&)
{
@@ -312,8 +296,13 @@ namespace
} // namespace
-ScbScenePvdClient::ScbScenePvdClient(Scb::Scene& scene)
- : mPvd(NULL), mScbScene(scene), mPvdDataStream(NULL), mUserRender(NULL), mRenderClient(NULL), mIsConnected(false)
+ScbScenePvdClient::ScbScenePvdClient(Scb::Scene& scene) :
+ mPvd (NULL),
+ mScbScene (scene),
+ mPvdDataStream (NULL),
+ mUserRender (NULL),
+ mRenderClient (NULL),
+ mIsConnected (false)
{
}
@@ -353,27 +342,6 @@ void ScbScenePvdClient::drawText(const PvdDebugText& text)
mUserRender->drawText(text);
}
-PvdUserRenderer* ScbScenePvdClient::getUserRender()
-{
- return mUserRender;
-}
-
-
-PsPvd* ScbScenePvdClient::getPsPvd()
-{
- return mPvd;
-}
-
-void ScbScenePvdClient::setPsPvd(PsPvd* pvd)
-{
- mPvd = pvd;
-}
-
-physx::pvdsdk::PvdClient* ScbScenePvdClient::getClientInternal()
-{
- return this;
-}
-
void ScbScenePvdClient::setScenePvdFlag(PxPvdSceneFlag::Enum flag, bool value)
{
if(value)
@@ -382,21 +350,6 @@ void ScbScenePvdClient::setScenePvdFlag(PxPvdSceneFlag::Enum flag, bool value)
mFlags &= ~flag;
}
-void ScbScenePvdClient::setScenePvdFlags(PxPvdSceneFlags flags)
-{
- mFlags = flags;
-}
-
-PxPvdSceneFlags ScbScenePvdClient::getScenePvdFlags() const
-{
- return mFlags;
-}
-
-bool ScbScenePvdClient::isConnected() const
-{
- return mIsConnected;
-}
-
void ScbScenePvdClient::onPvdConnected()
{
if(mIsConnected || !mPvd)
@@ -404,12 +357,12 @@ void ScbScenePvdClient::onPvdConnected()
mIsConnected = true;
-
mPvdDataStream = PvdDataStream::create(mPvd);
mUserRender = PvdUserRenderer::create();
mRenderClient = PX_NEW(SceneRendererClient)(mUserRender, mPvd);
mUserRender->setClient(mRenderClient);
+
sendEntireScene();
}
@@ -427,20 +380,6 @@ void ScbScenePvdClient::onPvdDisconnected()
mPvdDataStream = NULL;
}
-void ScbScenePvdClient::flush()
-{
-}
-
-PvdDataStream* ScbScenePvdClient::getDataStream()
-{
- return mPvdDataStream;
-}
-
-PvdMetaDataBinding* ScbScenePvdClient::getMetaDataBinding()
-{
- return &mMetaDataBinding;
-}
-
void ScbScenePvdClient::updatePvdProperties()
{
mMetaDataBinding.sendAllProperties(*mPvdDataStream, *mScbScene.getPxScene());
@@ -465,15 +404,15 @@ void ScbScenePvdClient::sendEntireScene()
if(npScene->getFlagsFast() & PxSceneFlag::eREQUIRE_RW_LOCK) // getFlagsFast() will trigger a warning of lock check
npScene->lockRead(__FILE__, __LINE__);
+ PxPhysics& physics = PxGetPhysics();
{
PxScene* theScene = mScbScene.getPxScene();
mPvdDataStream->createInstance(theScene);
updatePvdProperties();
- PxPhysics* physics = &PxGetPhysics();
// Create parent/child relationship.
- mPvdDataStream->setPropertyValue(theScene, "Physics", reinterpret_cast<const void*>(physics));
- mPvdDataStream->pushBackObjectRef(physics, "Scenes", theScene);
+ mPvdDataStream->setPropertyValue(theScene, "Physics", reinterpret_cast<const void*>(&physics));
+ mPvdDataStream->pushBackObjectRef(&physics, "Scenes", theScene);
}
// materials:
@@ -485,7 +424,7 @@ void ScbScenePvdClient::sendEntireScene()
{
const PxMaterial* theMaterial = mat->getNxMaterial();
if(mPvd->registerObject(theMaterial))
- mMetaDataBinding.createInstance(*mPvdDataStream, *theMaterial, PxGetPhysics());
+ mMetaDataBinding.createInstance(*mPvdDataStream, *theMaterial, physics);
};
}
@@ -504,9 +443,9 @@ void ScbScenePvdClient::sendEntireScene()
{
PxActor* pxActor = actorArray[i];
if(pxActor->is<PxRigidStatic>())
- mMetaDataBinding.createInstance(*mPvdDataStream, *static_cast<PxRigidStatic*>(pxActor), *npScene, mPvd);
+ mMetaDataBinding.createInstance(*mPvdDataStream, *static_cast<PxRigidStatic*>(pxActor), *npScene, physics, mPvd);
else
- mMetaDataBinding.createInstance(*mPvdDataStream, *static_cast<PxRigidDynamic*>(pxActor), *npScene, mPvd);
+ mMetaDataBinding.createInstance(*mPvdDataStream, *static_cast<PxRigidDynamic*>(pxActor), *npScene, physics, mPvd);
}
}
// articulations & links
@@ -516,7 +455,7 @@ void ScbScenePvdClient::sendEntireScene()
articulations.resize(numArticulations);
npScene->getArticulations(articulations.begin(), articulations.size());
for(PxU32 i = 0; i < numArticulations; i++)
- mMetaDataBinding.createInstance(*mPvdDataStream, *articulations[i], *npScene, mPvd);
+ mMetaDataBinding.createInstance(*mPvdDataStream, *articulations[i], *npScene, physics, mPvd);
}
#if PX_USE_PARTICLE_SYSTEM_API
@@ -633,7 +572,7 @@ void ScbScenePvdClient::updateKinematicTarget(const Scb::Body* body, const PxTra
void ScbScenePvdClient::createPvdInstance(const Scb::RigidStatic* rigidStatic)
{
if(checkPvdDebugFlag())
- mMetaDataBinding.createInstance(*mPvdDataStream, *getNpRigidStatic(rigidStatic), *mScbScene.getPxScene(), mPvd);
+ mMetaDataBinding.createInstance(*mPvdDataStream, *getNpRigidStatic(rigidStatic), *mScbScene.getPxScene(), PxGetPhysics(), mPvd);
}
void ScbScenePvdClient::updatePvdProperties(const Scb::RigidStatic* rigidStatic)
@@ -674,7 +613,7 @@ void ScbScenePvdClient::releasePvdInstance(const Scb::Constraint* constraint)
void ScbScenePvdClient::createPvdInstance(const Scb::Articulation* articulation)
{
if(checkPvdDebugFlag())
- mMetaDataBinding.createInstance(*mPvdDataStream, *getNpArticulation(articulation), *mScbScene.getPxScene(), mPvd);
+ mMetaDataBinding.createInstance(*mPvdDataStream, *getNpArticulation(articulation), *mScbScene.getPxScene(), PxGetPhysics(), mPvd);
}
void ScbScenePvdClient::updatePvdProperties(const Scb::Articulation* articulation)
@@ -739,17 +678,18 @@ void ScbScenePvdClient::createPvdInstance(const Scb::Shape* shape, PxActor& owne
{
PX_PROFILE_ZONE("PVD.createPVDInstance", getContextId(mScbScene));
const PxShape* npShape = getNpShape(shape);
- mMetaDataBinding.createInstance(*mPvdDataStream, *npShape, static_cast<PxRigidActor&>(owner), mPvd);
+ mMetaDataBinding.createInstance(*mPvdDataStream, *npShape, static_cast<PxRigidActor&>(owner), PxGetPhysics(), mPvd);
}
}
static void addShapesToPvd(PxU32 nbShapes, void* const* shapes, const size_t offset, PxActor& pxActor, PsPvd* pvd, PvdDataStream& stream, PvdMetaDataBinding& binding)
{
+ PxPhysics& physics = PxGetPhysics();
for(PxU32 i=0;i<nbShapes;i++)
{
const Scb::Shape* shape = reinterpret_cast<Scb::Shape*>(reinterpret_cast<char*>(shapes[i]) + offset);
const PxShape* npShape = getNpShape(shape);
- binding.createInstance(stream, *npShape, static_cast<PxRigidActor&>(pxActor), pvd);
+ binding.createInstance(stream, *npShape, static_cast<PxRigidActor&>(pxActor), physics, pvd);
}
}
@@ -988,12 +928,13 @@ void ScbScenePvdClient::frameEnd()
if(mPvd->getInstrumentationFlags() & PxPvdInstrumentationFlag::eDEBUG)
{
+ PX_PROFILE_ZONE("PVD.sceneUpdate", getContextId(mScbScene));
+
PvdVisualizer* vizualizer = NULL;
- const bool visualizeJoints = getScenePvdFlags() & PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS;
+ const bool visualizeJoints = getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS;
if(visualizeJoints)
vizualizer = this;
- PX_PROFILE_ZONE("PVD.sceneUpdate", getContextId(mScbScene));
mMetaDataBinding.updateDynamicActorsAndArticulations(*mPvdDataStream, theScene, vizualizer);
}
@@ -1052,7 +993,7 @@ static inline const PxCloth* toPx(const Scb::Cloth* cloth)
void ScbScenePvdClient::createPvdInstance(const Scb::Cloth* cloth)
{
if(checkPvdDebugFlag())
- mMetaDataBinding.createInstance(*mPvdDataStream, *getNpCloth(cloth), *mScbScene.getPxScene(), mPvd);
+ mMetaDataBinding.createInstance(*mPvdDataStream, *getNpCloth(cloth), *mScbScene.getPxScene(), PxGetPhysics(), mPvd);
}
void ScbScenePvdClient::sendSimpleProperties(const Scb::Cloth* cloth)
@@ -1128,46 +1069,44 @@ void ScbScenePvdClient::updateJoints()
{
if(checkPvdDebugFlag())
{
- const bool visualizeJoints = getScenePvdFlags() & PxPvdSceneFlag::eTRANSMIT_CONTACTS;
+ PX_PROFILE_ZONE("PVD.updateJoints", getContextId(mScbScene));
- // joints
- {
- PX_PROFILE_ZONE("PVD.updateJoints", getContextId(mScbScene));
- Sc::ConstraintCore*const * constraints = mScbScene.getScScene().getConstraints();
- PxU32 nbConstraints = mScbScene.getScScene().getNbConstraints();
- PxI64 constraintCount = 0;
+ const bool visualizeJoints = getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS;
- for(PxU32 i = 0; i < nbConstraints; i++)
+ Sc::ConstraintCore*const * constraints = mScbScene.getScScene().getConstraints();
+ const PxU32 nbConstraints = mScbScene.getScScene().getNbConstraints();
+ PxI64 constraintCount = 0;
+
+ for(PxU32 i=0; i<nbConstraints; i++)
+ {
+ Sc::ConstraintCore* constraint = constraints[i];
+ PxPvdUpdateType::Enum updateType = getNpConstraint(constraint)->isDirty()
+ ? PxPvdUpdateType::UPDATE_ALL_PROPERTIES
+ : PxPvdUpdateType::UPDATE_SIM_PROPERTIES;
+ updateConstraint(*constraint, updateType);
+ PxConstraintConnector* conn = constraint->getPxConnector();
+ // visualization is updated here
{
- Sc::ConstraintCore* constraint = constraints[i];
- PxPvdUpdateType::Enum updateType = getNpConstraint(constraint)->isDirty()
- ? PxPvdUpdateType::UPDATE_ALL_PROPERTIES
- : PxPvdUpdateType::UPDATE_SIM_PROPERTIES;
- updateConstraint(*constraint, updateType);
- PxConstraintConnector* conn = constraint->getPxConnector();
- // visualization is updated here
+ PxU32 typeId = 0;
+ void* joint = NULL;
+ if(conn)
+ joint = conn->getExternalReference(typeId);
+ // visualize:
+ Sc::ConstraintSim* sim = constraint->getSim();
+ if(visualizeJoints && sim && sim->getConstantsLL() && joint && constraint->getVisualize())
{
- PxU32 typeId = 0;
- void* joint = NULL;
- if(conn)
- joint = conn->getExternalReference(typeId);
- // visualize:
- Sc::ConstraintSim* sim = constraint->getSim();
- if(visualizeJoints && sim && sim->getConstantsLL() && joint && constraint->getVisualize())
- {
- Sc::BodySim* b0 = sim->getBody(0);
- Sc::BodySim* b1 = sim->getBody(1);
- PxTransform t0 = b0 ? b0->getBody2World() : PxTransform(PxIdentity);
- PxTransform t1 = b1 ? b1->getBody2World() : PxTransform(PxIdentity);
- PvdConstraintVisualizer viz(joint, *mUserRender);
- (*constraint->getVisualize())(viz, sim->getConstantsLL(), t0, t1, 0xffffFFFF);
- }
+ Sc::BodySim* b0 = sim->getBody(0);
+ Sc::BodySim* b1 = sim->getBody(1);
+ PxTransform t0 = b0 ? b0->getBody2World() : PxTransform(PxIdentity);
+ PxTransform t1 = b1 ? b1->getBody2World() : PxTransform(PxIdentity);
+ PvdConstraintVisualizer viz(joint, *mUserRender);
+ (*constraint->getVisualize())(viz, sim->getConstantsLL(), t0, t1, 0xffffFFFF);
}
- ++constraintCount;
}
-
- mUserRender->flushRenderEvents();
+ ++constraintCount;
}
+
+ mUserRender->flushRenderEvents();
}
}
@@ -1176,16 +1115,16 @@ void ScbScenePvdClient::updateContacts()
if(!checkPvdDebugFlag())
return;
+ PX_PROFILE_ZONE("PVD.updateContacts", getContextId(mScbScene));
+
// if contacts are disabled, send empty array and return
const PxScene* theScene(mScbScene.getPxScene());
- if(!(getScenePvdFlags() & PxPvdSceneFlag::eTRANSMIT_CONTACTS))
+ if(!(getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_CONTACTS))
{
mMetaDataBinding.sendContacts(*mPvdDataStream, *theScene);
return;
}
- PX_PROFILE_ZONE("PVD.updateContacts", getContextId(mScbScene));
-
PxsContactManagerOutputIterator outputIter;
Sc::ContactIterator contactIter;
@@ -1202,11 +1141,9 @@ void ScbScenePvdClient::updateContacts()
mMetaDataBinding.sendContacts(*mPvdDataStream, *theScene, contacts);
}
-
void ScbScenePvdClient::updateSceneQueries()
{
- // if contacts are disabled, send empty array and return
- if(checkPvdDebugFlag() && (getScenePvdFlags() & PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES))
+ if(checkPvdDebugFlag() && (getScenePvdFlagsFast() & PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES))
mMetaDataBinding.sendSceneQueries(*mPvdDataStream, *mScbScene.getPxScene(), mPvd);
}
@@ -1230,9 +1167,16 @@ void ScbScenePvdClient::visualize(const PxRenderBuffer& debugRenderable)
{
if(mUserRender)
{
- mUserRender->drawRenderbuffer(reinterpret_cast<const PvdDebugPoint*>(debugRenderable.getPoints()), debugRenderable.getNbPoints(),
- reinterpret_cast<const PvdDebugLine*>(debugRenderable.getLines()), debugRenderable.getNbLines(),
- reinterpret_cast<const PvdDebugTriangle*>(debugRenderable.getTriangles()), debugRenderable.getNbTriangles());
+ // PT: I think the mUserRender object can contain extra data (including things coming from the user), because the various
+ // draw functions are exposed e.g. in PxPvdSceneClient.h. So I suppose we have to keep the render buffer around regardless
+ // of the connection flags. Thus I only skip the "drawRenderbuffer" call, for minimal intrusion into this file.
+ if(checkPvdDebugFlag())
+ {
+ mUserRender->drawRenderbuffer(
+ reinterpret_cast<const PvdDebugPoint*>(debugRenderable.getPoints()), debugRenderable.getNbPoints(),
+ reinterpret_cast<const PvdDebugLine*>(debugRenderable.getLines()), debugRenderable.getNbLines(),
+ reinterpret_cast<const PvdDebugTriangle*>(debugRenderable.getTriangles()), debugRenderable.getNbTriangles());
+ }
mUserRender->flushRenderEvents();
}
}
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbScenePvdClient.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbScenePvdClient.h
index a7461571..92652efb 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbScenePvdClient.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbScenePvdClient.h
@@ -80,7 +80,6 @@ class ParticleSystemCore;
namespace Vd
{
-
class ScbScenePvdClient : public PxPvdSceneClient, public PvdClient, public PvdVisualizer
{
PX_NOCOPY(ScbScenePvdClient)
@@ -90,34 +89,34 @@ class ScbScenePvdClient : public PxPvdSceneClient, public PvdClient, public PvdV
// PxPvdSceneClient
virtual void setScenePvdFlag(PxPvdSceneFlag::Enum flag, bool value);
- virtual void setScenePvdFlags(PxPvdSceneFlags flags);
- virtual PxPvdSceneFlags getScenePvdFlags() const;
+ virtual void setScenePvdFlags(PxPvdSceneFlags flags) { mFlags = flags; }
+ virtual PxPvdSceneFlags getScenePvdFlags() const { return mFlags; }
virtual void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target);
virtual void drawPoints(const PvdDebugPoint* points, PxU32 count);
virtual void drawLines(const PvdDebugLine* lines, PxU32 count);
virtual void drawTriangles(const PvdDebugTriangle* triangles, PxU32 count);
virtual void drawText(const PvdDebugText& text);
- virtual PvdClient* getClientInternal();
+ virtual PvdClient* getClientInternal() { return this; }
//~PxPvdSceneClient
// pvdClient
- virtual PvdDataStream* getDataStream();
- virtual PvdMetaDataBinding* getMetaDataBinding();
- virtual PvdUserRenderer* getUserRender();
- virtual bool isConnected() const ;
+ virtual PvdDataStream* getDataStream() { return mPvdDataStream; }
+ virtual PvdMetaDataBinding* getMetaDataBinding() { return &mMetaDataBinding; }
+ virtual PvdUserRenderer* getUserRender() { return mUserRender; }
+ virtual bool isConnected() const { return mIsConnected; }
virtual void onPvdConnected();
virtual void onPvdDisconnected();
- virtual void flush();
+ virtual void flush() {}
//~pvdClient
- PsPvd* getPsPvd();
- void setPsPvd(PsPvd* pvd);
-
- PX_INLINE bool checkPvdDebugFlag()
+ PX_FORCE_INLINE bool checkPvdDebugFlag() const
{
return mIsConnected && (mPvd->getInstrumentationFlags() & PxPvdInstrumentationFlag::eDEBUG);
}
+ PX_FORCE_INLINE PxPvdSceneFlags getScenePvdFlagsFast() const { return mFlags; }
+ PX_FORCE_INLINE void setPsPvd(PsPvd* pvd) { mPvd = pvd; }
+
void frameStart(PxReal simulateElapsedTime);
void frameEnd();
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbShape.cpp b/PhysX_3.4/Source/PhysX/src/buffering/ScbShape.cpp
index 59f07169..9ae22ddb 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbShape.cpp
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbShape.cpp
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#include "ScbShape.h"
using namespace physx;
@@ -36,7 +35,7 @@ bool Scb::Shape::setMaterialsHelper(PxMaterial* const* materials, PxU16 material
{
PX_ASSERT(!isBuffering());
- if (materialCount == 1)
+ if(materialCount == 1)
{
PxU16 materialIndex = Ps::to16((static_cast<NpMaterial*>(materials[0]))->getHandle());
@@ -48,7 +47,7 @@ bool Scb::Shape::setMaterialsHelper(PxMaterial* const* materials, PxU16 material
PX_ALLOCA(materialIndices, PxU16, materialCount);
- if (materialIndices)
+ if(materialIndices)
{
NpMaterial::getMaterialIndices(materials, materialIndices, materialCount);
mShape.setMaterialIndices(materialIndices, materialCount);
@@ -62,57 +61,51 @@ bool Scb::Shape::setMaterialsHelper(PxMaterial* const* materials, PxU16 material
}
Scb::Scene* sc = getScbScene();
-
- if (sc)
- {
+ if(sc)
sc->getScScene().notifyNphaseOnUpdateShapeMaterial(mShape);
- }
return true;
}
-
void Scb::Shape::syncState()
{
- PxU32 flags = getBufferFlags();
- if (flags)
+ const PxU32 flags = getBufferFlags();
+ if(flags)
{
-
- PxShapeFlags oldShapeFlags = mShape.getFlags();
+ const PxShapeFlags oldShapeFlags = mShape.getFlags();
const Scb::ShapeBuffer& buffer = *getBufferedData();
- if (flags & Buf::BF_Geometry)
- {
- Scb::Scene* sc = getScbScene();
+ Scb::Scene* scbScene = getScbScene(); // PT: can be NULL. See e.g. RbShapeTest.ReleaseShapeWithPendingUpdate UT.
- if (sc)
- {
- sc->getScScene().unregisterShapeFromNphase(mShape);
- }
+ if(flags & Buf::BF_Geometry)
+ {
+ if(scbScene)
+ scbScene->getScScene().unregisterShapeFromNphase(mShape);
mShape.setGeometry(buffer.geometry.getGeometry());
- if (sc)
- {
- sc->getScScene().registerShapeInNphase(mShape);
- }
+ if(scbScene)
+ scbScene->getScScene().registerShapeInNphase(mShape);
#if PX_SUPPORT_PVD
if(getControlState() == ControlState::eIN_SCENE)
{
- Scb::Scene* scbScene = getScbScene();
PX_ASSERT(scbScene);
scbScene->getScenePvdClient().releaseAndRecreateGeometry(this);
}
#endif
}
- if (flags & Buf::BF_Material)
+ if(flags & Buf::BF_Material)
{
- const PxU16* materialIndices = getMaterialBuffer(*getScbScene(), buffer);
- mShape.setMaterialIndices(materialIndices, buffer.materialCount);
- getScbScene()->getScScene().notifyNphaseOnUpdateShapeMaterial(mShape);
+ // PT: not sure if this is correct. Added the check for PX-800 but "getMaterialBuffer" doesn't always need the scene pointer...
+ if(scbScene)
+ {
+ const PxU16* materialIndices = getMaterialBuffer(*scbScene, buffer);
+ mShape.setMaterialIndices(materialIndices, buffer.materialCount);
+ scbScene->getScScene().notifyNphaseOnUpdateShapeMaterial(mShape);
+ }
UPDATE_PVD_MATERIALS()
// TODO: So far we did not bother to fail gracefully in the case of running out of memory. If that should change then this
// method is somewhat problematic. The material ref counters have been adjusted at the time when the public API was called.
@@ -127,19 +120,15 @@ void Scb::Shape::syncState()
flush<Buf::BF_SimulationFilterData>(buffer);
if(isBuffered(Buf::BF_ContactOffset))
- {
mShape.setContactOffset(buffer.mContactOffset);
- }
flush<Buf::BF_RestOffset>(buffer);
flush<Buf::BF_Flags>(buffer);
Sc::RigidCore* scRigidCore = NpShapeGetScRigidObjectFromScbSLOW(*this);
- if (scRigidCore) // may be NULL for exclusive shapes because of pending shape updates after buffered release of actor.
- {
+ if(scRigidCore) // may be NULL for exclusive shapes because of pending shape updates after buffered release of actor.
scRigidCore->onShapeChange(mShape, Sc::ShapeChangeNotifyFlags(flags), oldShapeFlags, true);
- }
}
postSyncState();
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbShape.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbShape.h
index 697017bf..b4440dbe 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbShape.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbShape.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_SHAPE
#define PX_PHYSICS_SCB_SHAPE
@@ -47,13 +46,10 @@
namespace physx
{
-
#if PX_SUPPORT_PVD
- #define UPDATE_PVD_MATERIALS() \
- if(getControlState() == ControlState::eIN_SCENE) \
- { \
- getScbScene()->getScenePvdClient().updateMaterials(this); \
- }
+ #define UPDATE_PVD_MATERIALS() \
+ if(getControlState() == ControlState::eIN_SCENE) \
+ getScbScene()->getScenePvdClient().updateMaterials(this);
#else
#define UPDATE_PVD_MATERIALS() {}
#endif
@@ -71,6 +67,8 @@ struct ShapeBuffer
ShapeBuffer() : materialBufferIndex(0), materialCount(0) {}
+ // PT: I think we start with "2" (instead of 0) because the two first bits are reserved
+ // below, for geometry & materials.
SCB_REGULAR_ATTRIBUTE_ALIGNED(2, PxTransform, Shape2Actor, 16)
SCB_REGULAR_ATTRIBUTE(3, PxFilterData, SimulationFilterData)
SCB_REGULAR_ATTRIBUTE(4, PxReal, ContactOffset)
@@ -86,12 +84,11 @@ struct ShapeBuffer
};
PxU16 materialCount;
- enum
+ enum
{
- BF_Geometry = 1<<0,
- BF_Material = 1<<1
+ BF_Geometry = 1<<0,
+ BF_Material = 1<<1
};
-
};
class Shape : public Base
@@ -135,7 +132,7 @@ public:
PX_INLINE void setSimulationFilterData(const PxFilterData& v) { write<Buf::BF_SimulationFilterData>(v); }
PX_INLINE PxReal getContactOffset() const { return read<Buf::BF_ContactOffset>(); }
- PX_INLINE void setContactOffset(PxReal v);
+ PX_INLINE void setContactOffset(PxReal v) { write<Buf::BF_ContactOffset>(v); }
PX_INLINE PxReal getRestOffset() const { return read<Buf::BF_RestOffset>(); }
PX_INLINE void setRestOffset(PxReal v) { write<Buf::BF_RestOffset>(v); }
@@ -143,13 +140,11 @@ public:
PX_INLINE PxShapeFlags getFlags() const { return read<Buf::BF_Flags>(); }
PX_INLINE void setFlags(PxShapeFlags v) { write<Buf::BF_Flags>(v); }
-
//---------------------------------------------------------------------------------
// Data synchronization
//---------------------------------------------------------------------------------
void syncState();
-
//---------------------------------------------------------------------------------
// Miscellaneous
//---------------------------------------------------------------------------------
@@ -158,15 +153,12 @@ public:
PX_FORCE_INLINE Sc::ShapeCore& getScShape() { return mShape; } // Only use if you know what you're doing!
PX_FORCE_INLINE const Sc::ShapeCore& getScShape() const { return mShape; }
- PX_FORCE_INLINE bool isExclusive() const { return getScbType() == ScbType::SHAPE_EXCLUSIVE; }
+ PX_FORCE_INLINE bool isExclusive() const { return getScbType() == ScbType::eSHAPE_EXCLUSIVE; }
PX_FORCE_INLINE void setControlStateIfExclusive(Scene* s, ControlState::Enum cs); // for exclusive shapes
template<bool sync> PX_FORCE_INLINE void checkUpdateOnRemove(Scene* s);
- static size_t getScOffset()
- {
- return reinterpret_cast<size_t>(&reinterpret_cast<Shape*>(0)->mShape);
- }
+ static size_t getScOffset() { return reinterpret_cast<size_t>(&reinterpret_cast<Shape*>(0)->mShape); }
private:
bool setMaterialsHelper(PxMaterial* const* materials, PxU16 materialCount);
@@ -176,10 +168,9 @@ private:
PX_FORCE_INLINE const Scb::ShapeBuffer* getBufferedData() const { return reinterpret_cast<const Scb::ShapeBuffer*>(getStream()); }
PX_FORCE_INLINE Scb::ShapeBuffer* getBufferedData() { return reinterpret_cast<Scb::ShapeBuffer*>(getStream()); }
-
PX_FORCE_INLINE const PxU16* getMaterialBuffer(const Scb::Scene& scene, const Scb::ShapeBuffer& sb) const
{
- if (sb.materialCount == 1)
+ if(sb.materialCount == 1)
return &sb.materialIndex;
else
return scene.getShapeMaterialBuffer(sb.materialBufferIndex);
@@ -194,7 +185,7 @@ private:
template<typename Fns>
static PX_FORCE_INLINE void write(Shape& base, Core& core, typename Fns::Arg v)
{
- if (!base.isBuffering())
+ if(!base.isBuffering())
{
PxShapeFlags oldShapeFlags = core.getFlags();
Fns::setCore(core, v);
@@ -214,16 +205,14 @@ private:
Fns::setBuffered(*reinterpret_cast<Buf*>(base.getStream()), v);
base.markUpdated(Fns::flag);
}
- }
-
+ }
};
+
template<PxU32 f> PX_FORCE_INLINE typename Buf::Fns<f,0>::Arg read() const { return Access::read<Buf::Fns<f,0> >(*this, mShape); }
template<PxU32 f> PX_FORCE_INLINE void write(typename Buf::Fns<f,0>::Arg v) { Access::write<Buf::Fns<f,0> >(*this, mShape, v); }
template<PxU32 f> PX_FORCE_INLINE void flush(const Buf& buf) { Access::flush<Buf::Fns<f,0> >(*this, mShape, buf); }
-
};
-
PX_INLINE Shape::Shape(const PxGeometry& geometry,
PxShapeFlags shapeFlags,
const PxU16* materialIndices,
@@ -242,13 +231,12 @@ PX_INLINE Shape::Shape(const PxGeometry& geometry,
PX_COMPILE_TIME_ASSERT(PxU32(ShapeBuffer::BF_Flags) == PxU32(Sc::ShapeChangeNotifyFlag::eFLAGS));
PX_COMPILE_TIME_ASSERT(PxU32(ShapeBuffer::BF_Geometry) == PxU32(Sc::ShapeChangeNotifyFlag::eGEOMETRY));
- if (isExclusive)
- setScbType(ScbType::SHAPE_EXCLUSIVE);
+ if(isExclusive)
+ setScbType(ScbType::eSHAPE_EXCLUSIVE);
else
- setScbType(ScbType::SHAPE_SHARED);
+ setScbType(ScbType::eSHAPE_SHARED);
}
-
PX_INLINE PxGeometryType::Enum Shape::getGeometryType() const
{
return mShape.getGeometryType();
@@ -256,7 +244,7 @@ PX_INLINE PxGeometryType::Enum Shape::getGeometryType() const
PX_INLINE const PxGeometry& Shape::getGeometry() const
{
- if (isBuffered(Buf::BF_Geometry))
+ if(isBuffered(Buf::BF_Geometry))
return getBufferedData()->geometry.getGeometry();
else
return mShape.getGeometry();
@@ -264,13 +252,12 @@ PX_INLINE const PxGeometry& Shape::getGeometry() const
PX_INLINE const Gu::GeometryUnion& Shape::getGeometryUnion() const
{
- if (isBuffered(Buf::BF_Geometry))
+ if(isBuffered(Buf::BF_Geometry))
return getBufferedData()->geometry;
else
return mShape.getGeometryUnion();
}
-
PX_INLINE Scb::ShapeBuffer* Shape::setGeometry(const PxGeometry& geom)
{
Scb::ShapeBuffer* shapeBuffer = NULL;
@@ -278,17 +265,13 @@ PX_INLINE Scb::ShapeBuffer* Shape::setGeometry(const PxGeometry& geom)
{
Scb::Scene* sc = getScbScene();
- if (sc)
- {
+ if(sc)
sc->getScScene().unregisterShapeFromNphase(mShape);
- }
mShape.setGeometry(geom);
- if (sc)
- {
+ if(sc)
sc->getScScene().registerShapeInNphase(mShape);
- }
Sc::RigidCore* rigidCore = NpShapeGetScRigidObjectFromScbSLOW(*this);
if(rigidCore)
@@ -297,9 +280,7 @@ PX_INLINE Scb::ShapeBuffer* Shape::setGeometry(const PxGeometry& geom)
#if PX_SUPPORT_PVD
Scb::Scene* scbScene = getScbSceneForAPI();
if(scbScene)
- {
- scbScene->getScenePvdClient().releaseAndRecreateGeometry( this );
- }
+ scbScene->getScenePvdClient().releaseAndRecreateGeometry(this);
#endif
}
else
@@ -312,22 +293,20 @@ PX_INLINE Scb::ShapeBuffer* Shape::setGeometry(const PxGeometry& geom)
return shapeBuffer;
}
-
PX_INLINE PxU16 Shape::getNbMaterials() const
{
- if (isBuffered(Buf::BF_Material))
+ if(isBuffered(Buf::BF_Material))
return getBufferedData()->materialCount;
else
return mShape.getNbMaterialIndices();
}
-
PX_INLINE PxMaterial* Shape::getMaterial(PxU32 index) const
{
PX_ASSERT(index < getNbMaterials());
NpMaterialManager& matManager = NpPhysics::getInstance().getMaterialManager();
- if (isBuffered(Buf::BF_Material))
+ if(isBuffered(Buf::BF_Material))
{
const PxU16* materialIndices = getMaterialBuffer(*getScbScene(), *getBufferedData());
return matManager.getMaterial(materialIndices[index]);
@@ -339,13 +318,12 @@ PX_INLINE PxMaterial* Shape::getMaterial(PxU32 index) const
}
}
-
PX_INLINE PxU32 Shape::getMaterials(PxMaterial** buffer, PxU32 bufferSize, PxU32 startIndex) const
{
const PxU16* materialIndices;
PxU32 matCount;
NpMaterialManager& matManager = NpPhysics::getInstance().getMaterialManager();
- if (isBuffered(Buf::BF_Material))
+ if(isBuffered(Buf::BF_Material))
{
// IMPORTANT:
// As long as the material pointers get copied to a user buffer, this works fine.
@@ -375,10 +353,9 @@ PX_INLINE PxU32 Shape::getMaterials(PxMaterial** buffer, PxU32 bufferSize, PxU32
return writeCount;
}
-
PX_INLINE bool Shape::setMaterials(PxMaterial* const* materials, PxU16 materialCount)
{
- if (!isBuffering())
+ if(!isBuffering())
{
bool ret = setMaterialsHelper(materials, materialCount);
UPDATE_PVD_MATERIALS()
@@ -389,7 +366,7 @@ PX_INLINE bool Shape::setMaterials(PxMaterial* const* materials, PxU16 materialC
Scb::ShapeBuffer* PX_RESTRICT bufferedData = getBufferedData();
PxU16* materialIndices;
- if (materialCount == 1)
+ if(materialCount == 1)
materialIndices = &bufferedData->materialIndex;
else
{
@@ -407,44 +384,31 @@ PX_INLINE bool Shape::setMaterials(PxMaterial* const* materials, PxU16 materialC
}
}
-PX_INLINE void Shape::setContactOffset(PxReal v)
-{
- write<Buf::BF_ContactOffset>(v);
-}
-
-
PX_FORCE_INLINE void Shape::setControlStateIfExclusive(Scene* s, ControlState::Enum cs)
{
- if (isExclusive())
+ if(isExclusive())
{
setControlState(cs);
setScbScene(s);
}
}
-
template<bool sync>
PX_FORCE_INLINE void Shape::checkUpdateOnRemove(Scene* s)
{
// special code to cover the case where a shape has a pending update and gets released. The following operations have to be done
// before the ref-counter of the shape gets decremented because that could cause the shape to be deleted in which case it must not
// be in the pending update list any longer.
- if (getControlFlags() & Scb::ControlFlag::eIS_UPDATED)
+ if(getControlFlags() & Scb::ControlFlag::eIS_UPDATED)
{
- if (sync)
+ if(sync)
syncState();
s->removeShapeFromPendingUpdateList(*this);
+
+ resetControlFlag(ControlFlag::eIS_UPDATED);
}
}
-
-//--------------------------------------------------------------
-//
-// Data synchronization
-//
-//--------------------------------------------------------------
-
-
} // namespace Scb
}
diff --git a/PhysX_3.4/Source/PhysX/src/buffering/ScbType.h b/PhysX_3.4/Source/PhysX/src/buffering/ScbType.h
index b1725661..55fc5c97 100644
--- a/PhysX_3.4/Source/PhysX/src/buffering/ScbType.h
+++ b/PhysX_3.4/Source/PhysX/src/buffering/ScbType.h
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#ifndef PX_PHYSICS_SCB_TYPE
#define PX_PHYSICS_SCB_TYPE
@@ -37,23 +36,23 @@ namespace physx
{
enum Enum
{
- UNDEFINED,
- SHAPE_EXCLUSIVE,
- SHAPE_SHARED,
- BODY,
- BODY_FROM_ARTICULATION_LINK,
- RIGID_STATIC,
- CONSTRAINT,
+ eUNDEFINED,
+ eSHAPE_EXCLUSIVE,
+ eSHAPE_SHARED,
+ eBODY,
+ eBODY_FROM_ARTICULATION_LINK,
+ eRIGID_STATIC,
+ eCONSTRAINT,
#if PX_USE_PARTICLE_SYSTEM_API
- PARTICLE_SYSTEM,
+ ePARTICLE_SYSTEM,
#endif
- ARTICULATION,
- ARTICULATION_JOINT,
- AGGREGATE,
+ eARTICULATION,
+ eARTICULATION_JOINT,
+ eAGGREGATE,
#if PX_USE_CLOTH_API
- CLOTH,
+ eCLOTH,
#endif
- TYPE_COUNT
+ eTYPE_COUNT
};
};
}