SceneComponent Class Reference

Component wrapper of Irrlicht's ISceneNode and base class of various scene components. More...

Inheritance diagram for SceneComponent:

Inheritance graph
[legend]
Collaboration diagram for SceneComponent:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SceneComponent (Entity *parent)
 Constructor (default).
 ~SceneComponent ()
 Deconstructor.
ISceneNode * getSceneNode ()
 Returns a direct pointer to the ISceneNode.
IMetaTriangleSelector * getMetaSelector () const
 Returns a direct pointer to the meta selector of this component.
ITriangleSelector * getTriangleSelector () const
 Returns a direct pointer to the triangle selector of this component.
void addAnimator (ISceneNodeAnimator *animator)
 Adds an scene node animator to the component.
void addCollisionResponseAnimator (const vector3df &ellipsoidRadius=vector3df(30, 60, 30), const vector3df &gravityPerSecond=vector3df(0,-10, 0), const vector3df &ellipsoidTranslation=vector3df(0, 0, 0), f32 slidingValue=0.0005f)
 Adds a collision response animator to the component.
void addFlyCircleAnimator (const vector3df &center=vector3df(0, 0, 0), f32 radius=100, f32 speed=0.001f, const vector3df &direction=vector3df(0, 0, 0))
 Adds a fly circle animator to the component.
void addFlyStraightAnimator (const vector3df &startPoint, const vector3df &endPoint, u32 timeForWay, bool loop=false)
 Adds a fly straight animator to the component.
void addToMetaSelector (Entity *entity)
 Searches for a SceneComponent within the given entity and if found adds the triangle selector of that component to the meta selector of this component.
void addToMetaSelector (SceneComponent *component)
 Adds the triangle selector of the given component to the meta selector of this component.
void addToMetaSelector (ITriangleSelector *selector)
 Adds the given triangle selector to the meta selector of this component.
vector3df getAbsolutePosition () const
 Gets the abolute position of the component.
E_CULLING_TYPE getAutomaticCulling () const
 Gets the automatic culling state.
virtual const aabbox3df & getBoundingBox () const
 Get the axis aligned, not transformed bounding box of this component.
u32 getMaterialCount () const
 Get amount of materials used by this component.
matrix4 getRelativeTransformation () const
 Returns the relative transformation of the component.
const vector3df getPosition () const
 Gets the relative position of the component.
const vector3df & getRotation () const
 Gets the rotation of the component.
const vector3df & getScale () const
 Gets the scale of the component.
void removeAnimators ()
 Removes all animators from this component.
void setAbsolutePosition (const vector3df &position)
 Sets the absolute position of the component.
void setAutomaticCulling (E_CULLING_TYPE state)
 Enables or disables automatic culling based on the bounding box.
void setCanAffectParent (bool value)
 Sets whether the component can affect the parent entity. A direct effect of enabling this option is that the position of the parent entity and this component will always be synchronised.
void setDebugDataVisible (s32 state)
 Sets if debug data like bounding boxes should be drawn.
void setMaterialFlag (E_MATERIAL_FLAG flag, bool value)
 Sets a material flag to a new value.
void setMaterialTexture (u32 layer, const std::string &fileName)
 Loads and sets the texture of the specified layer in all materials of this component to the new texture.
void setMaterialTexture (u32 layer, ITexture *texture)
 Sets the texture of the specified layer in all materials of this component to the new texture.
void setMaterialType (E_MATERIAL_TYPE type)
 Sets the material type of all materials in this component to a new material type.
void setPosition (const vector3df &position)
 Sets the relative position of the component.
virtual void setRotation (const vector3df &rotation)
 Sets the rotation of the component.
void setScale (const vector3df &scale)
 Sets the relative scale of the component.
void setVisible (bool value)
 Sets if the component should be visible or not.
void onPositionChange (void *p)
 Updates the position of the component after its parent has been updated.
void onRotationChange (void *p)
 Updates the rotation of the component after its parent has been updated.
void onUpdate (void *p)
 Updates the component if the parent is updated.
void onPause (void *p)
 Pauses the component if the parent is paused.
void onUnPause (void *p)
 Unpauses the component if the parent is paused.
void onTexture (void *p)
 Responds to changes of a texture attached to this component.

