2
Copyright (c) 2008-2009 NetAllied Systems GmbH
4
This file is part of COLLADAFramework.
6
Licensed under the MIT Open Source License,
7
for details please see LICENSE file or the website
8
http://www.opensource.org/licenses/mit-license.php
11
#ifndef __COLLADAFW_NODE_H__
12
#define __COLLADAFW_NODE_H__
14
#include "COLLADAFWPrerequisites.h"
15
#include "COLLADAFWObject.h"
16
#include "COLLADAFWTransformation.h"
17
#include "COLLADAFWInstanceGeometry.h"
18
#include "COLLADAFWInstanceNode.h"
19
#include "COLLADAFWInstanceCamera.h"
20
#include "COLLADAFWInstanceLight.h"
21
#include "COLLADAFWInstanceController.h"
22
#include "COLLADAFWArrayPrimitiveType.h"
23
#include "COLLADAFWPointerArray.h"
25
#include "Math/COLLADABUMathVector3.h"
42
typedef ArrayPrimitiveType<Node*> NodeArray;
43
typedef PointerArray<Node> NodePointerArray;
45
class Node : public ObjectTemplate<COLLADA_TYPE::NODE>
58
* The original object id, if it in the original file format exist.
63
* The name attribute is the text string name of this element.
69
* The type of the <node> element. Valid values are JOINT or NODE. The default is
75
* The sid of the joint. Only relevant is mType is JOINT.
79
/** List of all transformations of the node. Array and contents will be delete in destructor.*/
80
TransformationPointerArray mTransformations;
82
/** List of all instance geometries of this node. Array and contents will be delete in destructor.*/
83
InstanceGeometryPointerArray mInstanceGeometries;
85
/** List of all instance nodes of this node. Array and contents will be delete in destructor.*/
86
InstanceNodePointerArray mInstanceNodes;
88
/** List of all instance cameras of this node. Array and contents will be delete in destructor.*/
89
InstanceCameraPointerArray mInstanceCameras;
91
/** List of all instance lights of this node. Array and contents will be delete in destructor.*/
92
InstanceLightPointerArray mInstanceLights;
94
/** List of all instance controller of this node. Array and contents will be delete in destructor.*/
95
InstanceControllerPointerArray mInstanceControllers;
97
/** List of all child nodes. Array and contents will be delete in destructor.*/
98
NodePointerArray mChildNodes;
102
/** Creates a node with object id @a objectId.*/
103
Node(const UniqueId& uniqueId);
108
* The original object id, if it in the original file format exist.
110
const String& getOriginalId () const { return mOriginalId; }
113
* The original object id, if it in the original file format exist.
115
void setOriginalId ( const String& val ) { mOriginalId = val; }
117
/** Returns the name of the node*/
118
const String& getName() const { return mName; }
120
/** Sets the name of the node*/
121
void setName(const String& name) { mName = name; }
123
/** Returns the sid of the joint. Only relevant when mType is JOINT. */
124
const String& getSid() const { return mSid; }
126
/** Sets the sid of the joint. Only relevant when mType is JOINT. */
127
void setSid(const String& sid) { mSid = sid; }
129
/** The type of the <node> element. Valid values are JOINT or NODE. The default is
131
const Node::NodeType getType () const { return mType; }
133
/** The type of the <node> element. Valid values are JOINT or NODE. The default is
135
void setType ( const Node::NodeType Type ) { mType = Type; }
137
/** Get list of all transformations of the node.*/
138
TransformationPointerArray& getTransformations() { return mTransformations; }
140
/** Get list of all transformations of the node.*/
141
const TransformationPointerArray& getTransformations() const { return mTransformations; }
143
/** List of all instance geometries of this node.*/
144
InstanceGeometryPointerArray& getInstanceGeometries() { return mInstanceGeometries; }
146
/** List of all instance geometries of this node.*/
147
const InstanceGeometryPointerArray& getInstanceGeometries() const { return mInstanceGeometries; }
149
/** List of all instance nodes of this node.*/
150
InstanceNodePointerArray& getInstanceNodes() { return mInstanceNodes; }
152
/** List of all instance nodes of this node.*/
153
const InstanceNodePointerArray& getInstanceNodes() const { return mInstanceNodes; }
155
/** List of all instance cameras of this camera.*/
156
InstanceCameraPointerArray& getInstanceCameras() { return mInstanceCameras; }
158
/** List of all instance cameras of this camera.*/
159
const InstanceCameraPointerArray& getInstanceCameras() const { return mInstanceCameras; }
161
/** List of all instance cameras of this camera.*/
162
InstanceLightPointerArray& getInstanceLights() { return mInstanceLights; }
164
/** List of all instance cameras of this camera.*/
165
const InstanceLightPointerArray& getInstanceLights() const { return mInstanceLights; }
167
/** List of all instance controller of this node. Array and contents will be delete in destructor.*/
168
InstanceControllerPointerArray& getInstanceControllers () { return mInstanceControllers; }
170
/** List of all instance controller of this node. Array and contents will be delete in destructor.*/
171
const InstanceControllerPointerArray& getInstanceControllers () const { return mInstanceControllers; }
173
/** Get list of all child nodes.*/
174
NodePointerArray& getChildNodes() { return mChildNodes; }
176
/** Get list of all child nodes.*/
177
const NodePointerArray& getChildNodes() const { return mChildNodes; }
179
/** Calculates a baked matrix, representing all the transformations.
180
@param transformationMatrix Will be set to the calculated node transformation matrix.*/
181
void getTransformationMatrix(COLLADABU::Math::Matrix4& transformationMatrix) const;
183
/** Calculates a baked matrix, representing all the transformations.
184
@return The calculated node transformation matrix. */
185
COLLADABU::Math::Matrix4 getTransformationMatrix() const;
187
/** Creates a clone of the node and returns a pointer to it.*/
188
Node* clone() const { return FW_NEW Node(*this); }
192
} // namespace COLLADAFW
194
#endif // __COLLADAFW_NODE_H__