vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vrecko::EnvironmentObject Class Reference

#include <EnvironmentObject.h>

Inheritance diagram for vrecko::EnvironmentObject:
vrecko::BaseClass APDYNAMICART::PoA APDYNAMICART::PS_FacePlane APDYNAMICART::SimpleBox APDYNAMICART::Attractor APDYNAMICART::BrushStroke APDYNAMICART::HookObject APDYNAMICART::Hoop APDYNAMICART::PerlinLines APDYNAMICART::PolyhedraSculpture APDYNAMICART::JuliaAttractor APDYNAMICART::NullAttractor APDYNAMICART::OrdinaryAttractor APDYNAMICART::MotionTrail

Classes

struct  UserData
 Here are stored pointer to UserData and its type. More...
 

Public Types

enum  UserData_Type {
  UD_UNKNOWN = 0, UD_BOOL, UD_INT, UD_LONG_INT,
  UD_FLOAT, UD_DOUBLE, UD_STRING, UD_VEC2,
  UD_VEC3, UD_VEC4, UD_MATRIX, UD_QUAT,
  UD_POINTER, UD_USER
}
 Types of the UserData. More...
 
- Public Types inherited from vrecko::BaseClass
enum  NotificationTypes {
  NOTIFICATION_DELETE_CLASS = 1, NOTIFICATION_EO_REGISTERING = 2, NOTIFICATION_EO_UNREGISTERING = 4, NOTIFICATION_PROGRAM_TERMINATION = 8,
  NOTIFICATION_ALL = 0xFFFFFFFF
}
 

Public Member Functions

 EnvironmentObject ()
 
 ~EnvironmentObject ()
 
 EnvironmentObject (EnvironmentObject &eo)
 
virtual bool initialize (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parameters=NULL)
 Core initialization. More...
 
void setID (unsigned long new_id)
 Set the ID of the object. More...
 
const unsigned long getID () const
 Returns the ID of the object. More...
 
void setName (const std::string &n)
 Sets the name of the object. More...
 
const std::string & getName (void) const
 Returns the name of the object. More...
 
bool loadGeometry (const char *filename, bool bOutputErrors=true)
 Loads geometry (usually a 3D model) from a file. More...
 
bool setGeometry (osg::Geode *new_geomtetry, long int k=1, long int l=100000)
 Adds a new geometry to the EO. More...
 
void setModelFileName (const std::string mfn)
 Sets the filename for the model. More...
 
const std::string & getModelFileName (void) const
 Returns the model filename. More...
 
bool addAbility (Ability *ability, bool bCreateNewIdIfColliding=true)
 Adds an ability to the EO. Use World::createAbility() instead. More...
 
bool removeAbility (Ability *pAbility)
 Remove ability from the EO, but DO NOT deallocate it. WARNING - Currently it is not sure if this method is safe to use. More...
 
bool removeAbility (const std::string &ability_id)
 Remove ability from the EO, but DO NOT deallocate it. WARNING - Currently it is not sure if this method is safe to use. More...
 
bool removeAllAbilities ()
 "Unregisters" and deallocates all abilities of an object. More...
 
AbilitygetAbility (const std::string &ab_id)
 Returns ability with a specified ID. More...
 
AbilitygetAbility (const std::string &pluginName, const std::string &abilityName)
 Returns ability of a given type. More...
 
AbilitygetAbilityWithInput (const std::string &input_name)
 Returns ability with a given input. More...
 
AbilitygetAbilityWithOutput (const std::string &output_name)
 Returns ability with a given output. More...
 
std::map< std::string, Ability * > & getAbilityMap (void)
 Returns map of the abilities in the EO. More...
 
osg::Matrix & getWorldTransformation (void)
 Returns the transformation matrix of the EO in world coordinate system. More...
 
osg::Vec3 getWorldPosition (void)
 Returns just the position (translation) in the world coordinates. More...
 
osg::Matrix getWorldRotation (void)
 Returns the rotation of the EO in world coordinates. More...
 
