AGX Dynamics 2.41.2.0
Loading...
Searching...
No Matches
agx::Emitter Class Referenceabstract

Spawns new bodys inside a given volume. More...

#include <Emitter.h>

+ Inheritance diagram for agx::Emitter:

Public Types

typedef agx::observer_ptr< const DistributionModelDistributionModelConstObserver
 
typedef agx::ref_ptr< const DistributionModelDistributionModelConstRef
 
typedef agx::observer_ptr< DistributionModelDistributionModelObserver
 
typedef agx::Vector< DistributionModelObserverDistributionModelObserverVector
 
typedef agx::VectorPOD< DistributionModel * > DistributionModelPtrVector
 
typedef agx::ref_ptr< DistributionModelDistributionModelRef
 
typedef agx::Vector< DistributionModelRefDistributionModelRefVector
 
typedef agx::observer_ptr< const DistributionTableDistributionTableConstObserver
 
typedef agx::ref_ptr< const DistributionTableDistributionTableConstRef
 
typedef agx::observer_ptr< DistributionTableDistributionTableObserver
 
typedef agx::ref_ptr< DistributionTableDistributionTableRef
 
typedef agx::observer_ptr< const EmitterData > EmitterDataConstObserver
 
typedef agx::ref_ptr< const EmitterData > EmitterDataConstRef
 
typedef agx::observer_ptr< EmitterData > EmitterDataObserver
 
typedef agx::ref_ptr< EmitterData > EmitterDataRef
 
enum  Quantity { QUANTITY_COUNT , QUANTITY_VOLUME , QUANTITY_MASS }
 
- Public Types inherited from agx::Task
typedef Event1< Task * > ExecutionEvent
 
typedef Event2< Task *, Parameter * > ParameterEvent
 
enum  ParameterMatch {
  NO_EVENTS = 0 , EMPTY_BINDING_LIST = (1<<0) , PARAMETER_VALID = (1<<1) , PARAMETER_NOT_REQUIRED = (1<<2) ,
  PARAMETER_BOUND = (1<<3) , PARAMETER_HAS_BOUND_PATH = (1<<4) , FORMATS_MATCH = (1<<5) , NEED_DEVICE_TRANSFORM = (1<<6) ,
  MISSING_BINDING = (1<<7) , BINDING_LACKS_TYPE = (1<<8) , FORMATS_MISSMATCH = (1<<9) , EXTRA_BINDING = (1<<10) ,
  INCONSISTEN_PARAMETERS = (1<<11) , MATCH_MASK = EMPTY_BINDING_LIST | PARAMETER_VALID | PARAMETER_NOT_REQUIRED | PARAMETER_BOUND | PARAMETER_HAS_BOUND_PATH | FORMATS_MATCH | NEED_DEVICE_TRANSFORM , NO_MATCH_MASK = MISSING_BINDING | BINDING_LACKS_TYPE | FORMATS_MISSMATCH | EXTRA_BINDING | INCONSISTEN_PARAMETERS
}
 Used for tracing mismatched parameter bindings. More...
 
enum  ProfilingMode { PROFILING_NONE , PROFILING_FAST , PROFILING_FULL }
 
- Public Types inherited from agx::Component
typedef Event2< Component *, Object * > ObjectEvent
 Event when adding removing child objects.
 
typedef Callback1< Object * > TraverseCallback
 
- Public Types inherited from agx::Object
typedef agx::observer_ptr< const EventEventConstObserver
 
typedef agx::ref_ptr< const EventEventConstRef
 
typedef agx::observer_ptr< EventEventObserver
 
typedef agx::Vector< EventObserverEventObserverVector
 
typedef agx::VectorPOD< Event * > EventPtrVector
 
typedef agx::ref_ptr< EventEventRef
 
typedef agx::Vector< EventRefEventRefVector
 

Public Member Functions

 Emitter (Quantity quantity=QUANTITY_COUNT)
 Create an emitter.
 
void addCollisionGroup (agx::UInt32 id)
 Add the specified id to a vector of group id, this will make a bodies emitted from this emitter part of the group id.
 
void addCollisionGroup (const agx::Name &name)
 
void addModel (DistributionModel *model)
 Add a particle model.
 
agx::Real calculateTotalWeight () const
 
 DistributionModel ()
 
 DistributionModel (agx::Real probabilityWeight)
 
 DistributionTable (Quantity quantity=QUANTITY_COUNT)
 
agx::UInt getActivationCount () const
 
agx::Physics::CollisionGroupSetPtr getCollisionGroupSet () const
 
DistributionTablegetDistributionTable ()
 
const DistributionTablegetDistributionTable () const
 
agx::Real getEmittedQuantity () const
 Returns the quantity amount that this emitter has emitted.
 
bool getEnableOverrideRenderSettings () const
 
bool getEnableRenderEmittedObjects () const
 
agx::Vec3 getFixedPositionOffset () const
 
agx::Quat getFixedRotationOffset () const
 
agxCollide::GeometrygetGeometry ()
 
agx::Real getMass () const
 
agx::Real getMaximumEmittedQuantity () const
 Get the maximum amount of quantity that this emitter is allowed to emit.
 
const DistributionModelRefVectorgetModels () const
 
