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.
7 #ifndef CAFU_ASE_MODEL_LOADER_HPP_INCLUDED
8 #define CAFU_ASE_MODEL_LOADER_HPP_INCLUDED
16 /// This class imports an ASE (ASCII Scene Exporter, 3dsmax) model file into a new Cafu model.
17 class LoaderAseT
: public ModelLoaderT
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; }
35 /// A geometric object.
38 /// A single triangle.
45 for (unsigned long i
=0; i
<3; i
++)
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
);
84 ArrayT
<std::string
> m_MaterialNames
;
85 ArrayT
<GeomObjectT
> m_GeomObjects
;