OGRE: OgreMeshManager.h Source File - OGRE Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class 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 (c) 2000-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef __MeshManager_H__
    00030 #define __MeshManager_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033
    00034 #include "OgreResourceManager.h"
    00035 #include "OgreSingleton.h"
    00036 #include "OgreVector3.h"
    00037 #include "OgreHardwareBuffer.h"
    00038 #include "OgreMesh.h"
    00039 #include "OgrePatchMesh.h"
    00040
    00041 namespace Ogre {
    00042
    00050     class _OgreExport MeshManager: public ResourceManager, public Singleton<MeshManager>,
    00051         public ManualResourceLoader
    00052     {
    00053     public:
    00054         MeshManager();
    00055         ~MeshManager();
    00056
    00058         void _initialise(void);
    00059
    00082         MeshPtr load( const String& filename, const String& groupName,
    00083             HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
    00084             HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
    00085             bool vertexBufferShadowed = true, bool indexBufferShadowed = true);
    00086
    00087
    00101         MeshPtr createManual( const String& name, const String& groupName,
    00102             ManualResourceLoader* loader = 0);
    00103
    00143         MeshPtr createPlane(
    00144             const String& name, const String& groupName, const Plane& plane,
    00145             Real width, Real height,
    00146             int xsegments = 1, int ysegments = 1,
    00147             bool normals = true, int numTexCoordSets = 1,
    00148             Real uTile = 1.0f, Real vTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y,
    00149             HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
    00150             HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
    00151             bool vertexShadowBuffer = true, bool indexShadowBuffer = true);
    00152
    00153
    00204         MeshPtr createCurvedIllusionPlane(
    00205             const String& name, const String& groupName, const Plane& plane,
    00206             Real width, Real height, Real curvature,
    00207             int xsegments = 1, int ysegments = 1,
    00208             bool normals = true, int numTexCoordSets = 1,
    00209             Real uTile = 1.0f, Real vTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y,
    00210             const Quaternion& orientation = Quaternion::IDENTITY,
    00211             HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
    00212             HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
    00213             bool vertexShadowBuffer = true, bool indexShadowBuffer = true,
    00214             int ySegmentsToKeep = -1);
    00215
    00257         MeshPtr createCurvedPlane(
    00258             const String& name, const String& groupName, const Plane& plane,
    00259             Real width, Real height, Real bow = 0.5f,
    00260             int xsegments = 1, int ysegments = 1,
    00261             bool normals = false, int numTexCoordSets = 1,
    00262             Real xTile = 1.0f, Real yTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y,
    00263             HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
    00264             HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
    00265             bool vertexShadowBuffer = true, bool indexShadowBuffer = true);
    00266
    00303         PatchMeshPtr createBezierPatch(
    00304             const String& name, const String& groupName, void* controlPointBuffer,
    00305             VertexDeclaration *declaration, size_t width, size_t height,
    00306             size_t uMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL,
    00307             size_t vMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL,
    00308             PatchSurface::VisibleSide visibleSide = PatchSurface::VS_FRONT,
    00309             HardwareBuffer::Usage vbUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
    00310             HardwareBuffer::Usage ibUsage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY,
    00311             bool vbUseShadow = true, bool ibUseShadow = true);
    00312
    00316         void setPrepareAllMeshesForShadowVolumes(bool enable);
    00318         bool getPrepareAllMeshesForShadowVolumes(void);
    00319
    00335         static MeshManager& getSingleton(void);
    00351         static MeshManager* getSingletonPtr(void);
    00352
    00356         Real getBoundsPaddingFactor(void);
    00357
    00360         void setBoundsPaddingFactor(Real paddingFactor);
    00361
    00363         void loadResource(Resource* res);
    00364
    00365     protected:
    00367         Resource* createImpl(const String& name, ResourceHandle handle,
    00368             const String& group, bool isManual, ManualResourceLoader* loader,
    00369             const NameValuePairList* createParams);
    00370
    00373         void tesselate2DMesh(SubMesh* pSub, int meshWidth, int meshHeight,
    00374             bool doubleSided = false,
    00375             HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
    00376             bool indexSysMem = false);
    00377
    00378         void createPrefabPlane(void);
    00379         void createPrefabCube(void);
    00380         void createPrefabSphere(void);
    00381
    00383         enum MeshBuildType
    00384         {
    00385             MBT_PLANE,
    00386             MBT_CURVED_ILLUSION_PLANE,
    00387             MBT_CURVED_PLANE
    00388         };
    00390         struct MeshBuildParams
    00391         {
    00392             MeshBuildType type;
    00393             Plane plane;
    00394             Real width;
    00395             Real height;
    00396             Real curvature;
    00397             int xsegments;
    00398             int ysegments;
    00399             bool normals;
    00400             int numTexCoordSets;
    00401             Real xTile;
    00402             Real yTile;
    00403             Vector3 upVector;
    00404             Quaternion orientation;
    00405             HardwareBuffer::Usage vertexBufferUsage;
    00406             HardwareBuffer::Usage indexBufferUsage;
    00407             bool vertexShadowBuffer;
    00408             bool indexShadowBuffer;
    00409             int ySegmentsToKeep;
    00410         };
    00412         typedef std::map<Resource*, MeshBuildParams> MeshBuildParamsMap;
    00413         MeshBuildParamsMap mMeshBuildParams;
    00414
    00416         void loadManualPlane(Mesh* pMesh, MeshBuildParams& params);
    00418         void loadManualCurvedPlane(Mesh* pMesh, MeshBuildParams& params);
    00420         void loadManualCurvedIllusionPlane(Mesh* pMesh, MeshBuildParams& params);
    00421
    00422         bool mPrepAllMeshesForShadowVolumes;
    00423
    00424     //the factor by which the bounding box of an entity is padded
    00425     Real mBoundsPaddingFactor;
    00426     };
    00427
    00428
    00429 } //namespace
    00430
    00431 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Thu Mar 6 09:46:25 2008