Fix issue in Rocket.lua script.
[Cafu-Engine.git] / Libs / Models / Loader_ase.hpp
blob6fd6f212f5174e57bc620b3b4294fdffa9bba7bc
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 */
7 #ifndef CAFU_ASE_MODEL_LOADER_HPP_INCLUDED
8 #define CAFU_ASE_MODEL_LOADER_HPP_INCLUDED
10 #include "Loader.hpp"
13 class TextParserT;
16 /// This class imports an ASE (ASCII Scene Exporter, 3dsmax) model file into a new Cafu model.
17 class LoaderAseT : public ModelLoaderT
19 public:
21 /// The constructor for importing an ASE (ASCII Scene Exporter, 3dsmax) model file into a new Cafu model.
22 /// @param FileName The name of the .ase file to import.
23 /// @param Flags The flags to load the model with. See ModelLoaderT::FlagsT for details.
24 LoaderAseT(const std::string& FileName, int Flags=NONE);
26 void Load(ArrayT<CafuModelT::JointT>& Joints, ArrayT<CafuModelT::MeshT>& Meshes, ArrayT<CafuModelT::AnimT>& Anims, MaterialManagerImplT& MaterialMan);
27 void Load(ArrayT<CafuModelT::SkinT>& Skins, const MaterialManagerImplT& MaterialMan) { }
28 void Load(ArrayT<CafuModelT::GuiFixtureT>& GuiFixtures);
29 void Load(ArrayT<CafuModelT::ChannelT>& Channels) { }
30 bool Load(unsigned int Level, CafuModelT*& DlodModel, float& DlodDist) { return false; }
33 private:
35 /// A geometric object.
36 struct GeomObjectT
38 /// A single triangle.
39 struct TriangleT
41 /// Constructor.
42 TriangleT()
43 : SmoothGrps(0)
45 for (unsigned long i=0; i<3; i++)
47 IndVertices [i]=0;
48 IndTexCoords[i]=0;
52 // This data is read from the file.
53 unsigned long IndVertices [3]; ///< Indices into the Vertices array.
54 unsigned long IndTexCoords[3]; ///< Indices into the TexCoords array.
55 ArrayT<unsigned long> SmoothGroups; ///< The SmoothGroups this triangle is in.
56 uint32_t SmoothGrps; ///< The smoothing groups that this triangle is in: If bit \c i is set, the triangle is in smoothing group \c i.
58 // This data is computed after loading.
59 VectorT Normal; ///< The geometric per-triangle normal.
60 VectorT Normals[3]; ///< The smoothgroup normals for the three vertices.
61 VectorT Tangents[3]; ///< The smoothgroup tangents for the three vertices.
62 VectorT BiNormals[3]; ///< The smoothgroup binormals for the three vertices.
66 /// Method for initializing the mesh from (a file within) TP.
67 /// @param TP TextParserT used to read the mesh in.
68 void ReadMesh(TextParserT& TP);
70 // This data is read from the file.
71 std::string Name; ///< Name of the object.
72 ArrayT<VectorT> Vertices; ///< List of vertices.
73 ArrayT<VectorT> TexCoords; ///< List of texture coordinates.
74 ArrayT<TriangleT> Triangles; ///< List of triangles.
75 unsigned long IndexMaterial; ///< Index of the material used for this object.
76 bool CastShadows; ///< Whether this object casts shadows.
80 void ReadMaterials(TextParserT& TP);
81 void ReadGeometry(TextParserT& TP);
82 void Print() const;
84 ArrayT<std::string> m_MaterialNames;
85 ArrayT<GeomObjectT> m_GeomObjects;
88 #endif