Atoms Crowd  7.0.0
Atoms::BehaviourModule Class Reference

Behaviour module. More...

#include <BehaviourModule.h>

Inheritance diagram for Atoms::BehaviourModule:
ArrowEmitterModule AtomsModules::AddForceModule AtomsModules::AddMetadataModule AtomsModules::AgentAvoidanceModule AtomsModules::AgentFilterModule AtomsModules::AgentRadiusOffsetModule AtomsModules::AgentScaleModule AtomsModules::AgentSeparationModule AtomsModules::AreaTriggerModule AtomsModules::BehaviourTreeModule AtomsModules::BlendShapeAnimModule AtomsModules::BlendShapeManagerModule AtomsModules::CacheReaderModule AtomsModules::ClipReaderModule AtomsModules::ContextSteeringModule AtomsModules::CopyMetadataModule AtomsModules::CurveFieldModule AtomsModules::CurveGeneratorModule AtomsModules::CurvePairGeneratorModule AtomsModules::DirectionCollector AtomsModules::DirectionFieldModule AtomsModules::FlockingModule AtomsModules::FollowAgentModule AtomsModules::FollowCurveModule AtomsModules::FollowMeshModule AtomsModules::FollowTargetModule AtomsModules::GridGeneratorModule AtomsModules::IkAimModule AtomsModules::InstanceModule AtomsModules::JointAimModule AtomsModules::JointConstraintModule AtomsModules::JointTransformModule AtomsModules::KillModule AtomsModules::LocalPositionOffsetModule AtomsModules::LocomotionModule AtomsModules::LodModule AtomsModules::MagnetFieldModule AtomsModules::MeshAvoidanceModule AtomsModules::MeshScatterLayout AtomsModules::MirrorModule AtomsModules::Navigation3dModule AtomsModules::NavigationModule AtomsModules::NetworkEditorModule AtomsModules::OffsetModule AtomsModules::ParentChildJointConstraintModule AtomsModules::ParentConstraintModule AtomsModules::PerchModule AtomsModules::PointFinderModule AtomsModules::PointsLayoutModule AtomsModules::ProjectDirectionOnUpPlane AtomsModules::ProximityMetadataModule AtomsModules::RagdollModule AtomsModules::ScriptModule AtomsModules::SphereLayoutModule AtomsModules::StadiumGeneratorModule AtomsModules::StateMachineModule AtomsModules::StatePickerModule AtomsModules::SyncModule AtomsModules::TargetCurveModule AtomsModules::TiltModule AtomsModules::TimerMetadataModule AtomsModules::TorusLayoutModule AtomsModules::UpVectorHandlerModule AtomsModules::UsdCacheReaderModule AtomsModules::VariationsModule AtomsModules::VelocityToState AtomsModules::VortexFieldModule AtomsModules::WaveModule

Public Types

enum  ProfileType {
  kInitSimulation = 0 , kPreFrame , kAgentsCreated , kInitFrame ,
  kEndFrame , kPrePhysics , kPostPhysics , kAgentsKilled ,
  kEndSimulation , kResetSimulation
}
 
enum  ModuleTpe { kNative = 0 , kScript = 1 }
 

Public Member Functions

 BehaviourModule ()
 Constructor.
 
virtual ~BehaviourModule ()
 Destructor.
 