agx::String getName () const
 
agx::UInt getNumEmitted () const
 
Quantity getProbabilityQuantity () const
 
agx::Real getProbabilityWeight () const
 
Quantity getQuantity () const
 
DistributionModelgetRandomModel ()
 
Real getRate () const
 
bool getUseFixedPosition (agx::Int axis=-1) const
 
bool getUseFixedRotation (agx::Int axis=-1) const
 
const Vec3getVelocity () const
 
agx::Real getVolume () const
 
bool hasCollisionGroup (agx::Name id) const
 
bool hasCollisionGroup (agx::UInt32 id) const
 This is performing a linear search among the group id for this Emitter.
 
void removeCollisionGroup (agx::UInt32 id)
 Remove a group id from the vector of group ids.
 
void removeCollisionGroup (const agx::Name &name)
 
void setDistributionTable (DistributionTable *table)
 Set a distribution table to be used for body attributes.
 
void setEnableOverrideRenderSettings (bool enable)
 Sets whenever the render settings of emitted objects should be overriden.
 
void setEnableRenderEmittedObjects (bool enable)
 Sets whenever the emitted objects should be rendered or not, if possible.
 
void setFixedPositionOffset (const agx::Vec3 &fixedPositionOffset)
 Set the fixed position offset of the objects created from the emitter.
 
void setFixedRotationOffset (const agx::Quat &fixedRotationOffset)
 Set the fixed rotation offset of the objects created from the emitter.
 
void setGeometry (agxCollide::Geometry *geometry)
 Set the volume that bodies will be spawned inside.
 
void setMaximumEmittedQuantity (const agx::Real max)
 Sets the maximum amount of objects that this emitter is allowed to emit.
 
void setName (const agx::String &name)
 Set emitter name.
 
void setProbabilityQuantity (Quantity quantity)
 Set The probability quantity.
 
void setProbabilityWeight (agx::Real weight)
 Set the random probability weight.
 
void setQuantity (Quantity quantity)
 Set the emitting quantity QUANTITY_COUNT - number of emitted objects QUANTITY_VOLUME - volume of emitted objects QUANTITY_MASS - mass of emitted objects.
 
void setRate (Real rate)
 Set the rate in which the emitter emits objects, measured in the specified quantity QUANTITY_COUNT - number of objects / time unit QUANTITY_VOLUME - volume of objects / time unit QUANTITY_MASS - mass of objects / time unit.
 
void setSeed (agx::UInt32 seed)
 Set the seed of the random number generator in the distribution table.
 
void setSeed (const agx::UInt32 seed)
 Set the seed for the random number generator of the emitter.
 
void setUseFixedPosition (bool enable, agx::Int axis=-1)
 Set if fixed position should be used on objects created from this emitter.
 
void setUseFixedRotation (bool enable, agx::Int axis=-1)
 Set if a fixed rotation should be used on objects created from this emitter.
 
void setVelocity (const Vec3 &velocity)
 Set the initial velocity for the bodys when spawned, in local geometry coordinates.
 
- Public Member Functions inherited from agx::SerialTask
 SerialTask (const agx::Name &name, agx::Device *device=agx::CpuDevice::instance())
 
 SerialTask (const agx::Name &name, const Job::Callback &runCallback, agx::Device *device=agx::CpuDevice::instance())
 
JobgetJob ()
 
virtual agx::JobgetPostJob () override
 
virtual agx::JobgetPreJob () override
 
virtual void run ()
 Execution callback.
 
void setDispatch (const Job::Callback &dispatchCallback)
 Specify the task dispatch to execute.
 
virtual void setTargetThread (agx::Thread *thread) override
 Set a specific thread which must execute this task.
 
- Public Member Functions inherited from agx::Task
 Task (const agx::Name &name, agx::Device *device=agx::CpuDevice::instance())
 Constructor.
 
void addDependencies (const agx::String &paths)
 
void addDependency (agx::Task *parent)
 Add a dependency.
 
void addDependency (const agx::Path &path)
 
void addParameter (agx::Parameter *parameter)
 Add a parameter.
 
void addParameter (agx::Parameter *parameter, size_t index)
 
void addResolvePath (const agx::Path &path)
 
void addResolvePaths (const agx::String &paths)
 
void addTriggerPath (const agx::Path &path)
 
void addTriggerPaths (const agx::String &paths)
 
void beginCallback ()
 
virtual void configure (TiXmlElement *eTask) override
 
void configure (TiXmlElement *eTask, bool loadParameters)
 
void endCallback (agx::Real32 computeCost, agx::Real32 overheadCost=0)
 
void execute ()
 Execute the task.
 
agx::Real32 getAccumulatedComputeCost () const
 
agx::Real32 getAccumulatedOverheadTime () const
 
agx::Real32 getAccumulatedWallTime () const
 
agx::ArrayParametergetArrayParameter (const agx::Name &name)
 
const agx::ArrayParametergetArrayParameter (const agx::Name &name) const
 
const agx::TaskPtrVectorgetChildren () const
 
agx::Real32 getComputeCost () const
 
agx::ThreadgetDispatchThread ()
 
agx::TaskGroupgetGroup ()
 
const agx::TaskGroupgetGroup () const
 
