18 #ifndef AGX_RIGIDBODY_EMITTER_H
19 #define AGX_RIGIDBODY_EMITTER_H
53 CREATED_BY_RIGIDBODYEMITTER = 1 << 0,
54 CREATED_BY_SNAPSHOT_LOADING = 1 << 1,
55 IS_BODYMODEL_TEMPLATE = 1 << 2
57 typedef agx::BitState< EState, agx::Int32 >
State;
59 RigidBodyEmitterInternalData() : state() {}
63 virtual ~RigidBodyEmitterInternalData() {}
69 child =
new RigidBodyEmitterInternalData();
71 child->
as<RigidBodyEmitterInternalData>()->state = this->state;
163 static RigidBodyEmitterInternalData* getRigidBodyEmitterData(const
agx::
RigidBody* obj);
165 static RigidBodyEmitterInternalData* getOrCreateRigidBodyEmitterData(
agx::
RigidBody* obj);
174 virtual
void emitBody(const
Vec3& position, const
Vec3& velocity,
Emitter::DistributionModel *model) override;
175 virtual
bool preEmit() override;
176 virtual
void postEmit() override;
178 virtual
void transfer(
agxSDK::Simulation *simulation) override;
187 agxSDK::Simulation *m_simulation;
224 virtual ~DistributionModel();
#define AGX_DECLARE_POINTER_TYPES(type)
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
#define AGX_DECLARE_VECTOR_TYPES(type)
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Spawns new bodys inside a given volume.
friend class DistributionTable
Interface class for a cloneable reference counted object.
T * as()
Subclass casting.
Spawns new Rigid Bodies inside a volume given to the Emitter.
static void setRigidBodyIsLoaded(agx::RigidBody *body, bool isLoaded)
Manually override setting that specifies if a RigidBody was loaded from an snapshot.
static void setRigidBodyIsEmitted(agx::RigidBody *body, bool isEmitted)
Manually override setting that specifies if a RigidBody was created from an Emitter.
static agx::RigidBodyPtrVector getEmittedBodiesInSimulation(agxSDK::Simulation *simulation)
static agx::RigidBodyRefVector spawnBodiesInBound(const agx::Bound3 &bound, agx::Emitter::DistributionTable *sourceTable, const agx::Vec3 &spacing, agx::Real jitterfactor=agx::Real(0))
Spawn Rigid Bodies inside a 3D bound based on a specified distribution table of rigid bodies.
Event2< RigidBodyEmitter *, agx::RigidBody * > Event
agx::RigidBody * getBodyTemplate()
DistributionModel(agx::RigidBody *bodyTemplate, agx::Real probabilityWeight)
Create a Rigid Body Distribution model for usage in the Emitter::DistributionTable class.
static bool rigidBodyIsLoaded(const agx::RigidBody *body)
static bool rigidBodyIsEmitted(const agx::RigidBody *body)
DistributionModel()
Default constructor.
static bool rigidBodyIsTemplate(const agx::RigidBody *body)
RigidBodyEmitter(Quantity quantity=QUANTITY_COUNT)
Default constructor for a RigidBodyEmitter.
static void setRigidBodyIsTemplate(agx::RigidBody *body, bool isTemplate)
Set state bit in the RigidBodyEmitterData for the specifed RigidBody that signals if it is used as a ...
The rigid body class, combining a geometric model and a frame of reference.
Smart pointer for handling referenced counted objects.
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
void AGXPHYSICS_EXPORT init()
Initialize agx.
agx::ref_ptr< ICloneable > ICloneableRef