Cafu Engine
Loader_mdl_hl1.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_HL1_MDL_MODEL_LOADER_HPP_INCLUDED
8 #define CAFU_HL1_MDL_MODEL_LOADER_HPP_INCLUDED
9 
10 #include "Loader.hpp"
11 
12 
13 struct StudioHeaderT;
14 struct StudioBoneT;
15 struct StudioSequenceT;
17 struct StudioTextureT;
18 struct StudioBodyPartT;
19 
20 
21 /// This class imports a HL1 (.mdl) model file into a new Cafu model.
23 {
24  public:
25 
26  /// The constructor for importing a HL1 (.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  LoaderHL1mdlT(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(ArrayT<CafuModelT::JointT>& Joints) const;
41  void Load(ArrayT<CafuModelT::MeshT>& Meshes, ArrayT<int>& MeshSkinRef) const;
42  void Load(ArrayT<CafuModelT::AnimT>& Anims) const;
43 
44  ArrayT<char> ModelData; ///< Basic model data.
45  ArrayT<char> TextureData; ///< Texture data (if not already present in ModelData).
46  ArrayT< ArrayT<char> > AnimationData; ///< Animation data ("demand loaded sequences").
47  ArrayT<MaterialT*> m_Materials; ///< The MatSys materials used in the model.
48  ArrayT<int> m_MeshSkinRef; ///< For each mesh, the original StudioMeshT::SkinRef number.
49 
50  // Convenient abbreviations into the above data arrays.
51  const StudioHeaderT* StudioHeader;
52  const StudioBoneT* StudioBones;
53  // const StudioBoneControllerT* StudioBoneControllers;
54  // const StudioHitBoxT* StudioHitBoxes;
55  const StudioSequenceT* StudioSequences;
56  const StudioSequenceGroupT* StudioSequenceGroups;
57  const StudioHeaderT* StudioTextureHeader;
58  const StudioTextureT* StudioTextures;
59  const StudioBodyPartT* StudioBodyParts;
60  // const StudioAttachmentT* StudioAttachments;
61  // const StudioTransitionT* StudioTransitions;
62 };
63 
64 #endif
This class represents a native Cafu model.
Definition: Model_cmdl.hpp:45
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_hl1.cpp:123
Definition: Loader_mdl_hl1.h:175
Definition: Loader_mdl_hl1.h:121
LoaderHL1mdlT(const std::string &FileName, int Flags=NONE)
The constructor for importing a HL1 (.mdl) model file into a new Cafu model.
Definition: Loader_mdl_hl1.cpp:19
bool Load(unsigned int Level, CafuModelT *&DlodModel, float &DlodDist)
Loads the dlod-model and dlod-distance at the given level.
Definition: Loader_mdl_hl1.hpp:35
The base class for importing arbitrary model files into Cafu models.
Definition: Loader.hpp:15
Definition: Loader_mdl_hl1.h:185
Definition: Loader_mdl_hl1.h:166
This class implements the MaterialManagerI interface.
Definition: MaterialManagerImpl.hpp:23
Definition: Loader_mdl_hl1.h:43
Definition: Loader_mdl_hl1.h:99
void Load(ArrayT< CafuModelT::GuiFixtureT > &GuiFixtures)
Loads the GUI fixtures of the Cafu model.
Definition: Loader_mdl_hl1.hpp:33
void Load(ArrayT< CafuModelT::ChannelT > &Channels)
Loads the animation channels (groups of joints) of the Cafu model.
Definition: Loader_mdl_hl1.hpp:34
This class imports a HL1 (.mdl) model file into a new Cafu model.
Definition: Loader_mdl_hl1.hpp:22