10 #ifndef ENVIRONMENTOBJECT_H
11 #define ENVIRONMENTOBJECT_H
15 #include <osg/MatrixTransform>
25 #include <esg/Definitions.h>
27 #define SYSTEM_VISIBLE_OBJECT_TRAVERSAL_MASK 0x00000001
28 #define RECEIVES_SHADOW_TRAVERSAL_MASK 0x20
29 #define CASTS_SHADOW_TRAVERSAL_MASK 0x40
30 #define SYSTEM_TRAVERSAL_MASK__MASK (RECEIVES_SHADOW_TRAVERSAL_MASK | CASTS_SHADOW_TRAVERSAL_MASK)
55 virtual bool initialize(XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *parameters = NULL);
67 void setID(
unsigned long new_id);
75 inline const unsigned long getID()
const {
return id;}
86 void setName(
const std::string &n) {name = n;}
96 inline const std::string &
getName(
void)
const {
return name;}
115 bool loadGeometry(
const char *filename,
bool bOutputErrors =
true);
126 bool setGeometry(osg::Geode *new_geomtetry,
long int k = 1,
long int l = 100000);
160 bool addAbility(
Ability *ability,
bool bCreateNewIdIfColliding =
true);
171 bool removeAbility(
Ability *pAbility);
182 bool removeAbility(
const std::string &ability_id);
199 inline Ability *
getAbility(
const std::string &ab_id) {
return ability_dispatcher.getAbility(ab_id); }
212 Ability *getAbility(
const std::string &pluginName,
const std::string &abilityName);
230 std::map<std::string, Ability*> &
getAbilityMap(
void) {
return ability_dispatcher.getAbilityMap();}
246 osg::Matrix &getWorldTransformation(
void);
257 osg::Vec3 getWorldPosition(
void);
268 osg::Matrix getWorldRotation(
void);
271 void setIdentityTransformation(
void);
274 void setPosition(
const osg::Vec3 & coords );
277 void setPosition(
float x,
float y,
float z );
280 osg::Vec3 &getPosition();
283 void setRotation(
float angle,
float x,
float y,
float z);
286 void setRotation(
const osg::Vec3 & angles);
289 void setRotation(
const osg::Matrix & new_matrix);
292 void setRotation(
const osg::Quat & quat);
298 void setScale(
const osg::Vec3 &new_scale);
301 void setScale(
float x,
float y,
float z);
315 void setOSGAdapter(std::vector<esg::OSGAdapter *> new_osga) {osgadapter_vector = new_osga;}
325 std::vector<esg::OSGAdapter *>*
getOSGAdapter(
void) {
return &osgadapter_vector;}
417 void addUserData(
const std::string &nlabel,
void *npointer,
UserData_Type ntype);
428 bool removeUserData(
const std::string &label);
440 UserData *getUserData(
const std::string &label);
461 void setTransparency(
float transp);
467 inline void show() {bVisible =
true; updateNodeMask();}
470 inline void hide() {bVisible =
false; updateNodeMask();}
479 void setCastShadows(
bool cast);
523 void updateNodeMask();
526 void createCollisionHierarchy(osg::Node *pNode);
530 void fixGeometryMirroring(
const osg::Node *
node);
533 void fixGeometryHelper(
const osg::Node *
node,
bool bMirrored);
536 void fixGeometryDrawableHelper(
const osg::Drawable *draw,
bool bMirrored);