Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreMeshManager.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 © 2000-2002 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 __MeshManager_H__
00026 #define __MeshManager_H__
00027 
00028 #include "OgrePrerequisites.h"
00029 
00030 #include "OgreResourceManager.h"
00031 #include "OgreSingleton.h"
00032 #include "OgreVector3.h"
00033 #include "OgreHardwareBuffer.h"
00034 #include "OgrePatchMesh.h"
00035 
00036 namespace Ogre {
00037 
00045     class _OgreExport MeshManager: public ResourceManager, public Singleton<MeshManager>
00046     {
00047     public:
00048         MeshManager();
00049 
00051         void _initialise(void);
00052 
00074         Mesh* load( const String& filename, 
00075             HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
00076             HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
00077             bool vertexBufferShadowed = true, bool indexBufferShadowed = true,
00078             int priority = 1);
00079 
00084         Resource* create( const String& name);
00085 
00094         Mesh* createManual( const String& name);
00095 
00133         Mesh* createPlane(
00134             const String& name, const Plane& plane,
00135             Real width, Real height,
00136             int xsegments = 1, int ysegments = 1,
00137             bool normals = true, int numTexCoordSets = 1,
00138             Real uTile = 1.0f, Real vTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y,
00139             HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
00140             HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
00141             bool vertexShadowBuffer = true, bool indexShadowBuffer = true);
00142 
00143         
00189         Mesh* createCurvedIllusionPlane(
00190             const String& name, const Plane& plane,
00191             Real width, Real height, Real curvature,
00192             int xsegments = 1, int ysegments = 1,
00193             bool normals = true, int numTexCoordSets = 1,
00194             Real uTile = 1.0f, Real vTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y,
00195             const Quaternion& orientation = Quaternion::IDENTITY,
00196             HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
00197             HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
00198             bool vertexShadowBuffer = true, bool indexShadowBuffer = true);
00199 
00239         Mesh* createCurvedPlane( 
00240             const String& name, const Plane& plane, 
00241             Real width, Real height, Real bow = 0.5f, 
00242             int xsegments = 1, int ysegments = 1,
00243             bool normals = false, int numTexCoordSets = 1, 
00244             Real xTile = 1.0f, Real yTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y,
00245             HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
00246             HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
00247             bool vertexShadowBuffer = true, bool indexShadowBuffer = true);
00248 
00281         PatchMesh* createBezierPatch(
00282             const String& name, void* controlPointBuffer, 
00283             VertexDeclaration *declaration, size_t width, size_t height,
00284             size_t uMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL, 
00285             size_t vMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL,
00286             PatchSurface::VisibleSide visibleSide = PatchSurface::VS_FRONT,
00287             HardwareBuffer::Usage vbUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
00288             HardwareBuffer::Usage ibUsage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY,
00289             bool vbUseShadow = true, bool ibUseShadow = true);
00290         
00294         void setPrepareAllMeshesForShadowVolumes(bool enable);
00296         bool getPrepareAllMeshesForShadowVolumes(void);
00297 
00313         static MeshManager& getSingleton(void);
00329         static MeshManager* getSingletonPtr(void);
00330 
00331     protected:
00334         void tesselate2DMesh(SubMesh* pSub, int meshWidth, int meshHeight, 
00335             bool doubleSided = false, 
00336             HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
00337             bool indexSysMem = false);
00338 
00339         void createPrefabPlane(void);
00340 
00341         bool mPrepAllMeshesForShadowVolumes;
00342     };
00343 
00344 
00345 } //namespace
00346 
00347 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:26 2004