aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/C3DSMeshFileLoader.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/C3DSMeshFileLoader.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 '')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/C3DSMeshFileLoader.h332
1 files changed, 166 insertions, 166 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/C3DSMeshFileLoader.h b/libraries/irrlicht-1.8/source/Irrlicht/C3DSMeshFileLoader.h
index ab5108f..bd5784a 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/C3DSMeshFileLoader.h
+++ b/libraries/irrlicht-1.8/source/Irrlicht/C3DSMeshFileLoader.h
@@ -1,166 +1,166 @@
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_3DS_MESH_FILE_LOADER_H_INCLUDED__ 5#ifndef __C_3DS_MESH_FILE_LOADER_H_INCLUDED__
6#define __C_3DS_MESH_FILE_LOADER_H_INCLUDED__ 6#define __C_3DS_MESH_FILE_LOADER_H_INCLUDED__
7 7
8#include "IMeshLoader.h" 8#include "IMeshLoader.h"
9#include "IFileSystem.h" 9#include "IFileSystem.h"
10#include "ISceneManager.h" 10#include "ISceneManager.h"
11#include "irrString.h" 11#include "irrString.h"
12#include "SMesh.h" 12#include "SMesh.h"
13#include "matrix4.h" 13#include "matrix4.h"
14 14
15namespace irr 15namespace irr
16{ 16{
17namespace scene 17namespace scene
18{ 18{
19 19
20//! Meshloader capable of loading 3ds meshes. 20//! Meshloader capable of loading 3ds meshes.
21class C3DSMeshFileLoader : public IMeshLoader 21class C3DSMeshFileLoader : public IMeshLoader
22{ 22{
23public: 23public:
24 24
25 //! Constructor 25 //! Constructor
26 C3DSMeshFileLoader(ISceneManager* smgr, io::IFileSystem* fs); 26 C3DSMeshFileLoader(ISceneManager* smgr, io::IFileSystem* fs);
27 27
28 //! destructor 28 //! destructor
29 virtual ~C3DSMeshFileLoader(); 29 virtual ~C3DSMeshFileLoader();
30 30
31 //! returns true if the file maybe is able to be loaded by this class 31 //! returns true if the file maybe is able to be loaded by this class
32 //! based on the file extension (e.g. ".cob") 32 //! based on the file extension (e.g. ".cob")
33 virtual bool isALoadableFileExtension(const io::path& filename) const; 33 virtual bool isALoadableFileExtension(const io::path& filename) const;
34 34
35 //! creates/loads an animated mesh from the file. 35 //! creates/loads an animated mesh from the file.
36 //! \return Pointer to the created mesh. Returns 0 if loading failed. 36 //! \return Pointer to the created mesh. Returns 0 if loading failed.
37 //! If you no longer need the mesh, you should call IAnimatedMesh::drop(). 37 //! If you no longer need the mesh, you should call IAnimatedMesh::drop().
38 //! See IReferenceCounted::drop() for more information. 38 //! See IReferenceCounted::drop() for more information.
39 virtual IAnimatedMesh* createMesh(io::IReadFile* file); 39 virtual IAnimatedMesh* createMesh(io::IReadFile* file);
40 40
41private: 41private:
42 42
43// byte-align structures 43// byte-align structures
44#include "irrpack.h" 44#include "irrpack.h"
45 45
46 struct ChunkHeader 46 struct ChunkHeader
47 { 47 {
48 u16 id; 48 u16 id;
49 s32 length; 49 s32 length;
50 } PACK_STRUCT; 50 } PACK_STRUCT;
51 51
52// Default alignment 52// Default alignment
53#include "irrunpack.h" 53#include "irrunpack.h"
54 54
55 struct ChunkData 55 struct ChunkData
56 { 56 {
57 ChunkData() : read(0) {} 57 ChunkData() : read(0) {}
58 58
59 ChunkHeader header; 59 ChunkHeader header;
60 s32 read; 60 s32 read;
61 }; 61 };
62 62
63 struct SCurrentMaterial 63 struct SCurrentMaterial
64 { 64 {
65 void clear() { 65 void clear() {
66 Material=video::SMaterial(); 66 Material=video::SMaterial();
67 Name=""; 67 Name="";
68 Filename[0]=""; 68 Filename[0]="";
69 Filename[1]=""; 69 Filename[1]="";
70 Filename[2]=""; 70 Filename[2]="";
71 Filename[3]=""; 71 Filename[3]="";
72 Filename[4]=""; 72 Filename[4]="";
73 Strength[0]=0.f; 73 Strength[0]=0.f;
74 Strength[1]=0.f; 74 Strength[1]=0.f;
75 Strength[2]=0.f; 75 Strength[2]=0.f;
76 Strength[3]=0.f; 76 Strength[3]=0.f;
77 Strength[4]=0.f; 77 Strength[4]=0.f;
78 } 78 }
79 79
80 video::SMaterial Material; 80 video::SMaterial Material;
81 core::stringc Name; 81 core::stringc Name;
82 core::stringc Filename[5]; 82 core::stringc Filename[5];
83 f32 Strength[5]; 83 f32 Strength[5];
84 }; 84 };
85 85
86 struct SMaterialGroup 86 struct SMaterialGroup
87 { 87 {
88 SMaterialGroup() : faceCount(0), faces(0) {}; 88 SMaterialGroup() : faceCount(0), faces(0) {};
89 89
90 SMaterialGroup(const SMaterialGroup& o) 90 SMaterialGroup(const SMaterialGroup& o)
91 { 91 {
92 *this = o; 92 *this = o;
93 } 93 }
94 94
95 ~SMaterialGroup() 95 ~SMaterialGroup()
96 { 96 {
97 clear(); 97 clear();
98 } 98 }
99 99
100 void clear() 100 void clear()
101 { 101 {
102 delete [] faces; 102 delete [] faces;
103 faces = 0; 103 faces = 0;
104 faceCount = 0; 104 faceCount = 0;
105 } 105 }
106 106
107 void operator =(const SMaterialGroup& o) 107 void operator =(const SMaterialGroup& o)
108 { 108 {
109 MaterialName = o.MaterialName; 109 MaterialName = o.MaterialName;
110 faceCount = o.faceCount; 110 faceCount = o.faceCount;
111 faces = new u16[faceCount]; 111 faces = new u16[faceCount];
112 for (u32 i=0; i<faceCount; ++i) 112 for (u32 i=0; i<faceCount; ++i)
113 faces[i] = o.faces[i]; 113 faces[i] = o.faces[i];
114 } 114 }
115 115
116 core::stringc MaterialName; 116 core::stringc MaterialName;
117 u16 faceCount; 117 u16 faceCount;
118 u16* faces; 118 u16* faces;
119 }; 119 };
120 120
121 bool readChunk(io::IReadFile* file, ChunkData* parent); 121 bool readChunk(io::IReadFile* file, ChunkData* parent);
122 bool readMaterialChunk(io::IReadFile* file, ChunkData* parent); 122 bool readMaterialChunk(io::IReadFile* file, ChunkData* parent);
123 bool readFrameChunk(io::IReadFile* file, ChunkData* parent); 123 bool readFrameChunk(io::IReadFile* file, ChunkData* parent);
124 bool readTrackChunk(io::IReadFile* file, ChunkData& data, 124 bool readTrackChunk(io::IReadFile* file, ChunkData& data,
125 IMeshBuffer* mb, const core::vector3df& pivot); 125 IMeshBuffer* mb, const core::vector3df& pivot);
126 bool readObjectChunk(io::IReadFile* file, ChunkData* parent); 126 bool readObjectChunk(io::IReadFile* file, ChunkData* parent);
127 bool readPercentageChunk(io::IReadFile* file, ChunkData* chunk, f32& percentage); 127 bool readPercentageChunk(io::IReadFile* file, ChunkData* chunk, f32& percentage);
128 bool readColorChunk(io::IReadFile* file, ChunkData* chunk, video::SColor& out); 128 bool readColorChunk(io::IReadFile* file, ChunkData* chunk, video::SColor& out);
129 129
130 void readChunkData(io::IReadFile* file, ChunkData& data); 130 void readChunkData(io::IReadFile* file, ChunkData& data);
131 void readString(io::IReadFile* file, ChunkData& data, core::stringc& out); 131 void readString(io::IReadFile* file, ChunkData& data, core::stringc& out);
132 void readVertices(io::IReadFile* file, ChunkData& data); 132 void readVertices(io::IReadFile* file, ChunkData& data);
133 void readIndices(io::IReadFile* file, ChunkData& data); 133 void readIndices(io::IReadFile* file, ChunkData& data);
134 void readMaterialGroup(io::IReadFile* file, ChunkData& data); 134 void readMaterialGroup(io::IReadFile* file, ChunkData& data);
135 void readTextureCoords(io::IReadFile* file, ChunkData& data); 135 void readTextureCoords(io::IReadFile* file, ChunkData& data);
136 136
137 void composeObject(io::IReadFile* file, const core::stringc& name); 137 void composeObject(io::IReadFile* file, const core::stringc& name);
138 void loadMaterials(io::IReadFile* file); 138 void loadMaterials(io::IReadFile* file);
139 void cleanUp(); 139 void cleanUp();
140 140
141 scene::ISceneManager* SceneManager; 141 scene::ISceneManager* SceneManager;
142 io::IFileSystem* FileSystem; 142 io::IFileSystem* FileSystem;
143 143
144 f32* Vertices; 144 f32* Vertices;
145 u16* Indices; 145 u16* Indices;
146 u32* SmoothingGroups; 146 u32* SmoothingGroups;
147 core::array<u16> TempIndices; 147 core::array<u16> TempIndices;
148 f32* TCoords; 148 f32* TCoords;
149 u16 CountVertices; 149 u16 CountVertices;
150 u16 CountFaces; // = CountIndices/4 150 u16 CountFaces; // = CountIndices/4
151 u16 CountTCoords; 151 u16 CountTCoords;
152 core::array<SMaterialGroup> MaterialGroups; 152 core::array<SMaterialGroup> MaterialGroups;
153 153
154 SCurrentMaterial CurrentMaterial; 154 SCurrentMaterial CurrentMaterial;
155 core::array<SCurrentMaterial> Materials; 155 core::array<SCurrentMaterial> Materials;
156 core::array<core::stringc> MeshBufferNames; 156 core::array<core::stringc> MeshBufferNames;
157 core::matrix4 TransformationMatrix; 157 core::matrix4 TransformationMatrix;
158 158
159 SMesh* Mesh; 159 SMesh* Mesh;
160}; 160};
161 161
162} // end namespace scene 162} // end namespace scene
163} // end namespace irr 163} // end namespace irr
164 164
165#endif 165#endif
166 166