~ubuntu-branches/ubuntu/wily/opencollada/wily-proposed

« back to all changes in this revision

Viewing changes to COLLADAFramework/include/COLLADAFWNode.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2015-05-14 17:23:27 UTC
  • Revision ID: package-import@ubuntu.com-20150514172327-f862u8envms01fra
Tags: upstream-0.1.0~20140703.ddf8f47+dfsg1
ImportĀ upstreamĀ versionĀ 0.1.0~20140703.ddf8f47+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) 2008-2009 NetAllied Systems GmbH
 
3
 
 
4
This file is part of COLLADAFramework.
 
5
 
 
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
 
9
*/
 
10
 
 
11
#ifndef __COLLADAFW_NODE_H__
 
12
#define __COLLADAFW_NODE_H__
 
13
 
 
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"
 
24
 
 
25
#include "Math/COLLADABUMathVector3.h"
 
26
 
 
27
 
 
28
namespace COLLADABU
 
29
{
 
30
    namespace Math
 
31
    {
 
32
        class Matrix4;
 
33
    }
 
34
}
 
35
 
 
36
 
 
37
namespace COLLADAFW
 
38
{
 
39
 
 
40
        class Node;
 
41
 
 
42
        typedef ArrayPrimitiveType<Node*> NodeArray;
 
43
        typedef PointerArray<Node> NodePointerArray;
 
44
 
 
45
        class Node : public ObjectTemplate<COLLADA_TYPE::NODE>
 
46
        {
 
47
    public:
 
48
        
 
49
        enum NodeType
 
50
        {
 
51
            NODE,
 
52
            JOINT
 
53
        };
 
54
 
 
55
        private:
 
56
 
 
57
        /**
 
58
        * The original object id, if it in the original file format exist. 
 
59
        */
 
60
        String mOriginalId;
 
61
 
 
62
                /**
 
63
                * The name attribute is the text string name of this element. 
 
64
                * Optional attribute.
 
65
                */
 
66
                String mName;
 
67
 
 
68
        /** 
 
69
         * The type of the <node> element. Valid values are JOINT or NODE. The default is 
 
70
         * NODE. Optional. 
 
71
         */
 
72
        NodeType mType;
 
73
        
 
74
        /**
 
75
         * The sid of the joint. Only relevant is mType is JOINT.
 
76
         */
 
77
        String mSid;
 
78
 
 
79
                /** List of all transformations of the node. Array and contents will be delete in destructor.*/
 
80
                TransformationPointerArray mTransformations;
 
81
 
 
82
                /** List of all instance geometries of this node. Array and contents will be delete in destructor.*/
 
83
                InstanceGeometryPointerArray mInstanceGeometries;
 
84
 
 
85
                /** List of all instance nodes of this node. Array and contents will be delete in destructor.*/
 
86
                InstanceNodePointerArray mInstanceNodes;
 
87
 
 
88
                /** List of all instance cameras of this node. Array and contents will be delete in destructor.*/
 
89
                InstanceCameraPointerArray mInstanceCameras;
 
90
 
 
91
                /** List of all instance lights of this node. Array and contents will be delete in destructor.*/
 
92
                InstanceLightPointerArray mInstanceLights;
 
93
 
 
94
        /** List of all instance controller of this node. Array and contents will be delete in destructor.*/
 
95
        InstanceControllerPointerArray mInstanceControllers;
 
96
 
 
97
        /** List of all child nodes. Array and contents will be delete in destructor.*/
 
98
                NodePointerArray mChildNodes;
 
99
 
 
100
        public:
 
101
 
 
102
                /** Creates a node with object id @a objectId.*/
 
103
                Node(const UniqueId& uniqueId);
 
104
 
 
105
                virtual ~Node();
 
106
 
 
107
        /**
 
108
        * The original object id, if it in the original file format exist. 
 
109
        */
 
110
        const String& getOriginalId () const { return mOriginalId; }
 
111
 
 
112
        /**
 
113
        * The original object id, if it in the original file format exist. 
 
114
        */
 
115
        void setOriginalId ( const String& val ) { mOriginalId = val; }
 
116
 
 
117
                /** Returns the name of the node*/
 
118
                const String& getName() const { return mName; }
 
119
 
 
120
                /** Sets the name of the node*/
 
121
                void setName(const String& name) { mName = name; }
 
122
        
 
123
        /** Returns the sid of the joint. Only relevant when mType is JOINT. */
 
124
        const String& getSid() const { return mSid; }
 
125
        
 
126
        /** Sets the sid of the joint. Only relevant when mType is JOINT. */
 
127
        void setSid(const String& sid) { mSid = sid; }
 
128
        
 
129
        /** The type of the <node> element. Valid values are JOINT or NODE. The default is
 
130
        NODE. Optional. */
 
131
        const Node::NodeType getType () const { return mType; }
 
132
 
 
133
        /** The type of the <node> element. Valid values are JOINT or NODE. The default is
 
134
        NODE. Optional. */
 
135
        void setType ( const Node::NodeType Type ) { mType = Type; }
 
136
 
 
137
                /** Get list of all transformations of the node.*/
 
138
                TransformationPointerArray& getTransformations() { return mTransformations; }
 
139
 
 
140
                /** Get list of all transformations of the node.*/
 
141
                const TransformationPointerArray& getTransformations() const { return mTransformations; }
 
142
 
 
143
                /** List of all instance geometries of this node.*/
 
144
                InstanceGeometryPointerArray& getInstanceGeometries() { return mInstanceGeometries; }
 
145
 
 
146
                /** List of all instance geometries of this node.*/
 
147
                const InstanceGeometryPointerArray& getInstanceGeometries() const { return mInstanceGeometries; }
 
148
 
 
149
                /** List of all instance nodes of this node.*/
 
150
                InstanceNodePointerArray& getInstanceNodes() { return mInstanceNodes; }
 
151
 
 
152
                /** List of all instance nodes of this node.*/
 
153
                const InstanceNodePointerArray& getInstanceNodes() const { return mInstanceNodes; }
 
154
 
 
155
                /** List of all instance cameras of this camera.*/
 
156
                InstanceCameraPointerArray& getInstanceCameras() { return mInstanceCameras; }
 
157
 
 
158
                /** List of all instance cameras of this camera.*/
 
159
                const InstanceCameraPointerArray& getInstanceCameras() const { return mInstanceCameras; }
 
160
 
 
161
                /** List of all instance cameras of this camera.*/
 
162
                InstanceLightPointerArray& getInstanceLights() { return mInstanceLights; }
 
163
 
 
164
                /** List of all instance cameras of this camera.*/
 
165
                const InstanceLightPointerArray& getInstanceLights() const { return mInstanceLights; }
 
166
 
 
167
        /** List of all instance controller of this node. Array and contents will be delete in destructor.*/
 
168
        InstanceControllerPointerArray& getInstanceControllers () { return mInstanceControllers; }
 
169
 
 
170
        /** List of all instance controller of this node. Array and contents will be delete in destructor.*/
 
171
        const InstanceControllerPointerArray& getInstanceControllers () const { return mInstanceControllers; }
 
172
 
 
173
                /** Get list of all child nodes.*/
 
174
                NodePointerArray& getChildNodes() { return mChildNodes; }
 
175
 
 
176
                /** Get list of all child nodes.*/
 
177
                const NodePointerArray& getChildNodes() const { return mChildNodes; }
 
178
 
 
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;
 
182
 
 
183
        /** Calculates a baked matrix, representing all the transformations.
 
184
        @return The calculated node transformation matrix. */
 
185
        COLLADABU::Math::Matrix4 getTransformationMatrix() const;
 
186
 
 
187
                /** Creates a clone of the node and returns a pointer to it.*/
 
188
                Node* clone() const { return FW_NEW Node(*this); }
 
189
        };
 
190
 
 
191
 
 
192
} // namespace COLLADAFW
 
193
 
 
194
#endif // __COLLADAFW_NODE_H__