agx::UInt getNumAccumulationSamples () const
 
agx::Real32 getOverheadTime () const
 
agx::ParametergetParameter (const agx::Name &name)
 
const agx::ParametergetParameter (const agx::Name &name) const
 
agx::ParametergetParameter (size_t index)
 
const agx::ParametergetParameter (size_t index) const
 
const agx::ParameterPtrVectorgetParameters () const
 
const agx::TaskPtrVectorgetParents () const
 
agx::PointerParametergetPointerParameter (const agx::Name &name)
 
const agx::PointerParametergetPointerParameter (const agx::Name &name) const
 
virtual agx::JobgetPostJob ()=0
 
virtual agx::JobgetPreJob ()=0
 
agx::ScalarParametergetScalarParameter (const agx::Name &name)
 
const agx::ScalarParametergetScalarParameter (const agx::Name &name) const
 
agx::ThreadgetTargetThread ()
 
agx::Real32 getWallTime () const
 Performance statistics.
 
bool hasDependency (agx::Task *parent) const
 
bool isEnabled () const
 
bool isRunning () const
 
UInt32 matchParameters (agx::ParameterBindingVector &bindings, bool allowFormatPromotions)
 
UInt32 matchParameters (const agx::ParameterBindingVector &bindings)
 
UInt32 matchParameters (const ParameterTable &bindings)
 
void print () const
 
void print (std::ostream &stream) const
 
void printBindings ()
 
void printBindings (std::ostream &stream)
 
virtual void rebind () override
 
void removeDependency (agx::Task *parent)
 Remove a dependency.
 
void removeParameter (agx::Parameter *parameter)
 Remove a parameter.
 
void removeParameter (size_t index)
 
void replace (agx::Task *other)
 Replace the task with another task by rerouting the dependencies.
 
void resetAccumulationTimers (bool recursive=true)
 Reset accumulated performance statistics.
 
void save (agx::TiXmlElement *parent) const override
 
virtual void setContext (agx::Object *context) override
 
void setEnable (bool flag)
 Enable/disable a task.
 
void setModel (agx::Model *model)
 
virtual void setTargetThread (agx::Thread *thread)
 Set a specific thread which must execute this task.
 
void traverse (const Callback1< Task * > &callback, bool breadthFirst=true)
 
virtual void wait ()
 Block until the task has completed execution.
 
- Public Member Functions inherited from agx::Component
 Component (const agx::Name &name=agx::Name(), agx::Model *model=agx::Component::ClassModel(), agx::Device *device=nullptr)
 
virtual void addObject (agx::Object *object, bool assignContext=true)
 Add an object to the component.
 
virtual String autoComplete (const String &partialName, StringVector &matchingNames) const
 
virtual void buildNavigationTree (agxJson::Value &eNode) const override
 
void configure (Model *model)
 
virtual void configure (TiXmlElement *eComponent) override
 
agx::DevicegetDevice ()
 
template<typename T >
T * getDevice ()
 
const agx::DevicegetDevice () const
 
template<typename T >
const T * getDevice () const
 
size_t getNumObjects (const agx::Name &name) const
 
agx::ObjectgetObject (const agx::Name &name, agx::Model *model, size_t index=0)
 
const agx::ObjectgetObject (const agx::Name &name, agx::Model *model, size_t index=0) const
 
agx::ObjectgetObject (const agx::Name &name, size_t index=0)
 
template<typename T >
T * getObject (const agx::Name &name, size_t index=0)
 
const agx::ObjectgetObject (const agx::Name &name, size_t index=0) const
 
template<typename T >
const T * getObject (const agx::Name &name, size_t index=0) const
 
const agx::ObjectRefVectorgetObjects () const
 
template<typename T >
void getObjects (agx::ObjectPtrVector &result, bool recursive=false) const
 
void getObjects (agx::ObjectPtrVector &result, const agx::Model *model, bool recursive=false) const
 
virtual ObjectgetResourceImpl (const Path &path, agx::Model *model) override
 
virtual void printSubtree () const override
 
void printSubtree (std::ostream &stream, int depth=0) const
 
virtual void rebind () override
 
void removeAllObjects ()
 Remove all components.
 
virtual void removeObject (agx::Object *object)
 Remove an object from the component.
 
void removeObject (const agx::Name &name, size_t index=0)
 Remove an object with a specified name (and optional index) from the component.
 
virtual void snapshot (TiXmlNode *eParent, const String &directory) const override
 
void traverse (ComponentVisitor *)
 
void traverse (const TraverseCallback &callback)
 
- Public Member Functions inherited from agx::Object
 Object (const Name &name=Name(), Model *model=Object::ClassModel())
 
void addListener (EventListener *listener)
 
virtual void buildNavigationTree (agxJson::Value &eNode) const
 
virtual void configure (TiXmlElement *)
 
agx::String fullName () const
 
agx::String fullPath () const
 
agx::String fullPath (const agx::Object *root) const
 
template<typename T >
T * getAutoScopedResource (const agx::Path &path)
 
template<typename T >
const T * getAutoScopedResource (const agx::Path &path) const
 
agx::ObjectgetAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::ObjectgetAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) const
 
agx::ObjectgetContext ()
 
