aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CXMeshFileLoader.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 18:54:10 +1000
committerDavid Walter Seikel2013-01-13 18:54:10 +1000
commit959831f4ef5a3e797f576c3de08cd65032c997ad (patch)
treee7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/source/Irrlicht/CXMeshFileLoader.h
parentAdd info about changes to Irrlicht. (diff)
downloadSledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2
SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CXMeshFileLoader.h')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CXMeshFileLoader.h396
1 files changed, 198 insertions, 198 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CXMeshFileLoader.h b/libraries/irrlicht-1.8/source/Irrlicht/CXMeshFileLoader.h
index 67fb041..1a0c658 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/CXMeshFileLoader.h
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CXMeshFileLoader.h
@@ -1,198 +1,198 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5#ifndef __C_X_MESH_FILE_LOADER_H_INCLUDED__ 5#ifndef __C_X_MESH_FILE_LOADER_H_INCLUDED__
6#define __C_X_MESH_FILE_LOADER_H_INCLUDED__ 6#define __C_X_MESH_FILE_LOADER_H_INCLUDED__
7 7
8#include "IMeshLoader.h" 8#include "IMeshLoader.h"
9#include "irrString.h" 9#include "irrString.h"
10#include "CSkinnedMesh.h" 10#include "CSkinnedMesh.h"
11 11
12 12
13namespace irr 13namespace irr
14{ 14{
15namespace io 15namespace io
16{ 16{
17 class IFileSystem; 17 class IFileSystem;
18 class IReadFile; 18 class IReadFile;
19} // end namespace io 19} // end namespace io
20namespace scene 20namespace scene
21{ 21{
22class IMeshManipulator; 22class IMeshManipulator;
23 23
24//! Meshloader capable of loading x meshes. 24//! Meshloader capable of loading x meshes.
25class CXMeshFileLoader : public IMeshLoader 25class CXMeshFileLoader : public IMeshLoader
26{ 26{
27public: 27public:
28 28
29 //! Constructor 29 //! Constructor
30 CXMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem* fs); 30 CXMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem* fs);
31 31
32 //! returns true if the file maybe is able to be loaded by this class 32 //! returns true if the file maybe is able to be loaded by this class
33 //! based on the file extension (e.g. ".cob") 33 //! based on the file extension (e.g. ".cob")
34 virtual bool isALoadableFileExtension(const io::path& filename) const; 34 virtual bool isALoadableFileExtension(const io::path& filename) const;
35 35
36 //! creates/loads an animated mesh from the file. 36 //! creates/loads an animated mesh from the file.
37 //! \return Pointer to the created mesh. Returns 0 if loading failed. 37 //! \return Pointer to the created mesh. Returns 0 if loading failed.
38 //! If you no longer need the mesh, you should call IAnimatedMesh::drop(). 38 //! If you no longer need the mesh, you should call IAnimatedMesh::drop().
39 //! See IReferenceCounted::drop() for more information. 39 //! See IReferenceCounted::drop() for more information.
40 virtual IAnimatedMesh* createMesh(io::IReadFile* file); 40 virtual IAnimatedMesh* createMesh(io::IReadFile* file);
41 41
42 struct SXTemplateMaterial 42 struct SXTemplateMaterial
43 { 43 {
44 core::stringc Name; // template name from Xfile 44 core::stringc Name; // template name from Xfile
45 video::SMaterial Material; // material 45 video::SMaterial Material; // material
46 }; 46 };
47 47
48 struct SXMesh 48 struct SXMesh
49 { 49 {
50 SXMesh() : MaxSkinWeightsPerVertex(0), MaxSkinWeightsPerFace(0), BoneCount(0),AttachedJointID(-1),HasSkinning(false), HasVertexColors(false) {} 50 SXMesh() : MaxSkinWeightsPerVertex(0), MaxSkinWeightsPerFace(0), BoneCount(0),AttachedJointID(-1),HasSkinning(false), HasVertexColors(false) {}
51 // this mesh contains triangulated texture data. 51 // this mesh contains triangulated texture data.
52 // because in an .x file, faces can be made of more than 3 52 // because in an .x file, faces can be made of more than 3
53 // vertices, the indices data structure is triangulated during the 53 // vertices, the indices data structure is triangulated during the
54 // loading process. The IndexCountPerFace array is filled during 54 // loading process. The IndexCountPerFace array is filled during
55 // this triangulation process and stores how much indices belong to 55 // this triangulation process and stores how much indices belong to
56 // every face. This data structure can be ignored, because all data 56 // every face. This data structure can be ignored, because all data
57 // in this structure is triangulated. 57 // in this structure is triangulated.
58 58
59 core::stringc Name; 59 core::stringc Name;
60 60
61 u32 MaxSkinWeightsPerVertex; 61 u32 MaxSkinWeightsPerVertex;
62 u32 MaxSkinWeightsPerFace; 62 u32 MaxSkinWeightsPerFace;
63 u32 BoneCount; 63 u32 BoneCount;
64 64
65 core::array<u16> IndexCountPerFace; // default 3, but could be more 65 core::array<u16> IndexCountPerFace; // default 3, but could be more
66 66
67 core::array<scene::SSkinMeshBuffer*> Buffers; 67 core::array<scene::SSkinMeshBuffer*> Buffers;
68 68
69 core::array<video::S3DVertex> Vertices; 69 core::array<video::S3DVertex> Vertices;
70 core::array<core::vector2df> TCoords2; 70 core::array<core::vector2df> TCoords2;
71 71
72 core::array<u32> Indices; 72 core::array<u32> Indices;
73 73
74 core::array<u32> FaceMaterialIndices; // index of material for each face 74 core::array<u32> FaceMaterialIndices; // index of material for each face
75 75
76 core::array<video::SMaterial> Materials; // material array 76 core::array<video::SMaterial> Materials; // material array
77 77
78 core::array<u32> WeightJoint; 78 core::array<u32> WeightJoint;
79 core::array<u32> WeightNum; 79 core::array<u32> WeightNum;
80 80
81 s32 AttachedJointID; 81 s32 AttachedJointID;
82 82
83 bool HasSkinning; 83 bool HasSkinning;
84 bool HasVertexColors; 84 bool HasVertexColors;
85 }; 85 };
86 86
87private: 87private:
88 88
89 bool load(io::IReadFile* file); 89 bool load(io::IReadFile* file);
90 90
91 bool readFileIntoMemory(io::IReadFile* file); 91 bool readFileIntoMemory(io::IReadFile* file);
92 92
93 bool parseFile(); 93 bool parseFile();
94 94
95 bool parseDataObject(); 95 bool parseDataObject();
96 96
97 bool parseDataObjectTemplate(); 97 bool parseDataObjectTemplate();
98 98
99 bool parseDataObjectFrame(CSkinnedMesh::SJoint *parent); 99 bool parseDataObjectFrame(CSkinnedMesh::SJoint *parent);
100 100
101 bool parseDataObjectTransformationMatrix(core::matrix4 &mat); 101 bool parseDataObjectTransformationMatrix(core::matrix4 &mat);
102 102
103 bool parseDataObjectMesh(SXMesh &mesh); 103 bool parseDataObjectMesh(SXMesh &mesh);
104 104
105 bool parseDataObjectSkinWeights(SXMesh &mesh); 105 bool parseDataObjectSkinWeights(SXMesh &mesh);
106 106
107 bool parseDataObjectSkinMeshHeader(SXMesh &mesh); 107 bool parseDataObjectSkinMeshHeader(SXMesh &mesh);
108 108
109 bool parseDataObjectMeshNormals(SXMesh &mesh); 109 bool parseDataObjectMeshNormals(SXMesh &mesh);
110 110
111 bool parseDataObjectMeshTextureCoords(SXMesh &mesh); 111 bool parseDataObjectMeshTextureCoords(SXMesh &mesh);
112 112
113 bool parseDataObjectMeshVertexColors(SXMesh &mesh); 113 bool parseDataObjectMeshVertexColors(SXMesh &mesh);
114 114
115 bool parseDataObjectMeshMaterialList(SXMesh &mesh); 115 bool parseDataObjectMeshMaterialList(SXMesh &mesh);
116 116
117 bool parseDataObjectMaterial(video::SMaterial& material); 117 bool parseDataObjectMaterial(video::SMaterial& material);
118 118
119 bool parseDataObjectAnimationSet(); 119 bool parseDataObjectAnimationSet();
120 120
121 bool parseDataObjectAnimation(); 121 bool parseDataObjectAnimation();
122 122
123 bool parseDataObjectAnimationKey(ISkinnedMesh::SJoint *joint); 123 bool parseDataObjectAnimationKey(ISkinnedMesh::SJoint *joint);
124 124
125 bool parseDataObjectTextureFilename(core::stringc& texturename); 125 bool parseDataObjectTextureFilename(core::stringc& texturename);
126 126
127 bool parseUnknownDataObject(); 127 bool parseUnknownDataObject();
128 128
129 //! places pointer to next begin of a token, and ignores comments 129 //! places pointer to next begin of a token, and ignores comments
130 void findNextNoneWhiteSpace(); 130 void findNextNoneWhiteSpace();
131 131
132 //! places pointer to next begin of a token, which must be a number, 132 //! places pointer to next begin of a token, which must be a number,
133 // and ignores comments 133 // and ignores comments
134 void findNextNoneWhiteSpaceNumber(); 134 void findNextNoneWhiteSpaceNumber();
135 135
136 //! returns next parseable token. Returns empty string if no token there 136 //! returns next parseable token. Returns empty string if no token there
137 core::stringc getNextToken(); 137 core::stringc getNextToken();
138 138
139 //! reads header of dataobject including the opening brace. 139 //! reads header of dataobject including the opening brace.
140 //! returns false if error happened, and writes name of object 140 //! returns false if error happened, and writes name of object
141 //! if there is one 141 //! if there is one
142 bool readHeadOfDataObject(core::stringc* outname=0); 142 bool readHeadOfDataObject(core::stringc* outname=0);
143 143
144 //! checks for closing curly brace, returns false if not there 144 //! checks for closing curly brace, returns false if not there
145 bool checkForClosingBrace(); 145 bool checkForClosingBrace();
146 146
147 //! checks for one following semicolons, returns false if not there 147 //! checks for one following semicolons, returns false if not there
148 bool checkForOneFollowingSemicolons(); 148 bool checkForOneFollowingSemicolons();
149 149
150 //! checks for two following semicolons, returns false if they are not there 150 //! checks for two following semicolons, returns false if they are not there
151 bool checkForTwoFollowingSemicolons(); 151 bool checkForTwoFollowingSemicolons();
152 152
153 //! reads a x file style string 153 //! reads a x file style string
154 bool getNextTokenAsString(core::stringc& out); 154 bool getNextTokenAsString(core::stringc& out);
155 155
156 void readUntilEndOfLine(); 156 void readUntilEndOfLine();
157 157
158 u16 readBinWord(); 158 u16 readBinWord();
159 u32 readBinDWord(); 159 u32 readBinDWord();
160 u32 readInt(); 160 u32 readInt();
161 f32 readFloat(); 161 f32 readFloat();
162 bool readVector2(core::vector2df& vec); 162 bool readVector2(core::vector2df& vec);
163 bool readVector3(core::vector3df& vec); 163 bool readVector3(core::vector3df& vec);
164 bool readMatrix(core::matrix4& mat); 164 bool readMatrix(core::matrix4& mat);
165 bool readRGB(video::SColor& color); 165 bool readRGB(video::SColor& color);
166 bool readRGBA(video::SColor& color); 166 bool readRGBA(video::SColor& color);
167 167
168 ISceneManager* SceneManager; 168 ISceneManager* SceneManager;
169 io::IFileSystem* FileSystem; 169 io::IFileSystem* FileSystem;
170 170
171 core::array<CSkinnedMesh::SJoint*> *AllJoints; 171 core::array<CSkinnedMesh::SJoint*> *AllJoints;
172 172
173 CSkinnedMesh* AnimatedMesh; 173 CSkinnedMesh* AnimatedMesh;
174 174
175 c8* Buffer; 175 c8* Buffer;
176 const c8* P; 176 const c8* P;
177 c8* End; 177 c8* End;
178 // counter for number arrays in binary format 178 // counter for number arrays in binary format
179 u32 BinaryNumCount; 179 u32 BinaryNumCount;
180 u32 Line; 180 u32 Line;
181 io::path FilePath; 181 io::path FilePath;
182 182
183 CSkinnedMesh::SJoint *CurFrame; 183 CSkinnedMesh::SJoint *CurFrame;
184 184
185 core::array<SXMesh*> Meshes; 185 core::array<SXMesh*> Meshes;
186 186
187 core::array<SXTemplateMaterial> TemplateMaterials; 187 core::array<SXTemplateMaterial> TemplateMaterials;
188 188
189 u32 MajorVersion; 189 u32 MajorVersion;
190 u32 MinorVersion; 190 u32 MinorVersion;
191 bool BinaryFormat; 191 bool BinaryFormat;
192 c8 FloatSize; 192 c8 FloatSize;
193}; 193};
194 194
195} // end namespace scene 195} // end namespace scene
196} // end namespace irr 196} // end namespace irr
197 197
198#endif 198#endif