appNode.h

Engine/source/ts/loader/appNode.h

More...

Classes:

class

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _APPNODE_H_
25#define _APPNODE_H_
26
27#ifndef _MMATH_H_
28#include "math/mMath.h"
29#endif
30#ifndef _TVECTOR_H_
31#include "core/util/tVector.h"
32#endif
33#ifndef _APPMESH_H_
34#include "ts/loader/appMesh.h"
35#endif
36
37class AppNode
38{
39   friend class TSShapeLoader;
40
41   // add attached meshes and child nodes to app node
42   // the reason these are tracked by AppNode is that
43   // AppNode is responsible for deleting all it's children
44   // and attached meshes.
45   virtual void buildMeshList() = 0;
46   virtual void buildChildList() = 0;
47
48protected:
49
50   S32 mParentIndex;
51   Vector<AppMesh*>  mMeshes;
52   Vector<AppNode*>  mChildNodes;
53   char* mName;
54   char* mParentName;
55
56public:
57
58   AppNode();
59   virtual ~AppNode();
60
61   S32 getNumMesh();
62   AppMesh* getMesh(S32 idx);
63
64   S32 getNumChildNodes();
65   AppNode* getChildNode(S32 idx);
66
67   virtual MatrixF getNodeTransform(F32 time) = 0;
68
69   virtual bool isEqual(AppNode* node) = 0;
70
71   virtual bool animatesTransform(const AppSequence* appSeq) = 0;
72
73   virtual const char* getName() = 0;
74   virtual const char* getParentName() = 0;
75
76   virtual bool getFloat(const char* propName, F32& defaultVal) = 0;
77   virtual bool getInt(const char* propName, S32& defaultVal) = 0;
78   virtual bool getBool(const char* propName, bool& defaultVal) = 0;
79
80   virtual bool isBillboard();
81   virtual bool isBillboardZAxis();
82   virtual bool isParentRoot() = 0;
83   virtual bool isDummy();
84   virtual bool isBounds();
85   virtual bool isSequence();
86   virtual bool isRoot();
87};
88
89#endif // _APPNODE_H_
90