void setIdentityTransformation (void)
 BECOMING OBSOLETE - Please use the setMatrix() method instead. Sets the identity transformation. More...
 
void setPosition (const osg::Vec3 &coords)
 BECOMING OBSOLETE - Please use the setMatrix() method instead. Sets the position of the EO. More...
 
void setPosition (float x, float y, float z)
 BECOMING OBSOLETE - Please use the setMatrix() method instead. More...
 
osg::Vec3 & getPosition ()
 BECOMING OBSOLETE - Please use the getMatrix() method instead. Returns the position of the EO. More...
 
void setRotation (float angle, float x, float y, float z)
 BECOMING OBSOLETE - Please use the setMatrix() method instead. Set rotation of the EO. More...
 
void setRotation (const osg::Vec3 &angles)
 BECOMING OBSOLETE - Please use the setMatrix() method instead. More...
 
void setRotation (const osg::Matrix &new_matrix)
 BECOMING OBSOLETE - Please use the setMatrix() method instead. More...
 
void setRotation (const osg::Quat &quat)
 BECOMING OBSOLETE - Please use the setMatrix() method instead. More...
 
osg::Matrix & getRotation (void)
 BECOMING OBSOLETE - Please use the getMatrix() method instead. Return the rotation matrix. More...
 
void setScale (const osg::Vec3 &new_scale)
 BECOMING OBSOLETE - Please use the setMatrix() method instead. More...
 
void setScale (float x, float y, float z)
 BECOMING OBSOLETE - Please use the setMatrix() method instead. More...
 
osg::Vec3 & getScale (void)
 BECOMING OBSOLETE - Please use the getMatrix() method instead. More...
 
void setOSGAdapter (std::vector< esg::OSGAdapter * > new_osga)
 (OBSOLETE) Sets the vector of OSGAdapters. Currently not useful. More...
 
std::vector< esg::OSGAdapter * > * getOSGAdapter (void)
 (OBSOLETE) Returns the vector of OSGAdapters. Currently not useful. More...
 
EnvironmentObjectgetParentEO (void)
 Return the nearest parental EO from the scene hierarchy. More...
 
bool addEOChild (EnvironmentObject *new_EO)
 Add EnvironmentObject child. More...
 
bool removeEOChild (EnvironmentObject *new_EO)
 Removes and EO from the current object. More...
 
void addUserData (const std::string &nlabel, void *npointer, UserData_Type ntype)
 Adds an user data with a label. If old data with the same name exists, it will be dallocated. More...
 
bool removeUserData (const std::string &label)
 Removes an user data with the label. DOES NOT DEALLOCATE THE DATA. More...
 
UserDatagetUserData (const std::string &label)
 Returns an user data with given label. More...
 
std::map< std::string, UserData * > getUserDataMap (void)
 Returns an user data map. More...
 
void setTransparency (float transp)
 Sets the transparency in interval <0;1> More...
 
float getTransparency (void)
 Returns the current transparency. More...
 
void show ()
 Make the object visible after hiding it with hide(). More...
 
void hide ()
 Hides the object. More...
 
bool isVisible ()
 Returns true if the object is current visible (use hide() / show() methods to change the visibility). More...
 
bool isCollisionFree ()
 Returns true if the object has some geometry loaded. More...
 
void setCastShadows (bool cast)
 Set whether the objects should cast shadows or not. More...
 
- Public Member Functions inherited from vrecko::BaseClass
 BaseClass (const char *startingSenderString)
 The main constructor. More...
 
 BaseClass (BaseClass &bc)
 Copy constructor. Probably not really used. More...
 
virtual ~BaseClass ()
 Destructor. More...
 
virtual bool initializeFromString (const char *xmlString)
 Helper method that allows to initialize ability from a XML-formatted string. More...
 
virtual void update (void)
 This method is called periodically in case this instance is registered in Scheduler. More...
 