template<typename T >
T * getContext ()
 
const agx::ObjectgetContext () const
 
template<typename T >
const T * getContext () const
 
agx::UInt32 getId () const
 
const agx::NamegetImplementationName () const
 
agx::ModelgetModel ()
 
const agx::ModelgetModel () const
 
const agx::NamegetName () const
 
agx::ObjectgetNextSibling ()
 
const agx::ObjectgetNextSibling () const
 
agx::Path getPath () const
 
agx::Path getPath (const agx::Object *root) const
 
template<typename T >
T * getResource (const agx::Path &path)
 
template<typename T >
const T * getResource (const agx::Path &path) const
 
agx::ObjectgetResource (const agx::Path &path, agx::Model *model=nullptr)
 
const agx::ObjectgetResource (const agx::Path &path, agx::Model *model=nullptr) const
 
virtual agx::ObjectgetResourceImpl (const agx::Path &path, agx::Model *model)
 
agx::ObjectgetRootContext ()
 
const agx::ObjectgetRootContext () const
 
bool hasListener (EventListener *listener)
 
bool hasParent (const agx::Object *node) const
 
bool isUnique () const
 
virtual void printSubtree () const
 
virtual void rebind ()
 
void removeListener (EventListener *listener)
 
virtual void save (TiXmlElement *) const
 
virtual void setContext (agx::Object *context)
 
void setId (UInt32 id)
 
void setModel (agx::Model *model)
 Set the object model (handled automatically).
 
void setName (const agx::Name &name)
 Set the name of the object.
 
virtual void snapshot (TiXmlNode *, const String &) const
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referencedoperator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Protected Types

using Flags = agx::BitState< StateFlags, agx::UInt32 >
 
enum  StateFlags : agx::UInt32 {
  OVERRIDE_RENDER_SETTINGS = 1 << 0 , SHOULD_RENDER_EMITTED_OBJECTS = 1 << 1 , FIXED_POSITION_DEPRECATED = 1 << 2 , FIXED_ROTATION_DEPRECATED = 1 << 3 ,
  FIXED_ROTATION_X = 1 << 4 , FIXED_ROTATION_Y = 1 << 5 , FIXED_ROTATION_Z = 1 << 6 , FIXED_POSITION_X = 1 << 7 ,
  FIXED_POSITION_Y = 1 << 8 , FIXED_POSITION_Z = 1 << 9
}
 

Protected Member Functions

virtual ~DistributionModel ()
 
virtual ~DistributionTable ()
 
virtual ~Emitter ()
 Default destructor.
 
virtual agx::Real calculateMass ()=0
 
virtual agx::Real calculateVolume ()=0
 
virtual void emitBody (const Vec3 &position, const Quat &rotation, const Vec3 &velocity, Emitter::DistributionModel *model)=0
 
agx::Real generateRandomNumber ()
 
virtual Real getDefaultElementQuantity (Quantity quantity)
 
virtual void postEmit ()=0
 
virtual bool preEmit ()=0
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual void run () override
 Execution callback.
 
void setEmittedCount (agx::UInt emittedCount)
 
void setEmittedQuantity (agx::Real quantity)
 
virtual void store (agxStream::OutputArchive &out) const override
 
virtual void store (agxStream::OutputArchive &out) const override
 
- Protected Member Functions inherited from agx::SerialTask
virtual ~SerialTask ()
 
- Protected Member Functions inherited from agx::Task
virtual ~Task ()
 
void connectToChild (Task *descendant)
 
void connectToParent (Task *ancestor)
 
void disconnectFromChild (Task *descendant)
 
void disconnectFromParent (Task *ancestor)
 
void dispatchBlocking (Thread *thread)
 
void enableCallback (agxData::Value *enable)
 
virtual ObjectgetResourceImpl (const Path &path, agx::Model *model) override
 
void init ()
 
virtual void parameterAddedCallback (Parameter *)
 
virtual void parameterRemovedCallback (Parameter *)
 
void prepareGlobalResultSorting (size_t numJobs)
 
void registerBufferReadersAndWriters ()
 
void setGroup (TaskGroup *group)
 
virtual void subtaskAddedCallback (Task *)
 
void unregisterBufferReadersAndWriters ()
 
void verifyParameters ()
 
- Protected Member Functions inherited from agx::Component
virtual ~Component ()
 
String expandAutoCompletionMatch (const String &query, const StringVector &matchingNames) const
 
void setDevice (Device *device)
 
- Protected Member Functions inherited from agx::Object
virtual ~Object ()
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Protected Attributes

agx::UInt m_activationCount
 
DistributionTablem_distribution
 
DistributionTableRef m_distributionTable
 
Physics::EmitterPtr m_entity
 
agx::Vec3 m_fixedPositionOffset
 
agx::Quat m_fixedRotationOffset
 
UniformRealGenerator m_generator
 
agxCollide::GeometryRef m_geometry
 
agx::Real m_mass
 
agx::Real m_probabilityWeight
 
agxCollide::GeometryRef m_proxySphere
 
Quantity m_quantity
 
agx::RangeReal m_range
 
Real m_rest
 
agxCollide::SpaceRef m_space
 
Flags m_state
 
ScalarParameterRef m_timestep
 