Static Public Member Functions

static bool parseXML (IXMLReader *file, Entity *entity)
 Parses for a SceneComponent.
static void parseBaseXML (IXMLReader *file, SceneComponent *component)
 Parses for the base elements of a SceneComponent.

Protected Member Functions

 SceneComponent (Entity *parent, bool isDerived)
 Constructor for derived classes.

Protected Attributes

ISceneNode * mSceneNode
IMetaTriangleSelector * mMetaSelector
ITriangleSelector * mTriSelector


Detailed Description

Component wrapper of Irrlicht's ISceneNode and base class of various scene components.

XML:

 <SceneComponent>
    <!-- Properties -->
 </SceneComponent>

Definition at line 33 of file SceneComponent.h.


Constructor & Destructor Documentation

SceneComponent::SceneComponent ( Entity parent  ) 

Constructor (default).

Definition at line 23 of file SceneComponent.cpp.

SceneComponent::~SceneComponent (  ) 

Deconstructor.

Definition at line 50 of file SceneComponent.cpp.

SceneComponent::SceneComponent ( Entity parent,
bool  isDerived 
) [protected]

Constructor for derived classes.

Definition at line 43 of file SceneComponent.cpp.


Member Function Documentation

void SceneComponent::addAnimator ( ISceneNodeAnimator *  animator  ) 

Adds an scene node animator to the component.

Parameters:
animator Pointer to the animator which should be added.
Note:
Don't forget to call SceneComponent::setCanAffectParent when you use an animator.

Definition at line 90 of file SceneComponent.cpp.

void SceneComponent::addCollisionResponseAnimator ( const vector3df &  ellipsoidRadius = vector3df(30, 60, 30),
const vector3df &  gravityPerSecond = vector3df(0, -10, 0),
const vector3df &  ellipsoidTranslation = vector3df(0, 0, 0),
f32  slidingValue = 0.0005f 
)

Adds a collision response animator to the component.

XML:

     <CollisionResponseAnimator>
        <ellipsoidRadius x="" y="" z="" />
        <gravityPerSecond x="" y="" z="" />
        <ellipsoidTranslation x="" y="" z="" />
        <slidingValue value="" />
     </CollisionResponseAnimator>

Parameters:
ellipsoidRadius Radius of the ellipsoid with which collision detection and response is done.
gravityPerSecond Sets the gravity of the environment, as an acceleration in units per second per second.
ellipsoidTranslation By default, the ellipsoid for collision detection is created around the center of the component, which means that the ellipsoid surrounds it completely. If this is not what you want, you may specify a translation for the ellipsoid.
slidingValue Sets the sliding value.
Note:
Don't forget to call SceneComponent::setCanAffectParent when you use an animator.

Definition at line 96 of file SceneComponent.cpp.

void SceneComponent::addFlyCircleAnimator ( const vector3df &  center = vector3df(0, 0, 0),
f32  radius = 100,
f32  speed = 0.001f,
const vector3df &  direction = vector3df(0, 0, 0) 
)

Adds a fly circle animator to the component.

XML:

     <FlyCircleAnimator>
        <center x="" y="" z="" />
        <radius value="" />
        <speed value="" />
        <direction x="" y="" z="" />
     </FlyCircleAnimator>

Parameters:
center Center of the circle.
radius Radius of the circle.
speed Specifies the speed of the flight.
direction Specifies the upvector used for alignment of the mesh.
Note:
Don't forget to call SceneComponent::setCanAffectParent when you use an animator.

Definition at line 111 of file SceneComponent.cpp.

void SceneComponent::addFlyStraightAnimator ( const vector3df &  startPoint,
const vector3df &  endPoint,
u32  timeForWay,
bool  loop = false 
)

Adds a fly straight animator to the component.

XML:

     <FlyStraightAnimator>
        <startPoint x="" y="" z="" />
        <endPoint x="" y="" z="" />
        <timeForWay value="" />
        <loop value="" />
     </FlyStraightAnimator>

Parameters:
startPoint Start point of the line.
endPoint End point of the line.
timeForWay Time in milliseconds how long the component should need to move from the start point to the end point.
loop If set to false, the component stops when the end point is reached. If loop is true, the component begins again at the start.
Note:
Don't forget to call SceneComponent::setCanAffectParent when you use an animator.

