1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright (c) 2000-2013 Torus Knot Software Ltd |
---|
8 | |
---|
9 | Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
10 | of this software and associated documentation files (the "Software"), to deal |
---|
11 | in the Software without restriction, including without limitation the rights |
---|
12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
13 | copies of the Software, and to permit persons to whom the Software is |
---|
14 | furnished to do so, subject to the following conditions: |
---|
15 | |
---|
16 | The above copyright notice and this permission notice shall be included in |
---|
17 | all copies or substantial portions of the Software. |
---|
18 | |
---|
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
25 | THE SOFTWARE. |
---|
26 | ----------------------------------------------------------------------------- |
---|
27 | */ |
---|
28 | #ifndef __MeshManager_H__ |
---|
29 | #define __MeshManager_H__ |
---|
30 | |
---|
31 | #include "OgrePrerequisites.h" |
---|
32 | |
---|
33 | #include "OgreResourceManager.h" |
---|
34 | #include "OgreSingleton.h" |
---|
35 | #include "OgreVector3.h" |
---|
36 | #include "OgreHardwareBuffer.h" |
---|
37 | #include "OgreMesh.h" |
---|
38 | #include "OgrePatchMesh.h" |
---|
39 | #include "OgreHeaderPrefix.h" |
---|
40 | |
---|
41 | namespace Ogre { |
---|
42 | |
---|
43 | class MeshSerializerListener; |
---|
44 | |
---|
45 | /** \addtogroup Core |
---|
46 | * @{ |
---|
47 | */ |
---|
48 | /** \addtogroup Resources |
---|
49 | * @{ |
---|
50 | */ |
---|
51 | /** Handles the management of mesh resources. |
---|
52 | @remarks |
---|
53 | This class deals with the runtime management of |
---|
54 | mesh data; like other resource managers it handles |
---|
55 | the creation of resources (in this case mesh data), |
---|
56 | working within a fixed memory budget. |
---|
57 | */ |
---|
58 | class _OgreExport MeshManager: public ResourceManager, public Singleton<MeshManager>, |
---|
59 | public ManualResourceLoader |
---|
60 | { |
---|
61 | public: |
---|
62 | MeshManager(); |
---|
63 | ~MeshManager(); |
---|
64 | |
---|
65 | /** Initialises the manager, only to be called by OGRE internally. */ |
---|
66 | void _initialise(void); |
---|
67 | |
---|
68 | /// Get a resource by name |
---|
69 | /// @see ResourceManager::getResourceByName |
---|
70 | MeshPtr getByName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME); |
---|
71 | |
---|
72 | |
---|
73 | /// Create a new mesh |
---|
74 | /// @see ResourceManager::createResource |
---|
75 | MeshPtr create (const String& name, const String& group, |
---|
76 | bool isManual = false, ManualResourceLoader* loader = 0, |
---|
77 | const NameValuePairList* createParams = 0); |
---|
78 | |
---|
79 | /** Create a new mesh, or retrieve an existing one with the same |
---|
80 | name if it already exists. |
---|
81 | @param vertexBufferUsage The usage flags with which the vertex buffer(s) |
---|
82 | will be created |
---|
83 | @param indexBufferUsage The usage flags with which the index buffer(s) created for |
---|
84 | this mesh will be created with. |
---|
85 | @param vertexBufferShadowed If true, the vertex buffers will be shadowed by system memory |
---|
86 | copies for faster read access |
---|
87 | @param indexBufferShadowed If true, the index buffers will be shadowed by system memory |
---|
88 | copies for faster read access |
---|
89 | @see ResourceManager::createOrRetrieve |
---|
90 | */ |
---|
91 | ResourceCreateOrRetrieveResult createOrRetrieve( |
---|
92 | const String& name, |
---|
93 | const String& group, |
---|
94 | bool isManual=false, ManualResourceLoader* loader=0, |
---|
95 | const NameValuePairList* params=0, |
---|
96 | HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
97 | HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
98 | bool vertexBufferShadowed = true, bool indexBufferShadowed = true); |
---|
99 | |
---|
100 | /** Prepares a mesh for loading from a file. This does the IO in advance of the call to load(). |
---|
101 | @note |
---|
102 | If the model has already been created (prepared or loaded), the existing instance |
---|
103 | will be returned. |
---|
104 | @remarks |
---|
105 | Ogre loads model files from it's own proprietary |
---|
106 | format called .mesh. This is because having a single file |
---|
107 | format is better for runtime performance, and we also have |
---|
108 | control over pre-processed data (such as |
---|
109 | collision boxes, LOD reductions etc). |
---|
110 | @param filename The name of the .mesh file |
---|
111 | @param groupName The name of the resource group to assign the mesh to |
---|
112 | @param vertexBufferUsage The usage flags with which the vertex buffer(s) |
---|
113 | will be created |
---|
114 | @param indexBufferUsage The usage flags with which the index buffer(s) created for |
---|
115 | this mesh will be created with. |
---|
116 | @param vertexBufferShadowed If true, the vertex buffers will be shadowed by system memory |
---|
117 | copies for faster read access |
---|
118 | @param indexBufferShadowed If true, the index buffers will be shadowed by system memory |
---|
119 | copies for faster read access |
---|
120 | */ |
---|
121 | MeshPtr prepare( const String& filename, const String& groupName, |
---|
122 | HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
123 | HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
124 | bool vertexBufferShadowed = true, bool indexBufferShadowed = true); |
---|
125 | |
---|
126 | /** Loads a mesh from a file, making it immediately available for use. |
---|
127 | @note |
---|
128 | If the model has already been created (prepared or loaded), the existing instance |
---|
129 | will be returned. |
---|
130 | @remarks |
---|
131 | Ogre loads model files from it's own proprietary |
---|
132 | format called .mesh. This is because having a single file |
---|
133 | format is better for runtime performance, and we also have |
---|
134 | control over pre-processed data (such as |
---|
135 | collision boxes, LOD reductions etc). |
---|
136 | @param filename The name of the .mesh file |
---|
137 | @param groupName The name of the resource group to assign the mesh to |
---|
138 | @param vertexBufferUsage The usage flags with which the vertex buffer(s) |
---|
139 | will be created |
---|
140 | @param indexBufferUsage The usage flags with which the index buffer(s) created for |
---|
141 | this mesh will be created with. |
---|
142 | @param vertexBufferShadowed If true, the vertex buffers will be shadowed by system memory |
---|
143 | copies for faster read access |
---|
144 | @param indexBufferShadowed If true, the index buffers will be shadowed by system memory |
---|
145 | copies for faster read access |
---|
146 | */ |
---|
147 | MeshPtr load( const String& filename, const String& groupName, |
---|
148 | HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
149 | HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
150 | bool vertexBufferShadowed = true, bool indexBufferShadowed = true); |
---|
151 | |
---|
152 | |
---|
153 | /** Creates a new Mesh specifically for manual definition rather |
---|
154 | than loading from an object file. |
---|
155 | @remarks |
---|
156 | Note that once you've defined your mesh, you must call Mesh::_setBounds and |
---|
157 | Mesh::_setBoundingRadius in order to define the bounds of your mesh. In previous |
---|
158 | versions of OGRE you could call Mesh::_updateBounds, but OGRE's support of |
---|
159 | write-only vertex buffers makes this no longer appropriate. |
---|
160 | @param name The name to give the new mesh |
---|
161 | @param groupName The name of the resource group to assign the mesh to |
---|
162 | @param loader ManualResourceLoader which will be called to load this mesh |
---|
163 | when the time comes. It is recommended that you populate this field |
---|
164 | in order that the mesh can be rebuilt should the need arise |
---|
165 | */ |
---|
166 | MeshPtr createManual( const String& name, const String& groupName, |
---|
167 | ManualResourceLoader* loader = 0); |
---|
168 | |
---|
169 | /** Creates a basic plane, by default majoring on the x/y axes facing positive Z. |
---|
170 | @param |
---|
171 | name The name to give the resulting mesh |
---|
172 | @param |
---|
173 | groupName The name of the resource group to assign the mesh to |
---|
174 | @param |
---|
175 | plane The orientation of the plane and distance from the origin |
---|
176 | @param |
---|
177 | width The width of the plane in world coordinates |
---|
178 | @param |
---|
179 | height The height of the plane in world coordinates |
---|
180 | @param |
---|
181 | xsegments The number of segments to the plane in the x direction |
---|
182 | @param |
---|
183 | ysegments The number of segments to the plane in the y direction |
---|
184 | @param |
---|
185 | normals If true, normals are created perpendicular to the plane |
---|
186 | @param |
---|
187 | numTexCoordSets The number of 2D texture coordinate sets created - by default the corners |
---|
188 | are created to be the corner of the texture. |
---|
189 | @param |
---|
190 | uTile The number of times the texture should be repeated in the u direction |
---|
191 | @param |
---|
192 | vTile The number of times the texture should be repeated in the v direction |
---|
193 | @param |
---|
194 | upVector The 'Up' direction of the plane texture coordinates. |
---|
195 | @param |
---|
196 | vertexBufferUsage The usage flag with which the vertex buffer for this plane will be created |
---|
197 | @param |
---|
198 | indexBufferUsage The usage flag with which the index buffer for this plane will be created |
---|
199 | @param |
---|
200 | vertexShadowBuffer If this flag is set to true, the vertex buffer will be created |
---|
201 | with a system memory shadow buffer, |
---|
202 | allowing you to read it back more efficiently than if it is in hardware |
---|
203 | @param |
---|
204 | indexShadowBuffer If this flag is set to true, the index buffer will be |
---|
205 | created with a system memory shadow buffer, |
---|
206 | allowing you to read it back more efficiently than if it is in hardware |
---|
207 | */ |
---|
208 | MeshPtr createPlane( |
---|
209 | const String& name, const String& groupName, const Plane& plane, |
---|
210 | Real width, Real height, |
---|
211 | int xsegments = 1, int ysegments = 1, |
---|
212 | bool normals = true, unsigned short numTexCoordSets = 1, |
---|
213 | Real uTile = 1.0f, Real vTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y, |
---|
214 | HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
215 | HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
216 | bool vertexShadowBuffer = true, bool indexShadowBuffer = true); |
---|
217 | |
---|
218 | |
---|
219 | /** Creates a plane, which because of it's texture coordinates looks like a curved |
---|
220 | surface, useful for skies in a skybox. |
---|
221 | @param name |
---|
222 | The name to give the resulting mesh |
---|
223 | @param groupName |
---|
224 | The name of the resource group to assign the mesh to |
---|
225 | @param plane |
---|
226 | The orientation of the plane and distance from the origin |
---|
227 | @param width |
---|
228 | The width of the plane in world coordinates |
---|
229 | @param height |
---|
230 | The height of the plane in world coordinates |
---|
231 | @param curvature |
---|
232 | The curvature of the plane. Good values are |
---|
233 | between 2 and 65. Higher values are more curved leading to |
---|
234 | a smoother effect, lower values are less curved meaning |
---|
235 | more distortion at the horizons but a better distance effect. |
---|
236 | @param xsegments |
---|
237 | The number of segments to the plane in the x direction |
---|
238 | @param ysegments |
---|
239 | The number of segments to the plane in the y direction |
---|
240 | @param normals |
---|
241 | If true, normals are created perpendicular to the plane |
---|
242 | @param numTexCoordSets |
---|
243 | The number of 2D texture coordinate sets created - by default the corners |
---|
244 | are created to be the corner of the texture. |
---|
245 | @param uTile |
---|
246 | The number of times the texture should be repeated in the u direction |
---|
247 | @param vTile |
---|
248 | The number of times the texture should be repeated in the v direction |
---|
249 | @param upVector |
---|
250 | The 'Up' direction of the plane. |
---|
251 | @param orientation |
---|
252 | The orientation of the overall sphere that's used to create the illusion |
---|
253 | @param vertexBufferUsage |
---|
254 | The usage flag with which the vertex buffer for this plane will be created |
---|
255 | @param indexBufferUsage |
---|
256 | The usage flag with which the index buffer for this plane will be created |
---|
257 | @param vertexShadowBuffer |
---|
258 | If this flag is set to true, the vertex buffer will be created |
---|
259 | with a system memory shadow buffer, |
---|
260 | allowing you to read it back more efficiently than if it is in hardware |
---|
261 | @param indexShadowBuffer |
---|
262 | If this flag is set to true, the index buffer will be |
---|
263 | created with a system memory shadow buffer, |
---|
264 | allowing you to read it back more efficiently than if it is in hardware |
---|
265 | @param ySegmentsToKeep The number of segments from the top of the dome |
---|
266 | downwards to keep. -1 keeps all of them. This can save fillrate if |
---|
267 | you cannot see much of the sky lower down. |
---|
268 | */ |
---|
269 | MeshPtr createCurvedIllusionPlane( |
---|
270 | const String& name, const String& groupName, const Plane& plane, |
---|
271 | Real width, Real height, Real curvature, |
---|
272 | int xsegments = 1, int ysegments = 1, |
---|
273 | bool normals = true, unsigned short numTexCoordSets = 1, |
---|
274 | Real uTile = 1.0f, Real vTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y, |
---|
275 | const Quaternion& orientation = Quaternion::IDENTITY, |
---|
276 | HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
277 | HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
278 | bool vertexShadowBuffer = true, bool indexShadowBuffer = true, |
---|
279 | int ySegmentsToKeep = -1); |
---|
280 | |
---|
281 | /** Creates a genuinely curved plane, by default majoring on the x/y axes facing positive Z. |
---|
282 | @param name |
---|
283 | The name to give the resulting mesh |
---|
284 | @param groupName |
---|
285 | The name of the resource group to assign the mesh to |
---|
286 | @param plane |
---|
287 | The orientation of the plane and distance from the origin |
---|
288 | @param width |
---|
289 | The width of the plane in world coordinates |
---|
290 | @param height |
---|
291 | The height of the plane in world coordinates |
---|
292 | @param bow |
---|
293 | The amount of 'bow' in the curved plane. (Could also be considered the depth.) |
---|
294 | @param xsegments |
---|
295 | The number of segments to the plane in the x direction |
---|
296 | @param ysegments |
---|
297 | The number of segments to the plane in the y direction |
---|
298 | @param normals |
---|
299 | If true, normals are created perpendicular to the plane |
---|
300 | @param numTexCoordSets |
---|
301 | The number of 2D texture coordinate sets created - by default the corners |
---|
302 | are created to be the corner of the texture. |
---|
303 | @param uTile |
---|
304 | The number of times the texture should be repeated in the u direction |
---|
305 | @param vTile |
---|
306 | The number of times the texture should be repeated in the v direction |
---|
307 | @param upVector |
---|
308 | The 'Up' direction of the plane. |
---|
309 | @param vertexBufferUsage |
---|
310 | The usage flag with which the vertex buffer for this plane will be created |
---|
311 | @param indexBufferUsage |
---|
312 | The usage flag with which the index buffer for this plane will be created |
---|
313 | @param vertexShadowBuffer |
---|
314 | If this flag is set to true, the vertex buffer will be created |
---|
315 | with a system memory shadow buffer, |
---|
316 | allowing you to read it back more efficiently than if it is in hardware |
---|
317 | @param indexShadowBuffer |
---|
318 | If this flag is set to true, the index buffer will be |
---|
319 | created with a system memory shadow buffer, |
---|
320 | allowing you to read it back more efficiently than if it is in hardware |
---|
321 | */ |
---|
322 | MeshPtr createCurvedPlane( |
---|
323 | const String& name, const String& groupName, const Plane& plane, |
---|
324 | Real width, Real height, Real bow = 0.5f, |
---|
325 | int xsegments = 1, int ysegments = 1, |
---|
326 | bool normals = false, unsigned short numTexCoordSets = 1, |
---|
327 | Real uTile = 1.0f, Real vTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y, |
---|
328 | HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
329 | HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
330 | bool vertexShadowBuffer = true, bool indexShadowBuffer = true); |
---|
331 | |
---|
332 | /** Creates a Bezier patch based on an array of control vertices. |
---|
333 | @param name |
---|
334 | The name to give the newly created mesh. |
---|
335 | @param groupName |
---|
336 | The name of the resource group to assign the mesh to |
---|
337 | @param controlPointBuffer |
---|
338 | A pointer to a buffer containing the vertex data which defines control points |
---|
339 | of the curves rather than actual vertices. Note that you are expected to provide not |
---|
340 | just position information, but potentially normals and texture coordinates too. The |
---|
341 | format of the buffer is defined in the VertexDeclaration parameter |
---|
342 | @param declaration |
---|
343 | VertexDeclaration describing the contents of the buffer. |
---|
344 | Note this declaration must _only_ draw on buffer source 0! |
---|
345 | @param width |
---|
346 | Specifies the width of the patch in control points. |
---|
347 | Note this parameter must greater than or equal to 3. |
---|
348 | @param height |
---|
349 | Specifies the height of the patch in control points. |
---|
350 | Note this parameter must greater than or equal to 3. |
---|
351 | @param uMaxSubdivisionLevel, vMaxSubdivisionLevel |
---|
352 | If you want to manually set the top level of subdivision, |
---|
353 | do it here, otherwise let the system decide. |
---|
354 | @param visibleSide |
---|
355 | Determines which side of the patch (or both) triangles are generated for. |
---|
356 | @param vbUsage |
---|
357 | Vertex buffer usage flags. Recommend the default since vertex buffer should be static. |
---|
358 | @param ibUsage |
---|
359 | Index buffer usage flags. Recommend the default since index buffer should |
---|
360 | be dynamic to change levels but not readable. |
---|
361 | @param vbUseShadow |
---|
362 | Flag to determine if a shadow buffer is generated for the vertex buffer. See |
---|
363 | HardwareBuffer for full details. |
---|
364 | @param ibUseShadow |
---|
365 | Flag to determine if a shadow buffer is generated for the index buffer. See |
---|
366 | HardwareBuffer for full details. |
---|
367 | */ |
---|
368 | PatchMeshPtr createBezierPatch( |
---|
369 | const String& name, const String& groupName, void* controlPointBuffer, |
---|
370 | VertexDeclaration *declaration, size_t width, size_t height, |
---|
371 | size_t uMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL, |
---|
372 | size_t vMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL, |
---|
373 | PatchSurface::VisibleSide visibleSide = PatchSurface::VS_FRONT, |
---|
374 | HardwareBuffer::Usage vbUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
375 | HardwareBuffer::Usage ibUsage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, |
---|
376 | bool vbUseShadow = true, bool ibUseShadow = true); |
---|
377 | |
---|
378 | /** Tells the mesh manager that all future meshes should prepare themselves for |
---|
379 | shadow volumes on loading. |
---|
380 | */ |
---|
381 | void setPrepareAllMeshesForShadowVolumes(bool enable); |
---|
382 | /** Retrieves whether all Meshes should prepare themselves for shadow volumes. */ |
---|
383 | bool getPrepareAllMeshesForShadowVolumes(void); |
---|
384 | |
---|
385 | /** Override standard Singleton retrieval. |
---|
386 | @remarks |
---|
387 | Why do we do this? Well, it's because the Singleton |
---|
388 | implementation is in a .h file, which means it gets compiled |
---|
389 | into anybody who includes it. This is needed for the |
---|
390 | Singleton template to work, but we actually only want it |
---|
391 | compiled into the implementation of the class based on the |
---|
392 | Singleton, not all of them. If we don't change this, we get |
---|
393 | link errors when trying to use the Singleton-based class from |
---|
394 | an outside dll. |
---|
395 | @par |
---|
396 | This method just delegates to the template version anyway, |
---|
397 | but the implementation stays in this single compilation unit, |
---|
398 | preventing link errors. |
---|
399 | */ |
---|
400 | static MeshManager& getSingleton(void); |
---|
401 | /** Override standard Singleton retrieval. |
---|
402 | @remarks |
---|
403 | Why do we do this? Well, it's because the Singleton |
---|
404 | implementation is in a .h file, which means it gets compiled |
---|
405 | into anybody who includes it. This is needed for the |
---|
406 | Singleton template to work, but we actually only want it |
---|
407 | compiled into the implementation of the class based on the |
---|
408 | Singleton, not all of them. If we don't change this, we get |
---|
409 | link errors when trying to use the Singleton-based class from |
---|
410 | an outside dll. |
---|
411 | @par |
---|
412 | This method just delegates to the template version anyway, |
---|
413 | but the implementation stays in this single compilation unit, |
---|
414 | preventing link errors. |
---|
415 | */ |
---|
416 | static MeshManager* getSingletonPtr(void); |
---|
417 | |
---|
418 | /** Gets the factor by which the bounding box of an entity is padded. |
---|
419 | Default is 0.01 |
---|
420 | */ |
---|
421 | Real getBoundsPaddingFactor(void); |
---|
422 | |
---|
423 | /** Sets the factor by which the bounding box of an entity is padded |
---|
424 | */ |
---|
425 | void setBoundsPaddingFactor(Real paddingFactor); |
---|
426 | |
---|
427 | /** Sets the listener used to control mesh loading through the serializer. |
---|
428 | */ |
---|
429 | void setListener(MeshSerializerListener *listener); |
---|
430 | |
---|
431 | /** Gets the listener used to control mesh loading through the serializer. |
---|
432 | */ |
---|
433 | MeshSerializerListener *getListener(); |
---|
434 | |
---|
435 | /** @see ManualResourceLoader::loadResource */ |
---|
436 | void loadResource(Resource* res); |
---|
437 | |
---|
438 | protected: |
---|
439 | /// @copydoc ResourceManager::createImpl |
---|
440 | Resource* createImpl(const String& name, ResourceHandle handle, |
---|
441 | const String& group, bool isManual, ManualResourceLoader* loader, |
---|
442 | const NameValuePairList* createParams); |
---|
443 | |
---|
444 | /** Utility method for tessellating 2D meshes. |
---|
445 | */ |
---|
446 | void tesselate2DMesh(SubMesh* pSub, unsigned short meshWidth, unsigned short meshHeight, |
---|
447 | bool doubleSided = false, |
---|
448 | HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, |
---|
449 | bool indexSysMem = false); |
---|
450 | |
---|
451 | void createPrefabPlane(void); |
---|
452 | void createPrefabCube(void); |
---|
453 | void createPrefabSphere(void); |
---|
454 | |
---|
455 | /** Enum identifying the types of manual mesh built by this manager */ |
---|
456 | enum MeshBuildType |
---|
457 | { |
---|
458 | MBT_PLANE, |
---|
459 | MBT_CURVED_ILLUSION_PLANE, |
---|
460 | MBT_CURVED_PLANE |
---|
461 | }; |
---|
462 | /** Saved parameters used to (re)build a manual mesh built by this class */ |
---|
463 | struct MeshBuildParams |
---|
464 | { |
---|
465 | MeshBuildType type; |
---|
466 | Plane plane; |
---|
467 | Real width; |
---|
468 | Real height; |
---|
469 | Real curvature; |
---|
470 | int xsegments; |
---|
471 | int ysegments; |
---|
472 | bool normals; |
---|
473 | unsigned short numTexCoordSets; |
---|
474 | Real xTile; |
---|
475 | Real yTile; |
---|
476 | Vector3 upVector; |
---|
477 | Quaternion orientation; |
---|
478 | HardwareBuffer::Usage vertexBufferUsage; |
---|
479 | HardwareBuffer::Usage indexBufferUsage; |
---|
480 | bool vertexShadowBuffer; |
---|
481 | bool indexShadowBuffer; |
---|
482 | int ySegmentsToKeep; |
---|
483 | }; |
---|
484 | /** Map from resource pointer to parameter set */ |
---|
485 | typedef map<Resource*, MeshBuildParams>::type MeshBuildParamsMap; |
---|
486 | MeshBuildParamsMap mMeshBuildParams; |
---|
487 | |
---|
488 | /** Utility method for manual loading a plane */ |
---|
489 | void loadManualPlane(Mesh* pMesh, MeshBuildParams& params); |
---|
490 | /** Utility method for manual loading a curved plane */ |
---|
491 | void loadManualCurvedPlane(Mesh* pMesh, MeshBuildParams& params); |
---|
492 | /** Utility method for manual loading a curved illusion plane */ |
---|
493 | void loadManualCurvedIllusionPlane(Mesh* pMesh, MeshBuildParams& params); |
---|
494 | |
---|
495 | bool mPrepAllMeshesForShadowVolumes; |
---|
496 | |
---|
497 | //the factor by which the bounding box of an entity is padded |
---|
498 | Real mBoundsPaddingFactor; |
---|
499 | |
---|
500 | // The listener to pass to serializers |
---|
501 | MeshSerializerListener *mListener; |
---|
502 | }; |
---|
503 | |
---|
504 | /** @} */ |
---|
505 | /** @} */ |
---|
506 | |
---|
507 | } //namespace |
---|
508 | |
---|
509 | #include "OgreHeaderSuffix.h" |
---|
510 | |
---|
511 | #endif |
---|