# OgrePatchMesh.h

Go to the documentation of this file.

    00001 /*
    00002 -----------------------------------------------------------------------------
    00003 This source file is part of OGRE
    00004     (Object-oriented Graphics Rendering Engine)
    00005 For the latest info, see http://www.ogre3d.org/
    00006
    00007 Copyright (c) 2000-2005 The OGRE Team
    00008 Also see acknowledgements in Readme.html
    00009
    00010 This program is free software; you can redistribute it and/or modify it under
    00011 the terms of the GNU Lesser General Public License as published by the Free Software
    00012 Foundation; either version 2 of the License, or (at your option) any later
    00013 version.
    00014
    00015 This program is distributed in the hope that it will be useful, but WITHOUT
    00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    00018
    00019 You should have received a copy of the GNU Lesser General Public License along with
    00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
    00022 http://www.gnu.org/copyleft/lesser.txt.
    00023 -----------------------------------------------------------------------------
    00024 */
    00025 #ifndef __PatchMesh_H__
    00026 #define __PatchMesh_H__
    00027
    00028 #include "OgrePrerequisites.h"
    00029 #include "OgreMesh.h"
    00030 #include "OgrePatchSurface.h"
    00031
    00032 namespace Ogre {
    00033
    00038     class _OgreExport PatchMesh : public Mesh
    00039     {
    00040     protected:
    00042         PatchSurface mSurface;
    00044         VertexDeclaration* mDeclaration;
    00045     public:
    00047         PatchMesh(ResourceManager* creator, const String& name, ResourceHandle handle,
    00048             const String& group);
    00049
    00051         void define(void* controlPointBuffer,
    00052             VertexDeclaration *declaration, size_t width, size_t height,
    00053             size_t uMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL,
    00054             size_t vMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL,
    00055             PatchSurface::VisibleSide visibleSide = PatchSurface::VS_FRONT,
    00056             HardwareBuffer::Usage vbUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
    00057             HardwareBuffer::Usage ibUsage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY,
    00058             bool vbUseShadow = false, bool ibUseShadow = false);
    00059
    00060         /* Sets the current subdivision level as a proportion of full detail.
    00061         @param factor Subdivision factor as a value from 0 (control points only) to 1 (maximum
    00062             subdivision). */
    00063         void setSubdivision(Real factor);
    00064     protected:
    00066         void loadImpl(void);
    00067
    00068     };
    00075     class _OgreExport PatchMeshPtr : public SharedPtr<PatchMesh>
    00076     {
    00077     public:
    00078         PatchMeshPtr() : SharedPtr<PatchMesh>() {}
    00079         explicit PatchMeshPtr(PatchMesh* rep) : SharedPtr<PatchMesh>(rep) {}
    00080         PatchMeshPtr(const PatchMeshPtr& r) : SharedPtr<PatchMesh>(r) {}
    00081         PatchMeshPtr(const ResourcePtr& r) : SharedPtr<PatchMesh>()
    00082         {
    00083             // lock & copy other mutex pointer
    00084             OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
    00085             OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
    00086             pRep = static_cast<PatchMesh*>(r.getPointer());
    00087             pUseCount = r.useCountPointer();
    00088             if (pUseCount)
    00089             {
    00090                 ++(*pUseCount);
    00091             }
    00092         }
    00093
    00095         PatchMeshPtr& operator=(const ResourcePtr& r)
    00096         {
    00097             if (pRep == static_cast<PatchMesh*>(r.getPointer()))
    00098                 return *this;
    00099             release();
    00100             // lock & copy other mutex pointer
    00101             OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
    00102             OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
    00103             pRep = static_cast<PatchMesh*>(r.getPointer());
    00104             pUseCount = r.useCountPointer();
    00105             if (pUseCount)
    00106             {
    00107                 ++(*pUseCount);
    00108             }
    00109             return *this;
    00110         }
    00112         PatchMeshPtr& operator=(const MeshPtr& r)
    00113         {
    00114             if (pRep == static_cast<PatchMesh*>(r.getPointer()))
    00115                 return *this;
    00116             release();
    00117             // lock & copy other mutex pointer
    00118             OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
    00119             OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
    00120             pRep = static_cast<PatchMesh*>(r.getPointer());
    00121             pUseCount = r.useCountPointer();
    00122             if (pUseCount)
    00123             {
    00124                 ++(*pUseCount);
    00125             }
    00126             return *this;
    00127         }
    00128     };
    00129
    00130 }
    00131
    00132 #endif

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Nov 20 12:36:04 2005