Definition at line 122 of file SceneComponent.cpp.

void SceneComponent::addToMetaSelector ( ITriangleSelector *  selector  ) 

Adds the given triangle selector to the meta selector of this component.

Parameters:
selector Pointer to the triangle selector that should be added.
Note:
Not available in AngelScript.

Definition at line 164 of file SceneComponent.cpp.

void SceneComponent::addToMetaSelector ( SceneComponent component  ) 

Adds the triangle selector of the given component to the meta selector of this component.

Parameters:
component Pointer to the component.

Definition at line 152 of file SceneComponent.cpp.

void SceneComponent::addToMetaSelector ( Entity entity  ) 

Searches for a SceneComponent within the given entity and if found adds the triangle selector of that component to the meta selector of this component.

Parameters:
entity Pointer to the entity.

Definition at line 134 of file SceneComponent.cpp.

vector3df SceneComponent::getAbsolutePosition (  )  const

Gets the abolute position of the component.

Definition at line 171 of file SceneComponent.cpp.

E_CULLING_TYPE SceneComponent::getAutomaticCulling (  )  const

Gets the automatic culling state.

Definition at line 177 of file SceneComponent.cpp.

const aabbox3df & SceneComponent::getBoundingBox (  )  const [virtual]

Get the axis aligned, not transformed bounding box of this component.

Reimplemented in TerrainComponent.

Definition at line 183 of file SceneComponent.cpp.

u32 SceneComponent::getMaterialCount (  )  const

Get amount of materials used by this component.

Definition at line 189 of file SceneComponent.cpp.

IMetaTriangleSelector * SceneComponent::getMetaSelector (  )  const

Returns a direct pointer to the meta selector of this component.

Note:
Not available in AngelScript.

Definition at line 78 of file SceneComponent.cpp.

const vector3df SceneComponent::getPosition (  )  const

Gets the relative position of the component.

Definition at line 201 of file SceneComponent.cpp.

matrix4 SceneComponent::getRelativeTransformation (  )  const

Returns the relative transformation of the component.

Definition at line 195 of file SceneComponent.cpp.

const vector3df & SceneComponent::getRotation (  )  const

Gets the rotation of the component.

Definition at line 207 of file SceneComponent.cpp.

const vector3df & SceneComponent::getScale (  )  const

Gets the scale of the component.

Definition at line 213 of file SceneComponent.cpp.

ISceneNode * SceneComponent::getSceneNode (  ) 

Returns a direct pointer to the ISceneNode.

Note:
Not available in AngelScript.

Definition at line 72 of file SceneComponent.cpp.

ITriangleSelector * SceneComponent::getTriangleSelector (  )  const

Returns a direct pointer to the triangle selector of this component.

Note:
Not available in AngelScript.

Definition at line 84 of file SceneComponent.cpp.

void SceneComponent::onPause ( void *  p  ) 

Pauses the component if the parent is paused.

Note:
For internal use only!

Definition at line 395 of file SceneComponent.cpp.

void SceneComponent::onPositionChange ( void *  p  ) 

Updates the position of the component after its parent has been updated.

Note:
For internal use only!

Definition at line 344 of file SceneComponent.cpp.

void SceneComponent::onRotationChange ( void *  p  ) 

Updates the rotation of the component after its parent has been updated.

Note:
For internal use only!

Definition at line 354 of file SceneComponent.cpp.

void SceneComponent::onTexture ( void *  p  ) 

Responds to changes of a texture attached to this component.

Note:
For internal use only!

Definition at line 412 of file SceneComponent.cpp.

void SceneComponent::onUnPause ( void *  p  ) 

Unpauses the component if the parent is paused.

Note:
For internal use only!

Definition at line 405 of file SceneComponent.cpp.

void SceneComponent::onUpdate ( void *  p  ) 

Updates the component if the parent is updated.

Note:
For internal use only!

Definition at line 364 of file SceneComponent.cpp.

void SceneComponent::parseBaseXML ( IXMLReader *  file,
SceneComponent component 
) [static]

Parses for the base elements of a SceneComponent.

Note:
For internal use only!

Definition at line 491 of file SceneComponent.cpp.

