| [148] | 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 __PatchMesh_H__ | 
|---|
 | 29 | #define __PatchMesh_H__ | 
|---|
 | 30 |  | 
|---|
 | 31 | #include "OgrePrerequisites.h" | 
|---|
 | 32 | #include "OgreMesh.h" | 
|---|
 | 33 | #include "OgrePatchSurface.h" | 
|---|
 | 34 |  | 
|---|
 | 35 | namespace Ogre { | 
|---|
 | 36 |  | 
|---|
 | 37 |         /** \addtogroup Core | 
|---|
 | 38 |         *  @{ | 
|---|
 | 39 |         */ | 
|---|
 | 40 |         /** \addtogroup LOD | 
|---|
 | 41 |         *  @{ | 
|---|
 | 42 |         */ | 
|---|
 | 43 |         /** Patch specialisation of Mesh.  | 
|---|
 | 44 |     @remarks | 
|---|
 | 45 |         Instances of this class should be created by calling MeshManager::createBezierPatch. | 
|---|
 | 46 |     */ | 
|---|
 | 47 |     class _OgreExport PatchMesh : public Mesh | 
|---|
 | 48 |     { | 
|---|
 | 49 |     protected: | 
|---|
 | 50 |         /// Internal surface definition | 
|---|
 | 51 |         PatchSurface mSurface; | 
|---|
 | 52 |         /// Vertex declaration, cloned from the input | 
|---|
 | 53 |         VertexDeclaration* mDeclaration; | 
|---|
 | 54 |     public: | 
|---|
 | 55 |         /// Constructor | 
|---|
 | 56 |         PatchMesh(ResourceManager* creator, const String& name, ResourceHandle handle, | 
|---|
 | 57 |             const String& group); | 
|---|
 | 58 |         /// Update the mesh with new control points positions. | 
|---|
 | 59 |                 void update(void* controlPointBuffer, size_t width, size_t height,  | 
|---|
 | 60 |                     size_t uMaxSubdivisionLevel, size_t vMaxSubdivisionLevel,  | 
|---|
 | 61 |                     PatchSurface::VisibleSide visibleSide); | 
|---|
 | 62 |         /// Define the patch, as defined in MeshManager::createBezierPatch | 
|---|
 | 63 |         void define(void* controlPointBuffer,  | 
|---|
 | 64 |             VertexDeclaration *declaration, size_t width, size_t height, | 
|---|
 | 65 |             size_t uMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL,  | 
|---|
 | 66 |             size_t vMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL, | 
|---|
 | 67 |             PatchSurface::VisibleSide visibleSide = PatchSurface::VS_FRONT, | 
|---|
 | 68 |             HardwareBuffer::Usage vbUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,  | 
|---|
 | 69 |             HardwareBuffer::Usage ibUsage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, | 
|---|
 | 70 |             bool vbUseShadow = false, bool ibUseShadow = false); | 
|---|
 | 71 |  | 
|---|
 | 72 |         /* Sets the current subdivision level as a proportion of full detail. | 
|---|
 | 73 |         @param factor Subdivision factor as a value from 0 (control points only) to 1 (maximum | 
|---|
 | 74 |             subdivision). */ | 
|---|
 | 75 |         void setSubdivision(Real factor); | 
|---|
 | 76 |     protected: | 
|---|
 | 77 |         /// Overridden from Resource | 
|---|
 | 78 |         void loadImpl(void); | 
|---|
 | 79 |                 /// Overridden from Resource - do nothing (no disk caching) | 
|---|
 | 80 |                 void prepareImpl(void) {} | 
|---|
 | 81 |  | 
|---|
 | 82 |     }; | 
|---|
 | 83 |         /** @} */ | 
|---|
 | 84 |         /** @} */ | 
|---|
 | 85 |  | 
|---|
 | 86 | } | 
|---|
 | 87 |  | 
|---|
 | 88 | #endif | 
|---|