virtual
XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode
saveXMLParameters (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *)
 Save current setting into a XML node. More...
 
bool inputPresent (const std::string &name)
 Returns true if input pin (not request inputpin ) with given name is present. More...
 
bool outputPresent (const std::string &name)
 Returns true if output pin (not request output pin) with given name is present. More...
 
void addInputPin (InputPinBase *pin)
 Adds an input pin. More...
 
void removeInputPin (InputPinBase *pin)
 Removes an input pin. More...
 
void addOutputPin (OutputPinBase *pin)
 Adds an output pin. More...
 
void removeOutputPin (OutputPinBase *pin)
 Removes and output pin. More...
 
void addRequestInputPin (RequestInputPinBase *pin)
 Adds a request input pin. More...
 
void removeRequestInputPin (RequestInputPinBase *pin)
 Removes a request input pin. More...
 
void addRequestOutputPin (RequestOutputPinBase *pin)
 Adds a request output pin. More...
 
void removeRequestOutputPin (RequestOutputPinBase *pin)
 Removes a request output pin. More...
 
bool addNotification (BaseClass *receiver, unsigned long notificationTypes)
 Registers an observer that will be notified if a specific change occurs. More...
 
bool removeNotification (BaseClass *receiver, unsigned long notificationTypes=NOTIFICATION_ALL)
 Unregisters a previously registered observer. More...
 
virtual void processEvent (const std::string &input_name, VreckoMessage *pMessage)
 Internal method for processing the events. More...
 
virtual VreckoMessageprocessRequest (const std::string &request_input_name, VreckoMessage *pMessage)
 Internal method for processing the requests. More...
 
virtual const std::string & getSenderString (void)
 Returns the sender (or receiver) identification string. More...
 
void reportError (const std::string &error)
 Print error message. More...
 
void setPriority (long int pr)
 Sets the priority. (Possible problems - read the full description for more info) More...
 
long int getPriority (void) const
 Returns current object priority. More...
 
void setAttribute (const std::string &attr_name, int attr_value)
 Sets an attribute value. More...
 
int getAttribute (const std::string &attr_name)
 Returns attribute value. More...
 
int getAttribute (const char *attr_name)
 Returns attribute value. More...
 
void deleteAttribute (const std::string &attr_name)
 Delete an attribute. More...
 
void setSceneFile (const std::string &sceneFileName)
 Set the name of the file this component was in (and possibly will be saved to). More...
 
const std::string & getSceneFile () const
 Get the name of the file this component was in. More...
 
virtual void preInitialize (void)
 OBSOLETE METHOD, kept for backwards compatibility. More...
 
virtual void postInitialize (void)
 OBSOLETE METHOD, kept for backwards compatibility. More...
 
virtual bool loadXMLParameters (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *)
 OBSOLETE METHOD, kept for backwards compatibility. More...
 
virtual bool loadXMLParameters (const char *xmlString)
 OBSOLETE METHOD, kept for backwards compatibility. More...
 
InputPinBasegetInputPin (const char *strName)
 Returns pointer to an input pin with specified name. More...
 
OutputPinBasegetOutputPin (const char *strName)
 Returns pointer to an output pin with specified name. More...
 
RequestInputPinBasegetRequestInputPin (const char *strName)
 Returns pointer to an request input pin with specified name. More...
 
RequestOutputPinBasegetRequestOutputPin (const char *strName)
 Returns pointer to an input pin with specified name. More...
 

Protected Member Functions

void updateNodeMask ()
 Solve visibility, shadows and other masks bits. More...
 
void createCollisionHierarchy (osg::Node *pNode)
 Create collision hierarchy. More...
 
void fixGeometryMirroring (const osg::Node *node)
 
void fixGeometryHelper (const osg::Node *node, bool bMirrored)
 Helper method for fixGeometryMirroring(). More...
 