bool SceneComponent::parseXML ( IXMLReader *  file,
Entity entity 
) [static]

void SceneComponent::removeAnimators (  ) 

Removes all animators from this component.

Definition at line 219 of file SceneComponent.cpp.

void SceneComponent::setAbsolutePosition ( const vector3df &  position  ) 

Sets the absolute position of the component.

XML:

     <absolutePosition value="" />

Parameters:
position New absolute position of the component.

Definition at line 225 of file SceneComponent.cpp.

void SceneComponent::setAutomaticCulling ( E_CULLING_TYPE  state  ) 

Enables or disables automatic culling based on the bounding box.

XML:

     <automaticCulling value="" />

Parameters:
state The culling state to be used.

Definition at line 231 of file SceneComponent.cpp.

void SceneComponent::setCanAffectParent ( bool  value  ) 

Sets whether the component can affect the parent entity. A direct effect of enabling this option is that the position of the parent entity and this component will always be synchronised.

XML:

     <canAffectParent value="" />

Parameters:
value Value to enable or disable this function.
Note:
It's recommended to enable this option when you're using animators.

Definition at line 237 of file SceneComponent.cpp.

void SceneComponent::setDebugDataVisible ( s32  state  ) 

Sets if debug data like bounding boxes should be drawn.

Parameters:
state The debug data visibility state to be used.

Definition at line 243 of file SceneComponent.cpp.

void SceneComponent::setMaterialFlag ( E_MATERIAL_FLAG  flag,
bool  value 
)

Sets a material flag to a new value.

XML:

     <materialFlag flag="" value="" />

Parameters:
flag Which flag of all materials to be set.
value New value of that flag.

Definition at line 249 of file SceneComponent.cpp.

void SceneComponent::setMaterialTexture ( u32  layer,
ITexture *  texture 
)

Sets the texture of the specified layer in all materials of this component to the new texture.

Parameters:
layer Layer of texture to be set.
texture New texture to be used.
Note:
Not available in AngelScript.

Definition at line 292 of file SceneComponent.cpp.

void SceneComponent::setMaterialTexture ( u32  layer,
const std::string &  fileName 
)

Loads and sets the texture of the specified layer in all materials of this component to the new texture.

XML:

     <materialTexture layer="" fileName="" />

Parameters:
layer Layer of texture to be set.
fileName Filename of the texture to load.

Definition at line 256 of file SceneComponent.cpp.

void SceneComponent::setMaterialType ( E_MATERIAL_TYPE  type  ) 

Sets the material type of all materials in this component to a new material type.

XML:

     <materialType value="" />

Parameters:
type New type of material to be set.

Definition at line 313 of file SceneComponent.cpp.

void SceneComponent::setPosition ( const vector3df &  position  ) 

Sets the relative position of the component.

XML:

     <position x="" y="" z="" />

Parameters:
position New relative postition of the component.

Definition at line 319 of file SceneComponent.cpp.

void SceneComponent::setRotation ( const vector3df &  rotation  )  [virtual]

Sets the rotation of the component.

XML:

     <rotation x="" y="" z="" />

Parameters:
rotation New rotation of the component in degrees.

Reimplemented in CameraComponent.

Definition at line 325 of file SceneComponent.cpp.

void SceneComponent::setScale ( const vector3df &  scale  ) 

Sets the relative scale of the component.

XML:

     <scale x="" y="" z="" />

Parameters:
scale New scale of the node

Definition at line 331 of file SceneComponent.cpp.

void SceneComponent::setVisible ( bool  value  ) 

Sets if the component should be visible or not.

XML:

     <visible value="" />

Parameters:
value If the node shall be visible.

Definition at line 337 of file SceneComponent.cpp.


Member Data Documentation

IMetaTriangleSelector* SceneComponent::mMetaSelector [protected]

Definition at line 303 of file SceneComponent.h.

ISceneNode* SceneComponent::mSceneNode [protected]

Definition at line 302 of file SceneComponent.h.

ITriangleSelector* SceneComponent::mTriSelector [protected]

Definition at line 304 of file SceneComponent.h.


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

Generated on Fri Aug 21 23:55:16 2009 for Sirrf - Simple Irrlicht Framework by  doxygen 1.5.8