agx::Real m_volume
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Additional Inherited Members

- Static Public Member Functions inherited from agx::Task
static agx::ModelClassModel ()
 
static ProfilingMode getProfilingMode ()
 
static Taskload (const char *path, Device *device=CpuDevice::instance())
 
static Taskload (const Path &path, const Name &implementation, agx::ParameterBindingVector &parameterList, bool allowFormatPromotions, Device *device=CpuDevice::instance())
 
static Taskload (const Path &path, const Name &implementation, const agx::ParameterBindingVector &parameterList, Device *device=CpuDevice::instance())
 
static Taskload (const Path &path, const Name &implementation, Device *device=CpuDevice::instance())
 
static Taskload (const Path &path, Device *device=CpuDevice::instance())
 
static Taskload (const String &path, Device *device=CpuDevice::instance())
 
static Taskload (TiXmlElement *eTask, Device *device)
 
static void printParameterMatch (UInt32 parameterMatch)
 
static void setProfilingMode (ProfilingMode mode)
 
- Static Public Member Functions inherited from agx::Component
static Component_load (TiXmlElement *eComponent, Device *device)
 
static agx::ModelClassModel ()
 
static Componentload (const Path &path, const Name &implementation, Device *device, const Path &_namespace=Path())
 
static Componentload (const String &path, const Path &_namespace=Path())
 
static Componentload (const String &path, Device *device, const Path &_namespace=Path())
 
static Componentload (TiXmlElement *eComponent, Device *device)
 
- Static Public Member Functions inherited from agx::Object
static agx::ModelClassModel ()
 
static agx::String generateName (const agx::String &bindPath)
 
static const HashSet< Object * > & getActiveObjects ()
 
static bool getEnableRebind ()
 Should rebinding be allowed? Right now a global setting.
 
static Objectload (const String &path, Device *device, const String &type, const String &attribute, const String &value)
 
template<typename T >
static T * load (const String &path, Device *device, const String &type, const String &attribute, const String &value)
 
static Objectload (const String &path, Device *device, const String &type="", size_t instance=0)
 
template<typename T >
static T * load (const String &path, Device *device, const String &type="", size_t instance=0)
 
static void load (const String &path, Device *device, ObjectPtrVector &loadedObjects)
 
static Objectload (TiXmlElement *eObject, Device *device)
 
template<typename T >
static T * load (TiXmlElement *eObject, Device *device)
 
static TiXmlDocument openDocument (const String &path)
 
static void setEnableRebind (bool flag)
 Sets if rebinding of objects should be allowed (Right now a global setting).
 
- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 
- Public Attributes inherited from agx::Task
ParameterEvent addParameterEvent
 Triggered when a parameter is added.
 
ExecutionEvent completionEvent
 Triggered after the task has completed.
 
agxData::Val< BoolenableParameter
 Enable/disable the task, normally use setEnable/isEnabled instead.
 
ParameterEvent removeParameterEvent
 Triggered when a parameter is removed.
 
ExecutionEvent startEvent
 Triggered before the task begins.
 
- Public Attributes inherited from agx::Component
ObjectEvent addObjectEvent
 
ObjectEvent removeObjectEvent
 
- Static Protected Member Functions inherited from agx::Task
static void addConnection (Task *parent, Task *child)
 
static bool hasUnhandledException ()
 
static void removeConnection (Task *parent, Task *child)
 
static void signalUnhandledException ()
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandlergetDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 

Detailed Description

Spawns new bodys inside a given volume.

Definition at line 44 of file Emitter.h.

Member Typedef Documentation

◆ DistributionModelConstObserver

◆ DistributionModelConstRef

◆ DistributionModelObserver

◆ DistributionModelObserverVector

◆ DistributionModelPtrVector

◆ DistributionModelRef

◆ DistributionModelRefVector

◆ DistributionTableConstObserver

◆ DistributionTableConstRef

◆ DistributionTableObserver

◆ DistributionTableRef

◆ EmitterDataConstObserver

Definition at line 57 of file Emitter.h.

◆ EmitterDataConstRef

typedef agx::ref_ptr< const EmitterData > agx::Emitter::EmitterDataConstRef

Definition at line 57 of file Emitter.h.

◆ EmitterDataObserver

Definition at line 57 of file Emitter.h.

◆ EmitterDataRef

Definition at line 57 of file Emitter.h.

◆ Flags

using agx::Emitter::Flags = agx::BitState<StateFlags, agx::UInt32>
protected

Definition at line 334 of file Emitter.h.

Member Enumeration Documentation

◆ Quantity

Enumerator
QUANTITY_COUNT 
QUANTITY_VOLUME 
QUANTITY_MASS 

Definition at line 47 of file Emitter.h.

◆ StateFlags

Enumerator
OVERRIDE_RENDER_SETTINGS 
SHOULD_RENDER_EMITTED_OBJECTS 
FIXED_POSITION_DEPRECATED 
FIXED_ROTATION_DEPRECATED 
FIXED_ROTATION_X 
FIXED_ROTATION_Y 
FIXED_ROTATION_Z 
FIXED_POSITION_X 
FIXED_POSITION_Y 
FIXED_POSITION_Z 

