xoreos  0.0.5
model_witcher.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef GRAPHICS_AURORA_MODEL_WITCHER_H
26 #define GRAPHICS_AURORA_MODEL_WITCHER_H
27 
30 
31 namespace Common {
32  class SeekableReadStream;
33 }
34 
35 namespace Graphics {
36 
37 namespace Aurora {
38 
39 class ModelNode_Witcher;
40 
42 class Model_Witcher : public Model {
43 public:
46 
47 private:
48  struct ParserContext {
50 
52 
53  State *state;
54 
55  std::list<ModelNode_Witcher *> nodes;
56 
58 
61 
64 
66 
69 
70  ParserContext(const Common::UString &name);
72 
73  void clear();
74  };
75 
76 
77  void newState(ParserContext &ctx);
78  void addState(ParserContext &ctx);
79 
80  void load(ParserContext &ctx);
81 
82  friend class ModelNode_Witcher;
83 };
84 
85 class ModelNode_Witcher : public ModelNode {
86 public:
87  ModelNode_Witcher(Model &model);
89 
91 
92 private:
94  bool hasTexture;
95 
97 
98  std::vector<float> weights;
99  };
100 
103 
105  std::vector<Common::UString> &textures);
107  uint32 offset, uint32 count, std::vector<float> &data);
108 
109  void evaluateTextures(int n, std::vector<Common::UString> &textures,
110  const Common::UString *staticTextures, const uint32 *tVertsCount,
111  bool lightMapDayNight, const Common::UString &lightMapName);
112 
113 protected:
114  void buildMaterial();
115 };
116 
117 } // End of namespace Aurora
118 
119 } // End of namespace Graphics
120 
121 #endif // GRAPHICS_AURORA_MODEL_WITCHER_H
ParserContext(const Common::UString &name)
Definition: 2dafile.h:39
A class holding an UTF-8 string.
Definition: ustring.h:48
Model_Witcher(const Common::UString &name, ModelType type=kModelTypeObject)
void addState(ParserContext &ctx)
A real object in the game world.
Definition: types.h:52
void readMesh(Model_Witcher::ParserContext &ctx)
void load(ParserContext &ctx)
void readNodeControllers(Model_Witcher::ParserContext &ctx, uint32 offset, uint32 count, std::vector< float > &data)
ModelType
The display type of a model.
Definition: types.h:51
uint16_t uint16
Definition: types.h:202
A node within a 3D model.
A 3D model of an object.
void readTextures(Model_Witcher::ParserContext &ctx, std::vector< Common::UString > &textures)
void evaluateTextures(int n, std::vector< Common::UString > &textures, const Common::UString *staticTextures, const uint32 *tVertsCount, bool lightMapDayNight, const Common::UString &lightMapName)
void load(Model_Witcher::ParserContext &ctx)
uint32_t uint32
Definition: types.h:204
void readTexturePaint(Model_Witcher::ParserContext &ctx)
void newState(ParserContext &ctx)
A 3D model in the The Witcher MDB format.
Definition: model_witcher.h:42
std::list< ModelNode_Witcher * > nodes
Definition: model_witcher.h:55
Interface for a seekable & readable data stream.
Definition: readstream.h:265