void fixGeometryDrawableHelper (const osg::Drawable *draw, bool bMirrored)
 Helper method for fixGeometryMirroring(). More...
 
 DECLARE_INPUT (Position, MessageVec3)
 
 DECLARE_INPUT (Orientation, MessageQuat)
 
 DECLARE_INPUT (Location, MessageMatrix)
 
 DECLARE_INPUT (RelativePosition, MessageVec3)
 
 DECLARE_INPUT (RelativeOrientation, MessageQuat)
 
 DECLARE_INPUT (RelativeLocation, MessageMatrix)
 
- Protected Member Functions inherited from vrecko::BaseClass
bool sendNotifications (unsigned long notificationType, void *notificationData)
 
virtual int processNotification (BaseClass *sender, unsigned long notificationType, void *notificationData)
 Process an incoming notification. More...
 
IOPinBasefindPinInList (const char *strName, PinList *pinList)
 Internal method to find a given pin in a given list. More...
 

Protected Attributes

unsigned long id
 Identification number. More...
 
std::string name
 Name of the EO. More...
 
std::string modelFileName
 Filename of the geometry. More...
 
AbilityDispatcher ability_dispatcher
 Internal AbilityDispatcher that serve to maintain abilities in EO. More...
 
osg::Matrix tempTransformMatrix
 
osg::Vec3 trans_vec
 Translation vector. More...
 
osg::Matrix rotation_matrix
 Rotation matrix. More...
 
osg::Vec3 scale_vec
 Scale vector. More...
 
float transparency
 Transparency of geometry. More...
 
bool bVisible
 
bool bCollisionFree
 
std::vector< esg::OSGAdapter * > osgadapter_vector
 Vector of the OSGAdapters. More...
 
std::map< std::string, UserData * > user_data
 User data map. More...
 
- Protected Attributes inherited from vrecko::BaseClass
AttributeMap attribute
 
MTReadWriteLock attributeLock
 
std::string senderString
 
MTLock notificationsLock
 
std::vector
< NOTIFICATION_DESCRIPTION
notifications
 
long int priority
 
const std::string * sceneFile
 
PinList inputPinsList
 
PinList outputPinsList
 
PinList requestInputPinsList
 
PinList requestOutputPinsList
 

Friends

class World
 

Additional Inherited Members

- Protected Types inherited from vrecko::BaseClass
typedef std::map< std::string,
int > 
AttributeMap
 Attributes. More...
 
typedef std::vector
< osg::ref_ptr< IOPinBase > > 
PinList
 

Member Enumeration Documentation

Types of the UserData.

Enumerator
UD_UNKNOWN 
UD_BOOL 
UD_INT 
UD_LONG_INT 
UD_FLOAT 
UD_DOUBLE 
UD_STRING 
UD_VEC2 
UD_VEC3 
UD_VEC4 
UD_MATRIX 
UD_QUAT 
UD_POINTER 
UD_USER 

Constructor & Destructor Documentation

EnvironmentObject::EnvironmentObject ( )
EnvironmentObject::~EnvironmentObject ( )
EnvironmentObject::EnvironmentObject ( EnvironmentObject eo)

Member Function Documentation

bool EnvironmentObject::addAbility ( Ability ability,
bool  bCreateNewIdIfColliding = true 
)

Adds an ability to the EO. Use World::createAbility() instead.

Generally this method won't be used directly.

TODO (General core problem): Nowadays, it is not problem yet, but it might be someday in a multi-threaded app (think Phantom): The ability is firstly assigned to an object and THEN initialized (initialize()). If any other thread asks for this ability in the meantime, it will receive the pointer and might try to use the ability, before it is initialized.

Parameters
ability(Ability *)
bCreateNewIdIfColliding(bool)
Returns
(bool)
bool EnvironmentObject::addEOChild ( EnvironmentObject new_EO)

Add EnvironmentObject child.

Adds and EO to this EO as its child.

Simply adds it between its children and registers the EO to the Scene, so the Scene knows about the EO and can send messages to it.

If you would like to add an EO as a children to a non-EO object, this is also possible, but you have to call EnvironmentObject::addChild() and Scene::registerEnvironmentObject().

