ScummVM API documentation
xframe_node.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  * This file is based on WME.
24  * http://dead-code.org/redir.php?target=wme
25  * Copyright (c) 2003-2013 Jan Nedoma and contributors
26  */
27 
28 #ifndef WINTERMUTE_XFRAME_NODE_H
29 #define WINTERMUTE_XFRAME_NODE_H
30 
31 #include "engines/wintermute/base/base_named_object.h"
32 #include "engines/wintermute/base/gfx/xmesh.h"
33 #include "engines/wintermute/base/gfx/xmodel.h"
34 #include "engines/wintermute/coll_templ.h"
35 
36 #include "math/matrix4.h"
37 #include "math/quat.h"
38 #include "math/vector3d.h"
39 
40 namespace Wintermute {
41 
42 class XModel;
43 class XFileData;
44 class BaseSprite;
45 
46 class FrameNode : public BaseNamedObject {
47 public:
48  FrameNode(BaseGame *inGame);
49  virtual ~FrameNode();
50 
51  bool updateMatrices(Math::Matrix4 &parentMat);
52  bool updateMeshes();
53  bool resetMatrices();
54  bool render(XModel *model);
55  bool renderFlatShadowModel();
56  bool updateShadowVol(ShadowVolume *shadow, Math::Matrix4 &modelMat, const Math::Vector3d &light, float extrusionDepth);
57 
58  bool loadFromXData(const Common::String &filename, XModel *model, XFileData *xobj, Common::Array<MaterialReference> &materialReferences);
59  bool mergeFromXData(const Common::String &filename, XModel *model, XFileData *xobj);
60  bool findBones(FrameNode *rootFrame);
61  FrameNode *findFrame(const char *frameName);
62  Math::Matrix4 *getCombinedMatrix();
63  Math::Matrix4 *getOriginalMatrix();
64  void setTransformationMatrix(Math::Matrix4 *mat);
65  bool pickPoly(Math::Vector3d *pickRayOrig, Math::Vector3d *pickRayDir);
66  bool getBoundingBox(Math::Vector3d *boxStart, Math::Vector3d *boxEnd);
67 
68  void setTransformation(int slot, Math::Vector3d pos, Math::Vector3d scale, Math::Quaternion rot, float lerpValue);
69 
70  bool hasChildren();
71 
72  bool setMaterialSprite(char *matName, BaseSprite *sprite);
73  bool setMaterialTheora(char *matName, VideoTheoraPlayer *theora);
74 
75  bool invalidateDeviceObjects();
76  bool restoreDeviceObjects();
77 
78 protected:
79  BaseArray<FrameNode *> _frames;
80  BaseArray<XMesh *> _meshes;
81 
82  Math::Matrix4 _transformationMatrix;
83  Math::Matrix4 _originalMatrix;
84  Math::Matrix4 _combinedMatrix;
85 
86  Math::Vector3d _transPos[2];
87  Math::Vector3d _transScale[2];
88  Math::Quaternion _transRot[2];
89  bool _transUsed[2];
90  float _lerpValue[2];
91 };
92 
93 } // namespace Wintermute
94 
95 #endif
Definition: base_game.h:75
Definition: str.h:59
Definition: array.h:52
Definition: video_theora_player.h:41
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: xmodel.h:58
Definition: 3dshadow_volume.h:48
Definition: coll_templ.h:63
Definition: base_named_object.h:36
Definition: xframe_node.h:46
Definition: base_sprite.h:40
Definition: xfile_loader.h:452
Definition: achievements_tables.h:27