17 #ifndef AGX_PARTICLESTATE_H 18 #define AGX_PARTICLESTATE_H 30 class ParticleState :
public BitSet_small<ParticleStateDataType>
37 bool enableMerge()
const;
38 bool enableRotation()
const;
39 bool particleClipped()
const;
40 bool particleFiltered()
const;
41 bool isTerrainSoilParticle()
const;
42 bool enableRendering()
const;
43 bool shouldRenderParticle()
const;
46 void setEnabled(
bool flag);
47 void setRemoved(
bool flag);
48 void setEnableMerge(
bool flag);
49 void setEnableRotation(
bool flag);
50 void setParticleClipped(
bool flag);
51 void setParticleFiltered(
bool flag);
52 void setIsTerrainSoilParticle(
bool flag);
53 void setEnableRendering(
bool flag);
56 friend class RigidBody;
57 friend class DynamicsSystem;
58 friend class MergedBody;
59 friend class MassPropertiesUpdate;
61 static const UInt16 ENABLE_RENDERING = 12;
62 static const UInt16 TERRAIN_SOIL_PARTICLE = 11;
63 static const UInt16 RENDERING_PARTICLE_FILTERED = 10;
64 static const UInt16 RENDERING_PARTICLE_CLIPPED = 9;
65 static const UInt16 ENABLE_NO_ROTATIONS = 8;
66 static const UInt16 ENABLE_MERGE_BIT = 7;
67 static const UInt16 REMOVED_BIT = 6;
68 static const UInt16 ENABLE_BIT = 5;
72 AGX_FORCE_INLINE ParticleState::ParticleState() : BitSet_small<ParticleStateDataType>()
74 this->
set(ENABLE_BIT,
true);
75 this->
set(REMOVED_BIT,
false);
76 this->
set(ENABLE_MERGE_BIT,
true);
77 this->
set(RENDERING_PARTICLE_CLIPPED,
false);
78 this->
set(RENDERING_PARTICLE_FILTERED, false );
79 this->
set(TERRAIN_SOIL_PARTICLE,
false);
80 this->
set(ENABLE_RENDERING,
true);
91 return this->test(ENABLE_BIT);
96 return this->test(RENDERING_PARTICLE_CLIPPED);
101 return this->test(REMOVED_BIT);
106 return this->test(ENABLE_MERGE_BIT);
111 return !this->test(ENABLE_NO_ROTATIONS);
116 return this->test(RENDERING_PARTICLE_FILTERED);
121 return this->test( TERRAIN_SOIL_PARTICLE );
126 return this->test( ENABLE_RENDERING );
131 const ParticleStateDataType mask = (ParticleStateDataType) 0x3;
132 m_state = (m_state & ~mask) | ((ParticleStateDataType)motionControl);
137 this->
set(ENABLE_BIT, flag);
142 this->
set(RENDERING_PARTICLE_CLIPPED, flag);
147 this->
set(RENDERING_PARTICLE_FILTERED, flag);
152 this->
set(ENABLE_NO_ROTATIONS, !flag);
157 this->
set(REMOVED_BIT, flag);
162 this->
set(ENABLE_MERGE_BIT, flag);
165 AGX_FORCE_INLINE void agx::ParticleState::setIsTerrainSoilParticle(
bool flag )
167 this->
set( TERRAIN_SOIL_PARTICLE, flag );
172 this->
set(ENABLE_RENDERING, flag);
177 return enableRendering() && !( particleClipped() || particleFiltered() );
181 std::ostream&
operator << (std::ostream& output,
const ParticleState& state);
#define AGX_TYPE_BINDING(_Type, _Name)
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
std::ostream & operator<<(std::ostream &os, const agx::AddedMassInteraction::Matrix6x6 &m)
AGXPHYSICS_EXPORT void setMotionControl(agx::RigidBodyPtrVector &bodies, agx::RigidBody::MotionControl motionControl)
Utility function to set motion control for a vector of rigid bodies.
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()