Upon deletion, you would have to call Scene::unregisterEnvironmentObject() and EnvironmentObect::removeChild().

Parameters
new_EO(EnvironmentObject *)
Returns
(bool)
void EnvironmentObject::addUserData ( const std::string &  nlabel,
void *  npointer,
UserData_Type  ntype 
)

Adds an user data with a label. If old data with the same name exists, it will be dallocated.

Not a recommended way, but still working. This is an alternative to using simple attributes via setAttribute() method, though much more low-level.

Parameters
nlabel(const std::string &)
npointer(void *)
ntype(UserData_Type)
Returns
(void)
void EnvironmentObject::createCollisionHierarchy ( osg::Node *  pNode)
protected

Create collision hierarchy.

vrecko::EnvironmentObject::DECLARE_INPUT ( Position  ,
MessageVec3   
)
protected
The first macro below is equivalent to this:
///     osg::ref_ptr<InputPin<MessageVec3>> inputPosition;
///     void onMessagePosition(MessageVec3 *message);
/// 
vrecko::EnvironmentObject::DECLARE_INPUT ( Orientation  ,
MessageQuat   
)
protected
vrecko::EnvironmentObject::DECLARE_INPUT ( Location  ,
MessageMatrix   
)
protected
vrecko::EnvironmentObject::DECLARE_INPUT ( RelativePosition  ,
MessageVec3   
)
protected
vrecko::EnvironmentObject::DECLARE_INPUT ( RelativeOrientation  ,
MessageQuat   
)
protected
vrecko::EnvironmentObject::DECLARE_INPUT ( RelativeLocation  ,
MessageMatrix   
)
protected
void EnvironmentObject::fixGeometryDrawableHelper ( const osg::Drawable *  draw,
bool  bMirrored 
)
protected

Helper method for fixGeometryMirroring().

void EnvironmentObject::fixGeometryHelper ( const osg::Node *  node,
bool  bMirrored 
)
protected

Helper method for fixGeometryMirroring().

void EnvironmentObject::fixGeometryMirroring ( const osg::Node *  node)
protected

Corrects the wrong triangle order of mirrored objects (problem with the Skoda Fabia model). Idea: Find transformation matrices which are mirrored and reverse order of triangles in sub-objects

Ability* vrecko::EnvironmentObject::getAbility ( const std::string &  ab_id)
inline

Returns ability with a specified ID.

Parameters
ab_id(const std::string &) ID to look for.
Returns
(Ability *) Pointer to an ability or NULL if not found.
Ability * EnvironmentObject::getAbility ( const std::string &  pluginName,
const std::string &  abilityName 
)

Returns ability of a given type.

Note: It is really the original ability name and plugin name that will be searched for. This is stored separately from the ID, so even if you set your own ID for ability, this search will still work.

Parameters
pluginName(const std::string &)
abilityName(const std::string &)
Returns
(Ability *) Pointer to the ability or NULL if not found.
std::map<std::string, Ability*>& vrecko::EnvironmentObject::getAbilityMap ( void  )
inline

Returns map of the abilities in the EO.

