File SceneNodeWrapper.h

namespace Gsage
class SceneNodeWrapper : public Gsage::OgreObject, public EventSubscriber<SceneNodeWrapper>

Public Functions

SceneNodeWrapper()
virtual ~SceneNodeWrapper()
bool initialize(OgreObjectManager *objectManager, const DataProxy &dict, const std::string &ownerId, const std::string &type, Ogre::SceneManager *sceneManager, Ogre::SceneNode *parent)

Initialize element from the node with values

Parameters
  • factory: OgreObjectManager to enable child class creation

  • dict: DataProxy with values

  • type: String type of the object

  • parent: Parent SceneNode

  • sceneManager: SceneManager to use

  • ownerId: Id of entity that owns the element

bool hasNode()

Check that node has Ogre node created

void createNode(const std::string &id)

Create Ogre::SceneNode with the specified if

Parameters
  • id: Node id

const std::string &getId() const

Get node id

void setPosition(const Ogre::Vector3 &position)

Set node position with defined offset

Parameters
  • position: Ogre::Vector3 position

void setPositionWithoutOffset(const Ogre::Vector3 &position)

Set node position without defined offset

Parameters
  • position: Ogre::Vector3 position

Ogre::Vector3 getPosition()

Get node position

Ogre::Vector3 getPositionWithoutOffset()

Get node position without correction that is defined in offset field

void setScale(const Ogre::Vector3 &scale)

Set SceneNode scale

Parameters
  • scale: Ogre::Vector3 scale in all dimensions

Ogre::Vector3 getScale()

Get node scale

void setOrientation(const Ogre::Quaternion &rotation)

Set node orientation

Parameters
  • rotation: Orientation quaternion

Ogre::Quaternion getOrientation()

Get node orientation

void readChildren(const DataProxy &dict)
DataProxy writeChildren()
void setOrientationVector(const Ogre::Vector3 &value)

Set vector that defines “face” of the node

Parameters
  • value: Ogre::Vector3 normalized/not normalized vector (it is normalized anyway)

const Ogre::Vector3 &getOrientationVector() const

Get vector that defines “face” of the node

void rotate(const Ogre::Quaternion &rotation, const Ogre::Node::TransformSpace ts)

Rotate node

Parameters
  • rotation: Ogre::Quaternion that defines rotation

void rotate(const Ogre::Vector3 &axis, const Ogre::Degree &degree, const Ogre::Node::TransformSpace ts)

Rotate node

Parameters
  • axis: Axis to rotate around

  • degree: Rotation degree

  • ts: Transform space

void lookAt(const Ogre::Vector3 &position, Ogre::Node::TransformSpace relativeTo)

Rotate node to look at position

Parameters
  • position: Position to look at

  • relativeTo: Coordinate space to use

void destroy()

Remove all children and destroy node

bool attach(Ogre::MovableObject *object, const DataProxy &params)

Attach movable object to this object

Parameters
  • object: Object to attach

void destroyAllAttachedMovableObjects(Ogre::SceneNode *node)

Remove all attached movable objects from the node

Parameters
  • node: Node to process

OgreObject *getChild(const std::string &type, const std::string &name, bool traverse = false)

Get child

Parameters
  • type: Type of the child

  • name: Name, that was defined in the “name” field

  • traverse: Traverse children splitting name by .

template<class T>
T *getChildOfType(const std::string &name)

Get child of specific type

Parameters
  • type: Type of the child

  • name: Name, that was defined in the “name” field

IMovableObjectWrapper *getMovableObject(const std::string &type, const std::string &name)
void pitch(const Ogre::Radian &angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)

Rotate the node around X axis

Parameters
  • angle: Rotation angle

  • relativeTo: Transformation space

void yaw(const Ogre::Radian &angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)

Rotate the node around Y axis

Parameters
  • angle: Rotation angle

  • relativeTo: Transformation space

void roll(const Ogre::Radian &angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)

Rotate the node around Z axis

Parameters
  • angle: Rotation angle

  • relativeTo: Transformation space

void translate(const Ogre::Vector3 &d)

Moves the node along the Cartesian axes

Parameters
  • d: Vector with x,y,z values representing the translation

void translate(const Ogre::Vector3 &d, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL)

Moves the node along the Cartesian axes

Parameters
  • d: Vector with x,y,z values representing the translation

  • relativeTo: Transformation space

Ogre::SceneNode *getNode()

Get Ogre::SceneNode

Public Static Attributes

const std::string TYPE

Private Types

typedef std::map<const std::string, OgreObject *> ObjectCollection
typedef std::map<const std::string, ObjectCollection> Objects

Private Functions

bool onFactoryUnregister(EventDispatcher *sender, const Event &event)

Handle factory removal event

Parameters

Private Members

std::string mId
Ogre::Vector3 mOrientationVector
Ogre::SceneNode *mNode
Ogre::Vector3 mOffset
Objects mChildren