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 namespace Wintermute {
37 
38 class XModel;
39 class XFileData;
40 class BaseSprite;
41 class Effect3D;
42 class Effect3DParams;
43 
44 class FrameNode : public BaseNamedObject {
45 public:
46  FrameNode(BaseGame *inGame);
47  virtual ~FrameNode();
48 
49  bool updateMatrices(DXMatrix *parentMat);
50  bool updateMeshes();
51  bool resetMatrices();
52  bool render(XModel *model);
53  bool renderFlatShadowModel();
54  bool updateShadowVol(ShadowVolume *shadow, DXMatrix *modelMat, DXVector3 *light, float extrusionDepth);
55 
56  bool loadFromXData(const Common::String &filename, XModel *model, XFileData *xobj);
57  bool mergeFromXData(const Common::String &filename, XModel *model, XFileData *xobj);
58  bool findBones(FrameNode *rootFrame);
59  FrameNode *findFrame(const char *frameName);
60  DXMatrix *getCombinedMatrix();
61  DXMatrix *getOriginalMatrix();
62  void setTransformationMatrix(DXMatrix *mat);
63  bool pickPoly(DXVector3 *pickRayOrig, DXVector3 *pickRayDir);
64  bool getBoundingBox(DXVector3 *boxStart, DXVector3 *boxEnd);
65 
66  void setTransformation(int slot, DXVector3 pos, DXVector3 scale, DXQuaternion rot, float lerpValue);
67 
68  bool hasChildren();
69 
70  bool setMaterialSprite(char *matName, BaseSprite *sprite);
71  bool setMaterialTheora(char *matName, VideoTheoraPlayer *theora);
72  bool setMaterialEffect(char *matName, Effect3D *effect, Effect3DParams *params);
73  bool removeMaterialEffect(const char *matName);
74 
75  bool invalidateDeviceObjects();
76  bool restoreDeviceObjects();
77 
78 protected:
79  BaseArray<FrameNode *> _frames;
80  BaseArray<XMesh *> _meshes;
81 
82  DXMatrix _transformationMatrix;
83  DXMatrix _originalMatrix;
84  DXMatrix _combinedMatrix;
85 
86  DXVector3 _transPos[2];
87  DXVector3 _transScale[2];
88  DXQuaternion _transRot[2];
89  bool _transUsed[2];
90  float _lerpValue[2];
91 };
92 
93 } // namespace Wintermute
94 
95 #endif
Definition: base_game.h:76
Definition: str.h:59
Definition: xmath.h:50
Definition: video_theora_player.h:41
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: xmodel.h:54
Definition: 3dshadow_volume.h:49
Definition: coll_templ.h:63
Definition: 3deffect_params.h:36
Definition: base_named_object.h:36
Definition: xframe_node.h:44
Definition: xmath.h:116
Definition: xmath.h:93
Definition: base_sprite.h:40
Definition: 3deffect.h:36
Definition: xfile_loader.h:459
Definition: achievements_tables.h:27