Note: In single-threaded environment, you can iterate through the map as you wish, but generally you should use this method at all in other than non-main thread. (If you don't know what is this comment talking about, you do no need to worry.)

Returns
(std::map<std::string, Ability*> &) Reference to the stored map of abilities.
Ability* vrecko::EnvironmentObject::getAbilityWithInput ( const std::string &  input_name)
inline

Returns ability with a given input.

Ability* vrecko::EnvironmentObject::getAbilityWithOutput ( const std::string &  output_name)
inline

Returns ability with a given output.

const unsigned long vrecko::EnvironmentObject::getID ( ) const
inline

Returns the ID of the object.

Returns
(const unsigned long) The ID.
const std::string& vrecko::EnvironmentObject::getModelFileName ( void  ) const
inline

Returns the model filename.

Returns
(const std::string &)
const std::string& vrecko::EnvironmentObject::getName ( void  ) const
inline

Returns the name of the object.

For details, see comments for the setName() method.

Returns
(const std::string&) The curent object name.
std::vector<esg::OSGAdapter *>* vrecko::EnvironmentObject::getOSGAdapter ( void  )
inline

(OBSOLETE) Returns the vector of OSGAdapters. Currently not useful.

This method was (probably) designed for interaction with the ESG collision detection system, which is not in use at this time (summer 2011).

Returns
(std::vector<esg::OSGAdapter *>*)
EnvironmentObject * EnvironmentObject::getParentEO ( void  )

Return the nearest parental EO from the scene hierarchy.

Please note that it might be not only the direct parent of this object, but also a node several levels far. This is a simple function that doesn't take instancing into account - it is always going through the parent(0), but one node can have several parents in the OSG hierarchy.

One EO with several parents could result in an undetermined situation - I don't know if it won't result into some kind of a problem (by Vit Kovalcik, one of the later core developers, summer 2011).

Returns
(EnvironmentObject*)
osg::Vec3 & EnvironmentObject::getPosition ( )

BECOMING OBSOLETE - Please use the getMatrix() method instead. Returns the position of the EO.

osg::Matrix& vrecko::EnvironmentObject::getRotation ( void  )
inline

BECOMING OBSOLETE - Please use the getMatrix() method instead. Return the rotation matrix.

osg::Vec3& vrecko::EnvironmentObject::getScale ( void  )
inline

BECOMING OBSOLETE - Please use the getMatrix() method instead.

float vrecko::EnvironmentObject::getTransparency ( void  )
inline

Returns the current transparency.

EnvironmentObject::UserData * EnvironmentObject::getUserData ( const std::string &  label)

Returns an user data with given label.

Not a recommended way, but still working. This is an alternative to using simple attributes via setAttribute() method, though much more low-level.

Parameters
label(const std::string &)
Returns
(UserData *)
std::map<std::string, UserData *> vrecko::EnvironmentObject::getUserDataMap ( void  )
inline

Returns an user data map.

Not a recommended way, but still working. This is an alternative to using simple attributes via setAttribute() method, though much more low-level.

Returns
(std::map<std::string, UserData *>)
osg::Vec3 EnvironmentObject::getWorldPosition ( void  )

Returns just the position (translation) in the world coordinates.

Better to use the getWorldTransformation() directly. Internally calls the getWorldTransformation() and just returns the translation (discards the rest of the data).

Returns
(osg::Vec3)
osg::Matrix EnvironmentObject::getWorldRotation ( void  )

Returns the rotation of the EO in world coordinates.

Better to use the getWorldTransformation() directly. Internally calls the getWorldTransformation() and just returns the rotation (discards the rest of the data).

Returns
(osg::Matrix)
osg::Matrix & EnvironmentObject::getWorldTransformation ( void  )

Returns the transformation matrix of the EO in world coordinate system.

The world transformation matrix is calculated from the object matrix and matrices of its parents, all the way up to the root.

The matrix is cached in the EO object itself and the reference to this cached copy is returned, so this is NOT THREAD SAFE. If you need to get or set object transformation in different threads, use the base::MTMatrixTransform ability. (MTMatrixTransform usage is simple, example can be found in vreckoDP_PHANToM library)

Returns
(osg::Matrix &)
void vrecko::EnvironmentObject::hide ( )
inline

Hides the object.

bool EnvironmentObject::initialize ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode parameters = NULL)
virtual

Core initialization.

It is important to place the initializing code here, because especially in the case of Abilities, this is the point when the ID and owner is known and we can react accordingly. (This information is unknown in the constructor.)

You will probably want to override this method. This method supersedes the original preInitialize() / loadXMLParameters() / postInitialize() methods, which are now obsolete, but for the sake of compatibility they are called from the initialize() if the method is not overridden. You can override it and forget about pre/postInitialize() or loadParameters() - it's now an old solution.