Definition at line 321 of file Emitter.h.

Constructor & Destructor Documentation

◆ Emitter()

agx::Emitter::Emitter ( Quantity  quantity = QUANTITY_COUNT)

Create an emitter.

◆ ~Emitter()

virtual agx::Emitter::~Emitter ( )
protectedvirtual

Default destructor.

◆ ~DistributionModel()

virtual agx::Emitter::~DistributionModel ( )
protectedvirtual

◆ ~DistributionTable()

virtual agx::Emitter::~DistributionTable ( )
protectedvirtual

Member Function Documentation

◆ addCollisionGroup() [1/2]

void agx::Emitter::addCollisionGroup ( agx::UInt32  id)

Add the specified id to a vector of group id, this will make a bodies emitted from this emitter part of the group id.

By default a body emitted is not part of any group.

This can be used to partition the simulation where some groups cannot collide with other groups. Which groups that can collide or not is determined by Space and can be set using the method agxCollide::Space::setEnablePair(id1,id2);

◆ addCollisionGroup() [2/2]

void agx::Emitter::addCollisionGroup ( const agx::Name name)

◆ addModel()

void agx::Emitter::addModel ( DistributionModel model)

Add a particle model.

◆ calculateMass()

virtual agx::Real agx::Emitter::calculateMass ( )
protectedpure virtual

◆ calculateTotalWeight()

agx::Real agx::Emitter::calculateTotalWeight ( ) const
Returns
The total random probability weight of all models.

◆ calculateVolume()

virtual agx::Real agx::Emitter::calculateVolume ( )
protectedpure virtual

◆ DistributionModel() [1/2]

agx::Emitter::DistributionModel ( )

◆ DistributionModel() [2/2]

agx::Emitter::DistributionModel ( agx::Real  probabilityWeight)

◆ DistributionTable()

agx::Emitter::DistributionTable ( Quantity  quantity = QUANTITY_COUNT)

◆ emitBody()

virtual void agx::Emitter::emitBody ( const Vec3 position,
const Quat rotation,
const Vec3 velocity,
Emitter::DistributionModel model 
)
protectedpure virtual

◆ generateRandomNumber()

agx::Real agx::Emitter::generateRandomNumber ( )
protected

◆ getActivationCount()

agx::UInt agx::Emitter::getActivationCount ( ) const
Returns
The number of times this model was randomly chosen.

◆ getCollisionGroupSet()

agx::Physics::CollisionGroupSetPtr agx::Emitter::getCollisionGroupSet ( ) const
inline
Returns
a GroupSet with all the group id:s for the particle system

Definition at line 491 of file Emitter.h.

◆ getDefaultElementQuantity()

virtual Real agx::Emitter::getDefaultElementQuantity ( Quantity  quantity)
protectedvirtual

Reimplemented in agx::ParticleEmitter.

◆ getDistributionTable() [1/2]

DistributionTable * agx::Emitter::getDistributionTable ( )
Returns
The body distribution table. Can be nullptr.

◆ getDistributionTable() [2/2]

const DistributionTable * agx::Emitter::getDistributionTable ( ) const

◆ getEmittedQuantity()

agx::Real agx::Emitter::getEmittedQuantity ( ) const

Returns the quantity amount that this emitter has emitted.

◆ getEnableOverrideRenderSettings()

bool agx::Emitter::getEnableOverrideRenderSettings ( ) const
Returns
if the render settings of the emitted objects should be overriden. (Default: false)

◆ getEnableRenderEmittedObjects()

bool agx::Emitter::getEnableRenderEmittedObjects ( ) const
Returns
whenever the emitted objects should be rendered or not, if possible. REQUIRES that "getEnableOverrideRenderSettings" is true. (Default: true)

◆ getFixedPositionOffset()

agx::Vec3 agx::Emitter::getFixedPositionOffset ( ) const
Returns
the fixed position offset of the objects created from the emitter.

◆ getFixedRotationOffset()

agx::Quat agx::Emitter::getFixedRotationOffset ( ) const
Returns
the fixed rotation offset of the objects created from the emitter.

◆ getGeometry()

agxCollide::Geometry * agx::Emitter::getGeometry ( )

Definition at line 489 of file Emitter.h.

◆ getMass()

agx::Real agx::Emitter::getMass ( ) const

◆ getMaximumEmittedQuantity()

agx::Real agx::Emitter::getMaximumEmittedQuantity ( ) const

Get the maximum amount of quantity that this emitter is allowed to emit.

◆ getModels()

const DistributionModelRefVector & agx::Emitter::getModels ( ) const
Returns
the list of particle models.

◆ getName()

agx::String agx::Emitter::getName ( ) const

◆ getNumEmitted()

agx::UInt agx::Emitter::getNumEmitted ( ) const
Returns
the number of bodies that this emitter has emitted

◆ getProbabilityQuantity()

Quantity agx::Emitter::getProbabilityQuantity ( ) const
Returns
The probability quantity.

◆ getProbabilityWeight()

agx::Real agx::Emitter::getProbabilityWeight ( ) const
Returns
The random probability weight.

◆ getQuantity()

Quantity agx::Emitter::getQuantity ( ) const
Returns
The current emit quantity.

◆ getRandomModel()

