ScummVM API documentation
xmesh.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_XMESH_H
29 #define WINTERMUTE_XMESH_H
30 
31 #include "engines/wintermute/base/base_named_object.h"
32 #include "engines/wintermute/base/gfx/xmodel.h"
33 #include "engines/wintermute/coll_templ.h"
34 
35 #include "math/matrix4.h"
36 #include "math/vector3d.h"
37 
38 namespace Wintermute {
39 
40 class BaseSprite;
41 class FrameNode;
42 class Material;
43 class ShadowVolume;
44 class VideoTheoraPlayer;
45 class SkinMeshHelper;
46 struct XMeshObject;
47 
48 class XMesh : public BaseNamedObject {
49  friend class XSkinMeshLoader;
50 public:
51  XMesh(BaseGame *inGame);
52  virtual ~XMesh();
53 
54  virtual bool loadFromXData(const Common::String &filename, XFileData *xobj, Common::Array<MaterialReference> &materialReferences);
55  bool findBones(FrameNode *rootFrame);
56  virtual bool update(FrameNode *parentFrame);
57  virtual bool render(XModel *model) = 0;
58  virtual bool renderFlatShadowModel() = 0;
59  bool updateShadowVol(ShadowVolume *shadow, Math::Matrix4 &modelMat, const Math::Vector3d &light, float extrusionDepth);
60 
61  bool pickPoly(Math::Vector3d *pickRayOrig, Math::Vector3d *pickRayDir);
62 
63  Math::Vector3d _BBoxStart;
64  Math::Vector3d _BBoxEnd;
65 
66  bool setMaterialSprite(const Common::String &matName, BaseSprite *sprite);
67  bool setMaterialTheora(const Common::String &matName, VideoTheoraPlayer *theora);
68 
69  bool invalidateDeviceObjects();
70  bool restoreDeviceObjects();
71 
72 protected:
73 
74  void updateBoundingBox();
75 
76  uint32 _numAttrs;
77 
78  // Wintermute3D used the ID3DXSKININFO interface
79  // we will only store, whether this mesh is skinned at all
80  // and factor out the necessary computations into some functions
81  bool _skinnedMesh;
82 
83  SkinMeshHelper *_skinMesh;
84 
85  BaseArray<Math::Matrix4 *> _boneMatrices;
86 
87  Common::Array<uint32> _adjacency;
88 
89  BaseArray<Material *> _materials;
90 };
91 
92 } // namespace Wintermute
93 
94 #endif
Definition: base_game.h:75
Definition: str.h:59
Definition: array.h:52
Definition: video_theora_player.h:41
Definition: skin_mesh_helper.h:41
Definition: xmodel.h:58
Definition: xmesh.h:48
Definition: 3dshadow_volume.h:48
Definition: coll_templ.h:63
Definition: base_named_object.h:36
Definition: xframe_node.h:46
Definition: xskinmesh_loader.h:47
Definition: base_sprite.h:40
Definition: xfile_loader.h:452
Definition: achievements_tables.h:27