Parameters
parameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *) Pointer to a XML DOM node, might be NULL if no parameters were specified. The ability should initialize to default values in that case.
Returns
(bool) Returns true on success.

Reimplemented from vrecko::BaseClass.

bool vrecko::EnvironmentObject::isCollisionFree ( )
inline

Returns true if the object has some geometry loaded.

bool vrecko::EnvironmentObject::isVisible ( )
inline

Returns true if the object is current visible (use hide() / show() methods to change the visibility).

bool EnvironmentObject::loadGeometry ( const char *  filename,
bool  bOutputErrors = true 
)

Loads geometry (usually a 3D model) from a file.

The core method to fill the EnvironmentObject with 3D data. Additionally to loading, it supports automatic "persistent caching", i.e. the file will be loaded on the first time and then immediately saved into a binary OSG format, which is very fast to load. (The saved models reside in the "cache" directory) Next time the loadGeometry() method is called, the cache is checked and if the cached data matches the original file (some date & time check is performed), the cached version is loaded instead. If the original file is modified, the cached version is automatically deleted and created again.

See Manual, this section: http://decibel.fi.muni.cz/wiki/index.php/VRECKO_PersistentCaching for more detail

Parameters
filename(const char *) Name of the file to load.
Returns
(bool) True on success.
bool EnvironmentObject::removeAbility ( Ability pAbility)

Remove ability from the EO, but DO NOT deallocate it. WARNING - Currently it is not sure if this method is safe to use.

Warning
If you REALLY need to remove ability from an object (and attach it to another for example), please contact some core developer and ask if this is ok.
Parameters
pAbility(Ability *) Ability identified by the pointer.
Returns
(bool)
bool EnvironmentObject::removeAbility ( const std::string &  ability_id)

Remove ability from the EO, but DO NOT deallocate it. WARNING - Currently it is not sure if this method is safe to use.

Warning
If you REALLY need to remove ability from an object (and attach it to another for example), please contact some core developer and ask if this is ok.
Parameters
ability_id(const std::string &) Ability identified by its ID.
Returns
(bool)
bool vrecko::EnvironmentObject::removeAllAbilities ( )
inline

"Unregisters" and deallocates all abilities of an object.

Returns
(bool) True on success.
bool EnvironmentObject::removeEOChild ( EnvironmentObject new_EO)

Removes and EO from the current object.

Must be used instead of simple removeChild(), because removeEOChild() also unregisters object from the Scene.

Parameters
new_EO(EnvironmentObject *)
Returns
(bool)
bool EnvironmentObject::removeUserData ( const std::string &  label)

Removes an user data with the label. DOES NOT DEALLOCATE THE DATA.

Not a recommended way, but still working. This is an alternative to using simple attributes via setAttribute() method, though much more low-level.

Parameters
label(const std::string &)
void EnvironmentObject::setCastShadows ( bool  cast)

Set whether the objects should cast shadows or not.

bool EnvironmentObject::setGeometry ( osg::Geode *  new_geomtetry,
long int  k = 1,
long int  l = 100000 
)

Adds a new geometry to the EO.

Parameters
new_geomtetry(osg::Geode *)
k(long int) OBSOLETE, used previously for the collision hierarchy, which has been replaced.
l(long int) OBSOLETE, used previously for the collision hierarchy, which has been replaced.
Returns
(bool) True on success.
void EnvironmentObject::setID ( unsigned long  new_id)

Set the ID of the object.

You don't need to call the method, unique ID will be assigned automatically. However, you can set your own ID if you wish. Upon adding the EO into the Scene it will be checked if the ID is unique and if it is not the nearest higher unique ID will be used.

Parameters
new_id(unsigned long) The desired ID
Returns
(void)
void EnvironmentObject::setIdentityTransformation ( void  )

BECOMING OBSOLETE - Please use the setMatrix() method instead. Sets the identity transformation.

