aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CPLYMeshFileLoader.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/CPLYMeshFileLoader.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/CPLYMeshFileLoader.h296
1 files changed, 148 insertions, 148 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CPLYMeshFileLoader.h b/libraries/irrlicht-1.8/source/Irrlicht/CPLYMeshFileLoader.h
index d916863..4304377 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/CPLYMeshFileLoader.h
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CPLYMeshFileLoader.h
@@ -1,148 +1,148 @@
1// Copyright (C) 2009-2012 Gaz Davidson 1// Copyright (C) 2009-2012 Gaz Davidson
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_PLY_MESH_FILE_LOADER_H_INCLUDED__ 5#ifndef __C_PLY_MESH_FILE_LOADER_H_INCLUDED__
6#define __C_PLY_MESH_FILE_LOADER_H_INCLUDED__ 6#define __C_PLY_MESH_FILE_LOADER_H_INCLUDED__
7 7
8#include "IMeshLoader.h" 8#include "IMeshLoader.h"
9#include "ISceneManager.h" 9#include "ISceneManager.h"
10#include "CDynamicMeshBuffer.h" 10#include "CDynamicMeshBuffer.h"
11 11
12namespace irr 12namespace irr
13{ 13{
14namespace scene 14namespace scene
15{ 15{
16 16
17enum E_PLY_PROPERTY_TYPE 17enum E_PLY_PROPERTY_TYPE
18{ 18{
19 EPLYPT_INT8 = 0, 19 EPLYPT_INT8 = 0,
20 EPLYPT_INT16, 20 EPLYPT_INT16,
21 EPLYPT_INT32, 21 EPLYPT_INT32,
22 EPLYPT_FLOAT32, 22 EPLYPT_FLOAT32,
23 EPLYPT_FLOAT64, 23 EPLYPT_FLOAT64,
24 EPLYPT_LIST, 24 EPLYPT_LIST,
25 EPLYPT_UNKNOWN 25 EPLYPT_UNKNOWN
26}; 26};
27 27
28//! Meshloader capable of loading obj meshes. 28//! Meshloader capable of loading obj meshes.
29class CPLYMeshFileLoader : public IMeshLoader 29class CPLYMeshFileLoader : public IMeshLoader
30{ 30{
31public: 31public:
32 32
33 //! Constructor 33 //! Constructor
34 CPLYMeshFileLoader(scene::ISceneManager* smgr); 34 CPLYMeshFileLoader(scene::ISceneManager* smgr);
35 35
36 //! Destructor 36 //! Destructor
37 virtual ~CPLYMeshFileLoader(); 37 virtual ~CPLYMeshFileLoader();
38 38
39 //! returns true if the file maybe is able to be loaded by this class 39 //! returns true if the file maybe is able to be loaded by this class
40 //! based on the file extension (e.g. ".ply") 40 //! based on the file extension (e.g. ".ply")
41 virtual bool isALoadableFileExtension(const io::path& filename) const; 41 virtual bool isALoadableFileExtension(const io::path& filename) const;
42 42
43 //! creates/loads an animated mesh from the file. 43 //! creates/loads an animated mesh from the file.
44 virtual IAnimatedMesh* createMesh(io::IReadFile* file); 44 virtual IAnimatedMesh* createMesh(io::IReadFile* file);
45 45
46private: 46private:
47 47
48 struct SPLYProperty 48 struct SPLYProperty
49 { 49 {
50 core::stringc Name; 50 core::stringc Name;
51 E_PLY_PROPERTY_TYPE Type; 51 E_PLY_PROPERTY_TYPE Type;
52 union 52 union
53 { 53 {
54 u8 Int8; 54 u8 Int8;
55 u16 Int16; 55 u16 Int16;
56 u32 Int32; 56 u32 Int32;
57 f32 Float32; 57 f32 Float32;
58 f64 Double; 58 f64 Double;
59 struct SPLYListProperty 59 struct SPLYListProperty
60 { 60 {
61 E_PLY_PROPERTY_TYPE CountType; 61 E_PLY_PROPERTY_TYPE CountType;
62 E_PLY_PROPERTY_TYPE ItemType; 62 E_PLY_PROPERTY_TYPE ItemType;
63 } List; 63 } List;
64 64
65 } Data; 65 } Data;
66 66
67 inline u32 size() const 67 inline u32 size() const
68 { 68 {
69 switch(Type) 69 switch(Type)
70 { 70 {
71 case EPLYPT_INT8: 71 case EPLYPT_INT8:
72 return 1; 72 return 1;
73 case EPLYPT_INT16: 73 case EPLYPT_INT16:
74 return 2; 74 return 2;
75 case EPLYPT_INT32: 75 case EPLYPT_INT32:
76 case EPLYPT_FLOAT32: 76 case EPLYPT_FLOAT32:
77 return 4; 77 return 4;
78 case EPLYPT_FLOAT64: 78 case EPLYPT_FLOAT64:
79 return 8; 79 return 8;
80 case EPLYPT_LIST: 80 case EPLYPT_LIST:
81 case EPLYPT_UNKNOWN: 81 case EPLYPT_UNKNOWN:
82 default: 82 default:
83 return 0; 83 return 0;
84 } 84 }
85 } 85 }
86 86
87 inline bool isFloat() const 87 inline bool isFloat() const
88 { 88 {
89 switch(Type) 89 switch(Type)
90 { 90 {
91 case EPLYPT_FLOAT32: 91 case EPLYPT_FLOAT32:
92 case EPLYPT_FLOAT64: 92 case EPLYPT_FLOAT64:
93 return true; 93 return true;
94 case EPLYPT_INT8: 94 case EPLYPT_INT8:
95 case EPLYPT_INT16: 95 case EPLYPT_INT16:
96 case EPLYPT_INT32: 96 case EPLYPT_INT32:
97 case EPLYPT_LIST: 97 case EPLYPT_LIST:
98 case EPLYPT_UNKNOWN: 98 case EPLYPT_UNKNOWN:
99 default: 99 default:
100 return false; 100 return false;
101 } 101 }
102 } 102 }
103 }; 103 };
104 104
105 struct SPLYElement 105 struct SPLYElement
106 { 106 {
107 // name of the element. We only want "vertex" and "face" elements 107 // name of the element. We only want "vertex" and "face" elements
108 // but we have to parse the others anyway. 108 // but we have to parse the others anyway.
109 core::stringc Name; 109 core::stringc Name;
110 // The number of elements in the file 110 // The number of elements in the file
111 u32 Count; 111 u32 Count;
112 // Properties of this element 112 // Properties of this element
113 core::array<SPLYProperty> Properties; 113 core::array<SPLYProperty> Properties;
114 // in binary files, true if this is a fixed size 114 // in binary files, true if this is a fixed size
115 bool IsFixedWidth; 115 bool IsFixedWidth;
116 // known size in bytes, 0 if unknown 116 // known size in bytes, 0 if unknown
117 u32 KnownSize; 117 u32 KnownSize;
118 }; 118 };
119 119
120 bool allocateBuffer(); 120 bool allocateBuffer();
121 c8* getNextLine(); 121 c8* getNextLine();
122 c8* getNextWord(); 122 c8* getNextWord();
123 void fillBuffer(); 123 void fillBuffer();
124 E_PLY_PROPERTY_TYPE getPropertyType(const c8* typeString) const; 124 E_PLY_PROPERTY_TYPE getPropertyType(const c8* typeString) const;
125 125
126 bool readVertex(const SPLYElement &Element, scene::CDynamicMeshBuffer* mb); 126 bool readVertex(const SPLYElement &Element, scene::CDynamicMeshBuffer* mb);
127 bool readFace(const SPLYElement &Element, scene::CDynamicMeshBuffer* mb); 127 bool readFace(const SPLYElement &Element, scene::CDynamicMeshBuffer* mb);
128 void skipElement(const SPLYElement &Element); 128 void skipElement(const SPLYElement &Element);
129 void skipProperty(const SPLYProperty &Property); 129 void skipProperty(const SPLYProperty &Property);
130 f32 getFloat(E_PLY_PROPERTY_TYPE t); 130 f32 getFloat(E_PLY_PROPERTY_TYPE t);
131 u32 getInt(E_PLY_PROPERTY_TYPE t); 131 u32 getInt(E_PLY_PROPERTY_TYPE t);
132 void moveForward(u32 bytes); 132 void moveForward(u32 bytes);
133 133
134 core::array<SPLYElement*> ElementList; 134 core::array<SPLYElement*> ElementList;
135 135
136 scene::ISceneManager* SceneManager; 136 scene::ISceneManager* SceneManager;
137 io::IReadFile *File; 137 io::IReadFile *File;
138 c8 *Buffer; 138 c8 *Buffer;
139 bool IsBinaryFile, IsWrongEndian, EndOfFile; 139 bool IsBinaryFile, IsWrongEndian, EndOfFile;
140 s32 LineLength, WordLength; 140 s32 LineLength, WordLength;
141 c8 *StartPointer, *EndPointer, *LineEndPointer; 141 c8 *StartPointer, *EndPointer, *LineEndPointer;
142}; 142};
143 143
144} // end namespace scene 144} // end namespace scene
145} // end namespace irr 145} // end namespace irr
146 146
147#endif 147#endif
148 148