ScummVM API documentation
Node3D.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_NODE3D_H
29 #define HPL_NODE3D_H
30 
31 #include "common/list.h"
32 #include "hpl1/engine/math/MathTypes.h"
33 #include "hpl1/engine/scene/Node.h"
34 
35 namespace hpl {
36 
37 //------------------------------------
38 
39 kSaveData_ChildClass(iNode, cNode3D) {
40  kSaveData_ClassInit(cNode3D) public : tString msName;
41  tString msSource;
42  bool mbAutoDeleteChildren;
43  cMatrixf m_mtxLocalTransform;
44  int mlParentId;
45 
46  iSaveObject *CreateSaveObject(cSaveObjectHandler * apSaveObjectHandler, cGame * apGame);
47  int GetSaveCreatePrio();
48 };
49 
50 //------------------------------------
51 
52 class cNode3D : public iNode {
53  typedef iNode super;
54 
55 public:
56  cNode3D(const tString &asName = "", bool abAutoDeleteChildren = true);
57  virtual ~cNode3D();
58 
59  iNode *CreateChild();
60  cNode3D *CreateChild3D(const tString &asName = "", bool abAutoDeleteChildren = true);
61 
62  cVector3f GetLocalPosition();
63  cMatrixf &GetLocalMatrix();
64 
65  cVector3f GetWorldPosition();
66  cMatrixf &GetWorldMatrix();
67 
68  void SetPosition(const cVector3f &avPos);
69  void SetMatrix(const cMatrixf &a_mtxTransform, bool abSetChildrenUpdated = true);
70 
71  void SetWorldPosition(const cVector3f &avWorldPos);
72  void SetWorldMatrix(const cMatrixf &a_mtxWorldTransform);
73 
74  const char *GetName();
75 
76  cNode3D *GetParent();
77 
78  void AddRotation(const cVector3f &avRot, eEulerRotationOrder aOrder);
79  void AddRotation(const cQuaternion &aqRotation);
80 
81  void AddScale(const cVector3f &avScale);
82 
83  void AddTranslation(const cVector3f &avTrans);
84 
85  void SetSource(const tString &asSource);
86  const char *GetSource();
87 
91  void UpdateMatrix(bool abSetChildrenUpdated);
92 
93  // Extra stuff that shouldn't be used externally
94  void SetParent(cNode3D *apNode);
95  void AddChild(cNode3D *apChild);
96 
97  // SaveObject implementation
98  virtual iSaveData *CreateSaveData();
99  virtual void SaveToSaveData(iSaveData *apSaveData);
100  virtual void LoadFromSaveData(iSaveData *apSaveData);
101  virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame);
102 
103  void UpdateWorldTransform();
104  void SetWorldTransformUpdated();
105 
106 private:
107  tString msName;
108  tString msSource;
109 
110  bool mbAutoDeleteChildren;
111 
112  cMatrixf m_mtxLocalTransform;
113  cMatrixf m_mtxWorldTransform;
114 
115  cVector3f mvWorldPosition;
116 
117  cMatrixf m_mtxRotation;
118  cVector3f mvScale;
119  cVector3f mvTranslation;
120 
121  bool mbTransformUpdated;
122 
123  cNode3D *mpParent;
124 };
125 
126 } // namespace hpl
127 
128 #endif // HPL_NODE3D_H
Definition: AI.h:36
Definition: Game.h:91
Definition: str.h:59
virtual void SaveToSaveData(iSaveData *apSaveData)
Definition: Quaternion.h:36
Definition: SaveGame.h:130
Definition: Node.h:55
Definition: Node3D.h:52
Definition: SaveGame.h:111
virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame)
virtual void LoadFromSaveData(iSaveData *apSaveData)
virtual iSaveData * CreateSaveData()
void UpdateMatrix(bool abSetChildrenUpdated)
Definition: SaveGame.h:183