7 #ifndef POINTMASS3D_ENGINE_H
8 #define POINTMASS3D_ENGINE_H
11 class CPointMass3DEngine;
12 class CPointMass3DModel;
13 class CEmbodiedEntity;
16 #include <argos3/core/utility/math/ray2.h>
17 #include <argos3/core/simulator/entity/controllable_entity.h>
18 #include <argos3/core/simulator/physics_engine/physics_engine.h>
46 const CRay3& c_ray)
const;
53 return m_tPhysicsModels;
57 return m_tPhysicsModels;
67 std::map<std::string, CPointMass3DModel*> m_tPhysicsModels;
75 template <
typename ACTION>
91 #define REGISTER_POINTMASS3D_OPERATION(ACTION, OPERATION, ENTITY) \
92 REGISTER_ENTITY_OPERATION(ACTION, CPointMass3DEngine, OPERATION, SOperationOutcome, ENTITY);
94 #define REGISTER_STANDARD_POINTMASS3D_OPERATION_ADD_ENTITY(SPACE_ENTITY, PM3D_MODEL) \
95 class CPointMass3DOperationAdd ## SPACE_ENTITY : public CPointMass3DOperationAddEntity { \
97 CPointMass3DOperationAdd ## SPACE_ENTITY() {} \
98 virtual ~CPointMass3DOperationAdd ## SPACE_ENTITY() {} \
99 SOperationOutcome ApplyTo(CPointMass3DEngine& c_engine, \
100 SPACE_ENTITY& c_entity) { \
101 auto* pcPhysModel = new PM3D_MODEL(c_engine, \
103 c_engine.AddPhysicsModel(c_entity.GetId(), \
106 GetComponent<CEmbodiedEntity>("body"). \
107 AddPhysicsModel(c_engine.GetId(), *pcPhysModel); \
108 return SOperationOutcome(true); \
111 REGISTER_POINTMASS3D_OPERATION(CPointMass3DOperationAddEntity, \
112 CPointMass3DOperationAdd ## SPACE_ENTITY, \
115 #define REGISTER_STANDARD_POINTMASS3D_OPERATION_REMOVE_ENTITY(SPACE_ENTITY) \
116 class CPointMass3DOperationRemove ## SPACE_ENTITY : public CPointMass3DOperationRemoveEntity { \
118 CPointMass3DOperationRemove ## SPACE_ENTITY() {} \
119 virtual ~CPointMass3DOperationRemove ## SPACE_ENTITY() {} \
120 SOperationOutcome ApplyTo(CPointMass3DEngine& c_engine, \
121 SPACE_ENTITY& c_entity) { \
122 c_engine.RemovePhysicsModel(c_entity.GetId()); \
124 GetComponent<CEmbodiedEntity>("body"). \
125 RemovePhysicsModel(c_engine.GetId()); \
126 return SOperationOutcome(true); \
129 REGISTER_POINTMASS3D_OPERATION(CPointMass3DOperationRemoveEntity, \
130 CPointMass3DOperationRemove ## SPACE_ENTITY, \
133 #define REGISTER_STANDARD_POINTMASS3D_OPERATIONS_ON_ENTITY(SPACE_ENTITY, PM3D_ENTITY) \
134 REGISTER_STANDARD_POINTMASS3D_OPERATION_ADD_ENTITY(SPACE_ENTITY, PM3D_ENTITY) \
135 REGISTER_STANDARD_POINTMASS3D_OPERATION_REMOVE_ENTITY(SPACE_ENTITY)
float Real
Collects all ARGoS code.
The namespace containing all the ARGoS related code.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
std::vector< SEmbodiedEntityIntersectionItem > TEmbodiedEntityIntersectionData
std::map< std::string, CControllableEntity * > TMap
A map of controllable entities, indexed by id.
The basic operation to be stored in the vtable.
const std::map< std::string, CPointMass3DModel * > & GetPhysicsModels() const
virtual void CheckIntersectionWithRay(TEmbodiedEntityIntersectionData &t_data, const CRay3 &c_ray) const
Check which objects in this engine intersect the given ray.
virtual bool AddEntity(CEntity &c_entity)
Adds an entity to the physics engine.
virtual bool RemoveEntity(CEntity &c_entity)
Removes an entity from the physics engine.
virtual void Destroy()
Undoes whatever was done by Init().
virtual bool IsPointContained(const CVector3 &c_point)
Returns true if the given point is contained in this physics engine.
virtual bool IsEntityTransferNeeded() const
virtual ~CPointMass3DEngine()
virtual size_t GetNumPhysicsModels()
void AddPhysicsModel(const std::string &str_id, CPointMass3DModel &c_model)
virtual void TransferEntities()
Executes the transfer of entities to other engines.
virtual void Reset()
Resets the resource.
virtual void Init(TConfigurationNode &t_tree)
Initializes the resource.
void RemovePhysicsModel(const std::string &str_id)
std::map< std::string, CPointMass3DModel * > & GetPhysicsModels()
virtual ~CPointMass3DOperation()
virtual ~CPointMass3DOperationAddEntity()
virtual ~CPointMass3DOperationRemoveEntity()