Cafu Engine
Loader_mdl_hl2.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_HL2_MDL_MODEL_LOADER_HPP_INCLUDED
8 #define CAFU_HL2_MDL_MODEL_LOADER_HPP_INCLUDED
9 
10 #include "Loader.hpp"
11 
12 
13 namespace HL2mdl
14 {
15  class VertexHeaderT;
16  class StripsHeaderT;
17  class StudioHeaderT;
18 }
19 
20 
21 /// This class imports a HL2 (.mdl) model file into a new Cafu model.
23 {
24  public:
25 
26  /// The constructor for importing a HL2 (.mdl) model file into a new Cafu model.
27  /// @param FileName The name of the .mdl file to import.
28  /// @param Flags The flags to load the model with. See ModelLoaderT::FlagsT for details.
29  LoaderHL2mdlT(const std::string& FileName, int Flags = NONE);
30 
32  void Load(ArrayT<CafuModelT::SkinT>& Skins, const MaterialManagerImplT& MaterialMan);
33  void Load(ArrayT<CafuModelT::GuiFixtureT>& GuiFixtures) { }
34  void Load(ArrayT<CafuModelT::ChannelT>& Channels) { }
35  bool Load(unsigned int Level, CafuModelT*& DlodModel, float& DlodDist) { return false; }
36 
37 
38  private:
39 
40  void Load(MaterialManagerImplT& MaterialMan);
41  void Load(ArrayT<CafuModelT::JointT>& Joints) const;
42  void Load(ArrayT<CafuModelT::MeshT>& Meshes) const;
43 
44  ArrayT<uint8_t> m_VertexData;
45  ArrayT<uint8_t> m_StripsData;
46  ArrayT<uint8_t> m_ModelData;
47  ArrayT<MaterialT*> m_Materials; ///< The MatSys materials used in the model.
48 
49  // Pointers into the first bytes of the above data arrays.
50  const HL2mdl::VertexHeaderT* VertexHeader;
51  const HL2mdl::StripsHeaderT* StripsHeader;
52  const HL2mdl::StudioHeaderT* StudioHeader;
53 };
54 
55 #endif
This class represents a native Cafu model.
Definition: Model_cmdl.hpp:45
This is the header of an MDL model file.
Definition: Loader_mdl_hl2_mdl.hpp:231
This is the header of a VTX strips data file.
Definition: Loader_mdl_hl2_vtx.hpp:222
void Load(ArrayT< CafuModelT::GuiFixtureT > &GuiFixtures)
Loads the GUI fixtures of the Cafu model.
Definition: Loader_mdl_hl2.hpp:33
The base class for importing arbitrary model files into Cafu models.
Definition: Loader.hpp:15
This class imports a HL2 (.mdl) model file into a new Cafu model.
Definition: Loader_mdl_hl2.hpp:22
LoaderHL2mdlT(const std::string &FileName, int Flags=NONE)
The constructor for importing a HL2 (.mdl) model file into a new Cafu model.
Definition: Loader_mdl_hl2.cpp:60
This class implements the MaterialManagerI interface.
Definition: MaterialManagerImpl.hpp:23
Definition: Loader_mdl_hl1.h:43
void Load(ArrayT< CafuModelT::ChannelT > &Channels)
Loads the animation channels (groups of joints) of the Cafu model.
Definition: Loader_mdl_hl2.hpp:34
bool Load(unsigned int Level, CafuModelT *&DlodModel, float &DlodDist)
Loads the dlod-model and dlod-distance at the given level.
Definition: Loader_mdl_hl2.hpp:35
This is the header of a VVD vertex data file.
Definition: Loader_mdl_hl2_vvd.hpp:65
void Load(ArrayT< CafuModelT::JointT > &Joints, ArrayT< CafuModelT::MeshT > &Meshes, ArrayT< CafuModelT::AnimT > &Anims, MaterialManagerImplT &MaterialMan)
Actually loads the file data into the appropriate parts of the Cafu model.
Definition: Loader_mdl_hl2.cpp:194