void vrecko::EnvironmentObject::setModelFileName ( const std::string  mfn)
inline

Sets the filename for the model.

Useful is you are generating a new model and want to save it afterwards.

Parameters
mfn(const std::string) New model file name.
Returns
(void)
void vrecko::EnvironmentObject::setName ( const std::string &  n)
inline

Sets the name of the object.

You can do it in runtime or in the XML configuration file, but it is not necessary for the system. (It might help you in debugging, for example.)

Parameters
n(const std::string &) The new name to be set.
Returns
(void)
void vrecko::EnvironmentObject::setOSGAdapter ( std::vector< esg::OSGAdapter * >  new_osga)
inline

(OBSOLETE) Sets the vector of OSGAdapters. Currently not useful.

This method was (probably) designed for interaction with the ESG collision detection system, which is not in use at this time (summer 2011).

Parameters
new_osga(std::vector<esg::OSGAdapter * >)
Returns
(void)
void EnvironmentObject::setPosition ( const osg::Vec3 &  coords)

BECOMING OBSOLETE - Please use the setMatrix() method instead. Sets the position of the EO.

void EnvironmentObject::setPosition ( float  x,
float  y,
float  z 
)

BECOMING OBSOLETE - Please use the setMatrix() method instead.

void EnvironmentObject::setRotation ( float  angle,
float  x,
float  y,
float  z 
)

BECOMING OBSOLETE - Please use the setMatrix() method instead. Set rotation of the EO.

void EnvironmentObject::setRotation ( const osg::Vec3 &  angles)

BECOMING OBSOLETE - Please use the setMatrix() method instead.

void EnvironmentObject::setRotation ( const osg::Matrix &  new_matrix)

BECOMING OBSOLETE - Please use the setMatrix() method instead.

void EnvironmentObject::setRotation ( const osg::Quat &  quat)

BECOMING OBSOLETE - Please use the setMatrix() method instead.

void EnvironmentObject::setScale ( const osg::Vec3 &  new_scale)

BECOMING OBSOLETE - Please use the setMatrix() method instead.

void EnvironmentObject::setScale ( float  x,
float  y,
float  z 
)

BECOMING OBSOLETE - Please use the setMatrix() method instead.

void EnvironmentObject::setTransparency ( float  transp)

Sets the transparency in interval <0;1>

You can get much more effects if you create the ObjectUtils::ObjectEffect ability.

Parameters
transp(float) Transparency in the range 0.0 ... 1.0
Returns
(void)
void vrecko::EnvironmentObject::show ( )
inline

Make the object visible after hiding it with hide().

void EnvironmentObject::updateNodeMask ( )
protected

Solve visibility, shadows and other masks bits.

Friends And Related Function Documentation

friend class World
friend

Member Data Documentation

AbilityDispatcher vrecko::EnvironmentObject::ability_dispatcher
protected

Internal AbilityDispatcher that serve to maintain abilities in EO.

bool vrecko::EnvironmentObject::bCollisionFree
protected
bool vrecko::EnvironmentObject::bVisible
protected
unsigned long vrecko::EnvironmentObject::id
protected

Identification number.

std::string vrecko::EnvironmentObject::modelFileName
protected

Filename of the geometry.

std::string vrecko::EnvironmentObject::name
protected

Name of the EO.

std::vector<esg::OSGAdapter *> vrecko::EnvironmentObject::osgadapter_vector
protected

Vector of the OSGAdapters.

osg::Matrix vrecko::EnvironmentObject::rotation_matrix
protected

Rotation matrix.

osg::Vec3 vrecko::EnvironmentObject::scale_vec
protected

Scale vector.

osg::Matrix vrecko::EnvironmentObject::tempTransformMatrix
protected
osg::Vec3 vrecko::EnvironmentObject::trans_vec
protected

Translation vector.

float vrecko::EnvironmentObject::transparency
protected

Transparency of geometry.

std::map<std::string, UserData *> vrecko::EnvironmentObject::user_data
protected

User data map.


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