virtual void agentsCreated (const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
 Agents Created. More...
 
virtual void agentsKilled (const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
 Post frame. More...
 
virtual void initSimulation (AgentGroup *agentGroup=nullptr)
 Init simulation. More...
 
virtual void preFrame (AgentGroup *agentGroup=nullptr)
 Pre frame. More...
 
virtual void initFrame (const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
 Init frame. More...
 
virtual void endFrame (const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
 End frame. More...
 
virtual void prePhysics (const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
 Pre Physics. More...
 
virtual void postPhysics (const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
 Post Physics. More...
 
virtual void endSimulation (const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
 End simulation. More...
 
virtual void resetSimulation (const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
 Reset simulation. More...
 
virtual void preDraw (DrawContext *context, const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
 Pre draw. More...
 
virtual void draw (DrawContext *context, const std::vector< Agent * > &agents, AgentGroup *agentGroup=nullptr)
 Draw. More...
 
virtual AtomsCore::MapMetadataattributes ()
 Returns the module attributes map.
 
virtual AtomsCore::MapMetadataattributeProperties ()
 Returns the module attribute properties map.
 
virtual const std::string & typeName () const
 Gets the module type name.
 
virtual void setTypeName (const std::string &typeName)
 Sets the module type name.
 
virtual void addAttribute (const std::string &attributeName, AtomsPtr< AtomsCore::Metadata > &metadata, bool perAgent=false)
 Add an attribute to the module, if the perAgent flag is set to true an extra attribute is added with the same name plus the "_override" suffix. This new attribute stores the agent overrides.
 
virtual void addAttribute (const std::string &attributeName, AtomsCore::Metadata *metadata, bool perAgent=false)
 
virtual void addAttributeProperty (const std::string &attributeName, const std::string &propertyName, AtomsPtr< AtomsCore::Metadata > &metadata)
 Add an attribute property to the module.
 
virtual void addAttributeProperty (const std::string &attributeName, const std::string &propertyName, AtomsCore::Metadata *metadata)
 
virtual bool removeAttribute (const std::string &attributeName)
 Removes an attribute from the module, this also removes the _override entry if present.
 
virtual void setEnabled (bool value)
 Set the enabled state for this module.
 
virtual bool isEnabled () const
 Gets the enabled state for this module.
 
void setSingleThread (bool value)
 Use single thread.
 
bool singleThread () const
 Return true if this module use a single thread.
 
virtual const std::string & name () const
 Gets the module name.
 
virtual void setName (const std::string &name)
 Sets the module name.
 
virtual void refreshAttributes ()
 Refresh the attribute map metadata.
 
virtual bool hasDynamicAttributes () const
 Check if this module can generate attribute dynamically.
 
template<typename T >
getAttributePerAgent (const T &defaultValue, AtomsCore::MapMetadata *overrideMap, const std::string &id)
 Utils to get per agent attributes.
 
template<typename T >
getAttributePerAgent (const T &defaultValue, AtomsCore::MapMetadata *overrideMap, const std::string &id, const AtomsCore::MapMetadata &agentMetadata, const std::string &metadataName)
 Utils to get per agent attributes.
 
size_t profileTime (unsigned short index) const
 Get profile time.
 
void setProfileTime (unsigned short index, size_t us)
 

Static Public Member Functions

static bool ignoreCurrentModule (Atoms::Agent *agent, const std::string &currentModuleName, const std::vector< std::string > &moduleNames, const std::string &metadataName)
 
static void enableCurrentActiveModuleMetadata (Atoms::Agent *agent, const std::string &currentModuleName, const std::string &metadataName, const bool enable)
 
static void initializeAngularVelocity (Atoms::Agent *agent)
 
static void setAngularVelocities (Atoms::Agent *agent, const AtomsCore::Vector3 &newDir, const AtomsCore::Vector3 &preMaxTurnAngleDir, const double fps)
 
static void setAngularVelocities (Atoms::Agent *agent, const double angularVelocity, const double frameAngularVelocity)
 

Detailed Description

Behaviour module.

The behaviour module adds logic to the agents contained by an agent group. It defines methods being called by the agent group during the simulation. Inside these methods it's possible to change data on the agents, i.e. adding node to the agent graph, modify metadata, modify the layout etc. This is the base class off all the modules used inside atoms to implement agent logic.

Member Function Documentation

◆ agentsCreated()

virtual void Atoms::BehaviourModule::agentsCreated ( const std::vector< Agent * > &  agents,
AgentGroup agentGroup = nullptr 
)
virtual

Agents Created.

Called after the layout generators and the pool finished to allocate the memory for the new agents. At this point it is possibe to modify the behaviour network, the pose and metadatas of the agents.

Reimplemented in AtomsModules::ScriptModule, AtomsModules::VelocityToState, AtomsModules::VariationsModule, AtomsModules::UsdCacheReaderModule, AtomsModules::TorusLayoutModule, AtomsModules::TiltModule, AtomsModules::TargetCurveModule, AtomsModules::SyncModule, AtomsModules::StateMachineModule, AtomsModules::StadiumGeneratorModule, AtomsModules::SphereLayoutModule, AtomsModules::RagdollModule, AtomsModules::PointsLayoutModule, AtomsModules::OffsetModule, AtomsModules::NetworkEditorModule, AtomsModules::NavigationModule, AtomsModules::Navigation3dModule, AtomsModules::MirrorModule, AtomsModules::MeshScatterLayout, AtomsModules::MeshAvoidanceModule, AtomsModules::LodModule, AtomsModules::LocomotionModule, AtomsModules::JointConstraintModule, AtomsModules::JointAimModule, AtomsModules::GridGeneratorModule, AtomsModules::FollowCurveModule, AtomsModules::FollowAgentModule, AtomsModules::DirectionCollector, AtomsModules::CurvePairGeneratorModule, AtomsModules::CurveGeneratorModule, AtomsModules::CopyMetadataModule, AtomsModules::ClipReaderModule, AtomsModules::CacheReaderModule, AtomsModules::BlendShapeManagerModule, AtomsModules::BehaviourTreeModule, ArrowEmitterModule, AtomsModules::AgentScaleModule, AtomsModules::AgentRadiusOffsetModule, AtomsModules::AddMetadataModule, AtomsModules::ContextSteeringModule, AtomsModules::JointTransformModule, and AtomsModules::InstanceModule.

◆ agentsKilled()

virtual void Atoms::BehaviourModule::agentsKilled ( const std::vector< Agent * > &  agents,
AgentGroup agentGroup = nullptr 
)
virtual

Post frame.

Called after the post build pose of the other agents. This is the last point where the killed agents are accessible, the memory of those agents is cleaned straight afterward

Reimplemented in AtomsModules::ScriptModule, AtomsModules::NavigationModule, and AtomsModules::BehaviourTreeModule.

◆ draw()

◆ endFrame()

◆ endSimulation()

virtual void Atoms::BehaviourModule::endSimulation ( const std::vector< Agent * > &  agents,
AgentGroup agentGroup = nullptr 
)
virtual

End simulation.

Called at the end of the simulation

◆ initFrame()

virtual void Atoms::BehaviourModule::initFrame ( const std::vector< Agent * > &  agents,
AgentGroup agentGroup = nullptr 
)
virtual

Init frame.

Called at the beginning of each frame before the agent poses are computed

Reimplemented in AtomsModules::ScriptModule, AtomsModules::ContextSteeringModule, AtomsModules::WaveModule, AtomsModules::VortexFieldModule, AtomsModules::VelocityToState, AtomsModules::UsdCacheReaderModule, AtomsModules::UpVectorHandlerModule, AtomsModules::TimerMetadataModule, AtomsModules::TiltModule, AtomsModules::TargetCurveModule, AtomsModules::SyncModule, AtomsModules::StatePickerModule, AtomsModules::StateMachineModule, AtomsModules::RagdollModule, AtomsModules::ProximityMetadataModule, AtomsModules::PointFinderModule, AtomsModules::PerchModule, AtomsModules::ParentConstraintModule, AtomsModules::NetworkEditorModule, AtomsModules::NavigationModule, AtomsModules::Navigation3dModule, AtomsModules::MeshAvoidanceModule, AtomsModules::MagnetFieldModule, AtomsModules::KillModule, AtomsModules::JointConstraintModule, AtomsModules::JointAimModule, AtomsModules::FollowTargetModule, AtomsModules::FollowMeshModule, AtomsModules::FollowCurveModule, AtomsModules::FollowAgentModule, AtomsModules::FlockingModule, AtomsModules::DirectionCollector, AtomsModules::CopyMetadataModule, AtomsModules::ClipReaderModule, AtomsModules::CacheReaderModule, AtomsModules::BlendShapeManagerModule, AtomsModules::BlendShapeAnimModule, AtomsModules::BehaviourTreeModule, ArrowEmitterModule, AtomsModules::AreaTriggerModule, AtomsModules::AgentSeparationModule, AtomsModules::AgentScaleModule, AtomsModules::AgentAvoidanceModule, AtomsModules::AddMetadataModule, AtomsModules::AddForceModule, AtomsModules::LocalPositionOffsetModule, AtomsModules::JointTransformModule, AtomsModules::InstanceModule, AtomsModules::DirectionFieldModule, and AtomsModules::CurveFieldModule.

◆ initSimulation()

◆ postPhysics()

virtual void Atoms::BehaviourModule::postPhysics ( const std::vector< Agent * > &  agents,
AgentGroup agentGroup = nullptr 
)
virtual

Post Physics.

Called after step physx

Reimplemented in AtomsModules::RagdollModule, AtomsModules::CopyMetadataModule, and AtomsModules::BehaviourTreeModule.

◆ preDraw()

virtual void Atoms::BehaviourModule::preDraw ( DrawContext context,
const std::vector< Agent * > &  agents,
AgentGroup agentGroup = nullptr 
)
virtual

Pre draw.

Called before the draw function Get here all the data that you need form the DCC application

Reimplemented in AtomsModules::ProximityMetadataModule, AtomsModules::MeshAvoidanceModule, AtomsModules::FollowAgentModule, AtomsModules::AgentSeparationModule, and AtomsModules::AgentAvoidanceModule.

◆ preFrame()

◆ prePhysics()

virtual void Atoms::BehaviourModule::prePhysics ( const std::vector< Agent * > &  agents,
AgentGroup agentGroup = nullptr 
)
virtual

Pre Physics.

Called before step physx

Reimplemented in AtomsModules::CopyMetadataModule, and AtomsModules::BehaviourTreeModule.

◆ resetSimulation()

virtual void Atoms::BehaviourModule::resetSimulation ( const std::vector< Agent * > &  agents,
AgentGroup agentGroup = nullptr 
)
virtual

Reset simulation.

Called after each reset


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