DistributionModel * agx::Emitter::getRandomModel ( )
Returns
A random particle model, using the weighted probabilities.

◆ getRate()

Real agx::Emitter::getRate ( ) const
Returns
the rate by which this emitter spawns bodys

◆ getUseFixedPosition()

bool agx::Emitter::getUseFixedPosition ( agx::Int  axis = -1) const
Parameters
axis- Axis index. If negative, the method returns true only if all axes have a fixed position. Valid values: 0 = X, 1 = Y, 2 = Z (and negative).
Returns
true if a fixed position is used when creating objects from the emitter, false otherwise.

◆ getUseFixedRotation()

bool agx::Emitter::getUseFixedRotation ( agx::Int  axis = -1) const
Parameters
axis- Axis index. If negative, the method returns true only if all axes have a fixed rotation. Valid values: 0 = X, 1 = Y, 2 = Z (and negative).
Returns
true if fixed rotation is used when creating objects from the emitter, false otherwise.

◆ getVelocity()

const Vec3 & agx::Emitter::getVelocity ( ) const
Returns
the initial velocity (in local geometry coordinates) the spawned bodys should receive

◆ getVolume()

agx::Real agx::Emitter::getVolume ( ) const

◆ hasCollisionGroup() [1/2]

bool agx::Emitter::hasCollisionGroup ( agx::Name  id) const

Definition at line 498 of file Emitter.h.

References agxCollide::CollisionGroupManager::hasGroup().

◆ hasCollisionGroup() [2/2]

bool agx::Emitter::hasCollisionGroup ( agx::UInt32  id) const

This is performing a linear search among the group id for this Emitter.

Parameters
id- The group id we are looking for.
Returns
true if the Emitter has the group id

Definition at line 493 of file Emitter.h.

References agxCollide::CollisionGroupManager::hasGroup().

◆ postEmit()

virtual void agx::Emitter::postEmit ( )
protectedpure virtual

◆ preEmit()

virtual bool agx::Emitter::preEmit ( )
protectedpure virtual

◆ removeCollisionGroup() [1/2]

void agx::Emitter::removeCollisionGroup ( agx::UInt32  id)

Remove a group id from the vector of group ids.

Parameters
id- The group id to be removed

◆ removeCollisionGroup() [2/2]

void agx::Emitter::removeCollisionGroup ( const agx::Name name)

◆ restore() [1/2]

virtual void agx::Emitter::restore ( agxStream::InputArchive in)
overrideprotectedvirtual

◆ restore() [2/2]

virtual void agx::Emitter::restore ( agxStream::InputArchive in)
overrideprotectedvirtual

◆ run()

virtual void agx::Emitter::run ( )
overrideprotectedvirtual

Execution callback.

Override in subclass, only called if no dispatchCallback is registered.

Reimplemented from agx::SerialTask.

◆ setDistributionTable()

void agx::Emitter::setDistributionTable ( DistributionTable table)

Set a distribution table to be used for body attributes.

◆ setEmittedCount()

void agx::Emitter::setEmittedCount ( agx::UInt  emittedCount)
protected

◆ setEmittedQuantity()

void agx::Emitter::setEmittedQuantity ( agx::Real  quantity)
protected

◆ setEnableOverrideRenderSettings()

void agx::Emitter::setEnableOverrideRenderSettings ( bool  enable)

Sets whenever the render settings of emitted objects should be overriden.

Mostly relevant for the "setEnableRenderEmittedObjects" settings.

Parameters
enable- true if the the emitter should override emitted object render settings. (Default: false)

◆ setEnableRenderEmittedObjects()

void agx::Emitter::setEnableRenderEmittedObjects ( bool  enable)

Sets whenever the emitted objects should be rendered or not, if possible.

REQUIRES that getEnableOverrideRenderSettings is true.

Parameters
enable- whenever rendering should be enabled for spawned objects or not. (Default: true) note: The emitter uses the available render information on spawned objects to adjust this settings. It is the responsibility of Emitter child implementations to keep track and modify the render data for it's objects based on the flag data.

◆ setFixedPositionOffset()

void agx::Emitter::setFixedPositionOffset ( const agx::Vec3 fixedPositionOffset)

Set the fixed position offset of the objects created from the emitter.

Note
- getUseFixedPosition() must be true for this to be used.
Parameters
fixedPositionOffset- the fixed position offset from emitter center that should be used as the initial position of the created objects.

◆ setFixedRotationOffset()

void agx::Emitter::setFixedRotationOffset ( const agx::Quat fixedRotationOffset)

Set the fixed rotation offset of the objects created from the emitter.

Note
- getUseFixedRotation() must be true for this to be used.
Parameters
fixedRotationOffset- the fixed initial rotation that should be used on objects created from the emitter.

◆ setGeometry()

void agx::Emitter::setGeometry ( agxCollide::Geometry geometry)

Set the volume that bodies will be spawned inside.

◆ setMaximumEmittedQuantity()

void agx::Emitter::setMaximumEmittedQuantity ( const agx::Real  max)

Sets the maximum amount of objects that this emitter is allowed to emit.

QUANTITY_COUNT - max number of objects QUANTITY_VOLUME - max total volume of objects QUANTITY_MASS - max total mass of objects

