diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/include/SSharedMeshBuffer.h | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-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/include/SSharedMeshBuffer.h | 484 |
1 files changed, 242 insertions, 242 deletions
diff --git a/libraries/irrlicht-1.8/include/SSharedMeshBuffer.h b/libraries/irrlicht-1.8/include/SSharedMeshBuffer.h index b9ee07a..016b796 100644 --- a/libraries/irrlicht-1.8/include/SSharedMeshBuffer.h +++ b/libraries/irrlicht-1.8/include/SSharedMeshBuffer.h | |||
@@ -1,242 +1,242 @@ | |||
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 __S_SHARED_MESH_BUFFER_H_INCLUDED__ | 5 | #ifndef __S_SHARED_MESH_BUFFER_H_INCLUDED__ |
6 | #define __S_SHARED_MESH_BUFFER_H_INCLUDED__ | 6 | #define __S_SHARED_MESH_BUFFER_H_INCLUDED__ |
7 | 7 | ||
8 | #include "irrArray.h" | 8 | #include "irrArray.h" |
9 | #include "IMeshBuffer.h" | 9 | #include "IMeshBuffer.h" |
10 | 10 | ||
11 | namespace irr | 11 | namespace irr |
12 | { | 12 | { |
13 | namespace scene | 13 | namespace scene |
14 | { | 14 | { |
15 | //! Implementation of the IMeshBuffer interface with shared vertex list | 15 | //! Implementation of the IMeshBuffer interface with shared vertex list |
16 | struct SSharedMeshBuffer : public IMeshBuffer | 16 | struct SSharedMeshBuffer : public IMeshBuffer |
17 | { | 17 | { |
18 | //! constructor | 18 | //! constructor |
19 | SSharedMeshBuffer() : IMeshBuffer(), Vertices(0), ChangedID_Vertex(1), ChangedID_Index(1), MappingHintVertex(EHM_NEVER), MappingHintIndex(EHM_NEVER) | 19 | SSharedMeshBuffer() : IMeshBuffer(), Vertices(0), ChangedID_Vertex(1), ChangedID_Index(1), MappingHintVertex(EHM_NEVER), MappingHintIndex(EHM_NEVER) |
20 | { | 20 | { |
21 | #ifdef _DEBUG | 21 | #ifdef _DEBUG |
22 | setDebugName("SSharedMeshBuffer"); | 22 | setDebugName("SSharedMeshBuffer"); |
23 | #endif | 23 | #endif |
24 | } | 24 | } |
25 | 25 | ||
26 | //! constructor | 26 | //! constructor |
27 | SSharedMeshBuffer(core::array<video::S3DVertex> *vertices) : IMeshBuffer(), Vertices(vertices) | 27 | SSharedMeshBuffer(core::array<video::S3DVertex> *vertices) : IMeshBuffer(), Vertices(vertices) |
28 | { | 28 | { |
29 | #ifdef _DEBUG | 29 | #ifdef _DEBUG |
30 | setDebugName("SSharedMeshBuffer"); | 30 | setDebugName("SSharedMeshBuffer"); |
31 | #endif | 31 | #endif |
32 | } | 32 | } |
33 | 33 | ||
34 | //! returns the material of this meshbuffer | 34 | //! returns the material of this meshbuffer |
35 | virtual const video::SMaterial& getMaterial() const | 35 | virtual const video::SMaterial& getMaterial() const |
36 | { | 36 | { |
37 | return Material; | 37 | return Material; |
38 | } | 38 | } |
39 | 39 | ||
40 | //! returns the material of this meshbuffer | 40 | //! returns the material of this meshbuffer |
41 | virtual video::SMaterial& getMaterial() | 41 | virtual video::SMaterial& getMaterial() |
42 | { | 42 | { |
43 | return Material; | 43 | return Material; |
44 | } | 44 | } |
45 | 45 | ||
46 | //! returns pointer to vertices | 46 | //! returns pointer to vertices |
47 | virtual const void* getVertices() const | 47 | virtual const void* getVertices() const |
48 | { | 48 | { |
49 | if (Vertices) | 49 | if (Vertices) |
50 | return Vertices->const_pointer(); | 50 | return Vertices->const_pointer(); |
51 | else | 51 | else |
52 | return 0; | 52 | return 0; |
53 | } | 53 | } |
54 | 54 | ||
55 | //! returns pointer to vertices | 55 | //! returns pointer to vertices |
56 | virtual void* getVertices() | 56 | virtual void* getVertices() |
57 | { | 57 | { |
58 | if (Vertices) | 58 | if (Vertices) |
59 | return Vertices->pointer(); | 59 | return Vertices->pointer(); |
60 | else | 60 | else |
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | //! returns amount of vertices | 64 | //! returns amount of vertices |
65 | virtual u32 getVertexCount() const | 65 | virtual u32 getVertexCount() const |
66 | { | 66 | { |
67 | if (Vertices) | 67 | if (Vertices) |
68 | return Vertices->size(); | 68 | return Vertices->size(); |
69 | else | 69 | else |
70 | return 0; | 70 | return 0; |
71 | } | 71 | } |
72 | 72 | ||
73 | //! returns pointer to Indices | 73 | //! returns pointer to Indices |
74 | virtual const u16* getIndices() const | 74 | virtual const u16* getIndices() const |
75 | { | 75 | { |
76 | return Indices.const_pointer(); | 76 | return Indices.const_pointer(); |
77 | } | 77 | } |
78 | 78 | ||
79 | //! returns pointer to Indices | 79 | //! returns pointer to Indices |
80 | virtual u16* getIndices() | 80 | virtual u16* getIndices() |
81 | { | 81 | { |
82 | return Indices.pointer(); | 82 | return Indices.pointer(); |
83 | } | 83 | } |
84 | 84 | ||
85 | //! returns amount of indices | 85 | //! returns amount of indices |
86 | virtual u32 getIndexCount() const | 86 | virtual u32 getIndexCount() const |
87 | { | 87 | { |
88 | return Indices.size(); | 88 | return Indices.size(); |
89 | } | 89 | } |
90 | 90 | ||
91 | //! Get type of index data which is stored in this meshbuffer. | 91 | //! Get type of index data which is stored in this meshbuffer. |
92 | virtual video::E_INDEX_TYPE getIndexType() const | 92 | virtual video::E_INDEX_TYPE getIndexType() const |
93 | { | 93 | { |
94 | return video::EIT_16BIT; | 94 | return video::EIT_16BIT; |
95 | } | 95 | } |
96 | 96 | ||
97 | //! returns an axis aligned bounding box | 97 | //! returns an axis aligned bounding box |
98 | virtual const core::aabbox3d<f32>& getBoundingBox() const | 98 | virtual const core::aabbox3d<f32>& getBoundingBox() const |
99 | { | 99 | { |
100 | return BoundingBox; | 100 | return BoundingBox; |
101 | } | 101 | } |
102 | 102 | ||
103 | //! set user axis aligned bounding box | 103 | //! set user axis aligned bounding box |
104 | virtual void setBoundingBox( const core::aabbox3df& box) | 104 | virtual void setBoundingBox( const core::aabbox3df& box) |
105 | { | 105 | { |
106 | BoundingBox = box; | 106 | BoundingBox = box; |
107 | } | 107 | } |
108 | 108 | ||
109 | //! returns which type of vertex data is stored. | 109 | //! returns which type of vertex data is stored. |
110 | virtual video::E_VERTEX_TYPE getVertexType() const | 110 | virtual video::E_VERTEX_TYPE getVertexType() const |
111 | { | 111 | { |
112 | return video::EVT_STANDARD; | 112 | return video::EVT_STANDARD; |
113 | } | 113 | } |
114 | 114 | ||
115 | //! recalculates the bounding box. should be called if the mesh changed. | 115 | //! recalculates the bounding box. should be called if the mesh changed. |
116 | virtual void recalculateBoundingBox() | 116 | virtual void recalculateBoundingBox() |
117 | { | 117 | { |
118 | if (!Vertices || Vertices->empty() || Indices.empty()) | 118 | if (!Vertices || Vertices->empty() || Indices.empty()) |
119 | BoundingBox.reset(0,0,0); | 119 | BoundingBox.reset(0,0,0); |
120 | else | 120 | else |
121 | { | 121 | { |
122 | BoundingBox.reset((*Vertices)[Indices[0]].Pos); | 122 | BoundingBox.reset((*Vertices)[Indices[0]].Pos); |
123 | for (u32 i=1; i<Indices.size(); ++i) | 123 | for (u32 i=1; i<Indices.size(); ++i) |
124 | BoundingBox.addInternalPoint((*Vertices)[Indices[i]].Pos); | 124 | BoundingBox.addInternalPoint((*Vertices)[Indices[i]].Pos); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | //! returns position of vertex i | 128 | //! returns position of vertex i |
129 | virtual const core::vector3df& getPosition(u32 i) const | 129 | virtual const core::vector3df& getPosition(u32 i) const |
130 | { | 130 | { |
131 | _IRR_DEBUG_BREAK_IF(!Vertices); | 131 | _IRR_DEBUG_BREAK_IF(!Vertices); |
132 | return (*Vertices)[Indices[i]].Pos; | 132 | return (*Vertices)[Indices[i]].Pos; |
133 | } | 133 | } |
134 | 134 | ||
135 | //! returns position of vertex i | 135 | //! returns position of vertex i |
136 | virtual core::vector3df& getPosition(u32 i) | 136 | virtual core::vector3df& getPosition(u32 i) |
137 | { | 137 | { |
138 | _IRR_DEBUG_BREAK_IF(!Vertices); | 138 | _IRR_DEBUG_BREAK_IF(!Vertices); |
139 | return (*Vertices)[Indices[i]].Pos; | 139 | return (*Vertices)[Indices[i]].Pos; |
140 | } | 140 | } |
141 | 141 | ||
142 | //! returns normal of vertex i | 142 | //! returns normal of vertex i |
143 | virtual const core::vector3df& getNormal(u32 i) const | 143 | virtual const core::vector3df& getNormal(u32 i) const |
144 | { | 144 | { |
145 | _IRR_DEBUG_BREAK_IF(!Vertices); | 145 | _IRR_DEBUG_BREAK_IF(!Vertices); |
146 | return (*Vertices)[Indices[i]].Normal; | 146 | return (*Vertices)[Indices[i]].Normal; |
147 | } | 147 | } |
148 | 148 | ||
149 | //! returns normal of vertex i | 149 | //! returns normal of vertex i |
150 | virtual core::vector3df& getNormal(u32 i) | 150 | virtual core::vector3df& getNormal(u32 i) |
151 | { | 151 | { |
152 | _IRR_DEBUG_BREAK_IF(!Vertices); | 152 | _IRR_DEBUG_BREAK_IF(!Vertices); |
153 | return (*Vertices)[Indices[i]].Normal; | 153 | return (*Vertices)[Indices[i]].Normal; |
154 | } | 154 | } |
155 | 155 | ||
156 | //! returns texture coord of vertex i | 156 | //! returns texture coord of vertex i |
157 | virtual const core::vector2df& getTCoords(u32 i) const | 157 | virtual const core::vector2df& getTCoords(u32 i) const |
158 | { | 158 | { |
159 | _IRR_DEBUG_BREAK_IF(!Vertices); | 159 | _IRR_DEBUG_BREAK_IF(!Vertices); |
160 | return (*Vertices)[Indices[i]].TCoords; | 160 | return (*Vertices)[Indices[i]].TCoords; |
161 | } | 161 | } |
162 | 162 | ||
163 | //! returns texture coord of vertex i | 163 | //! returns texture coord of vertex i |
164 | virtual core::vector2df& getTCoords(u32 i) | 164 | virtual core::vector2df& getTCoords(u32 i) |
165 | { | 165 | { |
166 | _IRR_DEBUG_BREAK_IF(!Vertices); | 166 | _IRR_DEBUG_BREAK_IF(!Vertices); |
167 | return (*Vertices)[Indices[i]].TCoords; | 167 | return (*Vertices)[Indices[i]].TCoords; |
168 | } | 168 | } |
169 | 169 | ||
170 | //! append the vertices and indices to the current buffer | 170 | //! append the vertices and indices to the current buffer |
171 | virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) {} | 171 | virtual void append(const void* const vertices, u32 numVertices, const u16* const indices, u32 numIndices) {} |
172 | 172 | ||
173 | //! append the meshbuffer to the current buffer | 173 | //! append the meshbuffer to the current buffer |
174 | virtual void append(const IMeshBuffer* const other) {} | 174 | virtual void append(const IMeshBuffer* const other) {} |
175 | 175 | ||
176 | //! get the current hardware mapping hint | 176 | //! get the current hardware mapping hint |
177 | virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const | 177 | virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const |
178 | { | 178 | { |
179 | return MappingHintVertex; | 179 | return MappingHintVertex; |
180 | } | 180 | } |
181 | 181 | ||
182 | //! get the current hardware mapping hint | 182 | //! get the current hardware mapping hint |
183 | virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const | 183 | virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const |
184 | { | 184 | { |
185 | return MappingHintIndex; | 185 | return MappingHintIndex; |
186 | } | 186 | } |
187 | 187 | ||
188 | //! set the hardware mapping hint, for driver | 188 | //! set the hardware mapping hint, for driver |
189 | virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) | 189 | virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) |
190 | { | 190 | { |
191 | if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX) | 191 | if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX) |
192 | MappingHintVertex=NewMappingHint; | 192 | MappingHintVertex=NewMappingHint; |
193 | if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX) | 193 | if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX) |
194 | MappingHintIndex=NewMappingHint; | 194 | MappingHintIndex=NewMappingHint; |
195 | } | 195 | } |
196 | 196 | ||
197 | //! flags the mesh as changed, reloads hardware buffers | 197 | //! flags the mesh as changed, reloads hardware buffers |
198 | virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) | 198 | virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX) |
199 | { | 199 | { |
200 | if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX) | 200 | if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX) |
201 | ++ChangedID_Vertex; | 201 | ++ChangedID_Vertex; |
202 | if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX) | 202 | if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX) |
203 | ++ChangedID_Index; | 203 | ++ChangedID_Index; |
204 | } | 204 | } |
205 | 205 | ||
206 | //! Get the currently used ID for identification of changes. | 206 | //! Get the currently used ID for identification of changes. |
207 | /** This shouldn't be used for anything outside the VideoDriver. */ | 207 | /** This shouldn't be used for anything outside the VideoDriver. */ |
208 | virtual u32 getChangedID_Vertex() const {return ChangedID_Vertex;} | 208 | virtual u32 getChangedID_Vertex() const {return ChangedID_Vertex;} |
209 | 209 | ||
210 | //! Get the currently used ID for identification of changes. | 210 | //! Get the currently used ID for identification of changes. |
211 | /** This shouldn't be used for anything outside the VideoDriver. */ | 211 | /** This shouldn't be used for anything outside the VideoDriver. */ |
212 | virtual u32 getChangedID_Index() const {return ChangedID_Index;} | 212 | virtual u32 getChangedID_Index() const {return ChangedID_Index;} |
213 | 213 | ||
214 | //! Material of this meshBuffer | 214 | //! Material of this meshBuffer |
215 | video::SMaterial Material; | 215 | video::SMaterial Material; |
216 | 216 | ||
217 | //! Shared Array of vertices | 217 | //! Shared Array of vertices |
218 | core::array<video::S3DVertex> *Vertices; | 218 | core::array<video::S3DVertex> *Vertices; |
219 | 219 | ||
220 | //! Array of Indices | 220 | //! Array of Indices |
221 | core::array<u16> Indices; | 221 | core::array<u16> Indices; |
222 | 222 | ||
223 | //! ID used for hardware buffer management | 223 | //! ID used for hardware buffer management |
224 | u32 ChangedID_Vertex; | 224 | u32 ChangedID_Vertex; |
225 | 225 | ||
226 | //! ID used for hardware buffer management | 226 | //! ID used for hardware buffer management |
227 | u32 ChangedID_Index; | 227 | u32 ChangedID_Index; |
228 | 228 | ||
229 | //! Bounding box | 229 | //! Bounding box |
230 | core::aabbox3df BoundingBox; | 230 | core::aabbox3df BoundingBox; |
231 | 231 | ||
232 | //! hardware mapping hint | 232 | //! hardware mapping hint |
233 | E_HARDWARE_MAPPING MappingHintVertex; | 233 | E_HARDWARE_MAPPING MappingHintVertex; |
234 | E_HARDWARE_MAPPING MappingHintIndex; | 234 | E_HARDWARE_MAPPING MappingHintIndex; |
235 | }; | 235 | }; |
236 | 236 | ||
237 | 237 | ||
238 | } // end namespace scene | 238 | } // end namespace scene |
239 | } // end namespace irr | 239 | } // end namespace irr |
240 | 240 | ||
241 | #endif | 241 | #endif |
242 | 242 | ||