◆ setName()

void agx::Emitter::setName ( const agx::String name)

Set emitter name.

◆ setProbabilityQuantity()

void agx::Emitter::setProbabilityQuantity ( Quantity  quantity)

Set The probability quantity.

◆ setProbabilityWeight()

void agx::Emitter::setProbabilityWeight ( agx::Real  weight)

Set the random probability weight.

◆ setQuantity()

void agx::Emitter::setQuantity ( Quantity  quantity)

Set the emitting quantity QUANTITY_COUNT - number of emitted objects QUANTITY_VOLUME - volume of emitted objects QUANTITY_MASS - mass of emitted objects.

◆ setRate()

void agx::Emitter::setRate ( Real  rate)

Set the rate in which the emitter emits objects, measured in the specified quantity QUANTITY_COUNT - number of objects / time unit QUANTITY_VOLUME - volume of objects / time unit QUANTITY_MASS - mass of objects / time unit.

◆ setSeed() [1/2]

void agx::Emitter::setSeed ( agx::UInt32  seed)

Set the seed of the random number generator in the distribution table.

◆ setSeed() [2/2]

void agx::Emitter::setSeed ( const agx::UInt32  seed)

Set the seed for the random number generator of the emitter.

◆ setUseFixedPosition()

void agx::Emitter::setUseFixedPosition ( bool  enable,
agx::Int  axis = -1 
)

Set if fixed position should be used on objects created from this emitter.

See also setFixedPositionOffset.

Parameters
enable- true if a fixed position should be used when creating objects from this emitter.
axis- Axis index to apply or remove the fixed position. If -1, all axes will be fixed or randomized. Valid values: 0 = X, 1 = Y, 2 = Z (or -1 to modify all).

◆ setUseFixedRotation()

void agx::Emitter::setUseFixedRotation ( bool  enable,
agx::Int  axis = -1 
)

Set if a fixed rotation should be used on objects created from this emitter.

The rotation may be fixed for all, none, or some of the axes. See also setFixedRotationOffset.

Parameters
enable- true if a fixed rotation should be used when creating objects from this emitter.
axis- Axis index to apply or remove the fixed rotation. If -1, all axes will be fixed or randomized. Valid values: 0 = X, 1 = Y, 2 = Z (or -1 to modify all).

◆ setVelocity()

void agx::Emitter::setVelocity ( const Vec3 velocity)

Set the initial velocity for the bodys when spawned, in local geometry coordinates.

Parameters
velocity- Initial velocity

◆ store() [1/2]

virtual void agx::Emitter::store ( agxStream::OutputArchive out) const
overrideprotectedvirtual

◆ store() [2/2]

virtual void agx::Emitter::store ( agxStream::OutputArchive out) const
overrideprotectedvirtual

Member Data Documentation

◆ m_activationCount

agx::UInt agx::Emitter::m_activationCount
protected

Definition at line 417 of file Emitter.h.

◆ m_distribution

DistributionTable* agx::Emitter::m_distribution
protected

Definition at line 415 of file Emitter.h.

◆ m_distributionTable

DistributionTableRef agx::Emitter::m_distributionTable
protected

Definition at line 350 of file Emitter.h.

◆ m_entity

Physics::EmitterPtr agx::Emitter::m_entity
protected

Definition at line 348 of file Emitter.h.

◆ m_fixedPositionOffset

agx::Vec3 agx::Emitter::m_fixedPositionOffset
protected

Definition at line 359 of file Emitter.h.

◆ m_fixedRotationOffset

agx::Quat agx::Emitter::m_fixedRotationOffset
protected

Definition at line 360 of file Emitter.h.

◆ m_generator

UniformRealGenerator agx::Emitter::m_generator
protected

Definition at line 357 of file Emitter.h.

◆ m_geometry

agxCollide::GeometryRef agx::Emitter::m_geometry
protected

Definition at line 351 of file Emitter.h.

◆ m_mass

agx::Real agx::Emitter::m_mass
protected

Definition at line 420 of file Emitter.h.

◆ m_probabilityWeight

agx::Real agx::Emitter::m_probabilityWeight
protected

Definition at line 416 of file Emitter.h.

◆ m_proxySphere

agxCollide::GeometryRef agx::Emitter::m_proxySphere
protected

Definition at line 352 of file Emitter.h.

◆ m_quantity

Quantity agx::Emitter::m_quantity
protected

Definition at line 362 of file Emitter.h.

◆ m_range

agx::RangeReal agx::Emitter::m_range
protected

Definition at line 418 of file Emitter.h.

◆ m_rest

Real agx::Emitter::m_rest
protected

Definition at line 363 of file Emitter.h.

◆ m_space

agxCollide::SpaceRef agx::Emitter::m_space
protected

Definition at line 353 of file Emitter.h.

◆ m_state

Flags agx::Emitter::m_state
protected

Definition at line 364 of file Emitter.h.

◆ m_timestep

ScalarParameterRef agx::Emitter::m_timestep
protected

Definition at line 354 of file Emitter.h.

◆ m_volume

agx::Real agx::Emitter::m_volume
protected

Definition at line 419 of file Emitter.h.


The documentation for this class was generated from the following file: