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

Ogre::MeshManager Class Reference

Handles the management of mesh resources. More...

#include <OgreMeshManager.h>

Inheritance diagram for Ogre::MeshManager:

Inheritance graph
[legend]
List of all members.

Public Types

typedef std::map< ResourceHandle,
Resource * > 
ResourceHandleMap
typedef MapIterator< ResourceHandleMapResourceMapIterator

Public Methods

 MeshManager ()
void _initialise (void)
 Initialises the manager, only to be called by OGRE internally.

Meshload (const String &filename, HardwareBuffer::Usage vertexBufferUsage=HardwareBuffer::HBU_STATIC_WRITE_ONLY, HardwareBuffer::Usage indexBufferUsage=HardwareBuffer::HBU_STATIC_WRITE_ONLY, bool vertexBufferShadowed=true, bool indexBufferShadowed=true, int priority=1)
 Loads a mesh from a file, making it available for use.

Resourcecreate (const String &name)
 Creates a Mesh resource.

MeshcreateManual (const String &name)
 Creates a new Mesh specifically for manual definition rather than loading from an object file.

MeshcreatePlane (const String &name, const Plane &plane, Real width, Real height, int xsegments=1, int ysegments=1, bool normals=true, int numTexCoordSets=1, Real uTile=1.0f, Real vTile=1.0f, const Vector3 &upVector=Vector3::UNIT_Y, HardwareBuffer::Usage vertexBufferUsage=HardwareBuffer::HBU_STATIC_WRITE_ONLY, HardwareBuffer::Usage indexBufferUsage=HardwareBuffer::HBU_STATIC_WRITE_ONLY, bool vertexShadowBuffer=true, bool indexShadowBuffer=true)
 Creates a basic plane, by default majoring on the x/y axes facing positive Z.

MeshcreateCurvedIllusionPlane (const String &name, const Plane &plane, Real width, Real height, Real curvature, int xsegments=1, int ysegments=1, bool normals=true, int numTexCoordSets=1, Real uTile=1.0f, Real vTile=1.0f, const Vector3 &upVector=Vector3::UNIT_Y, const Quaternion &orientation=Quaternion::IDENTITY, HardwareBuffer::Usage vertexBufferUsage=HardwareBuffer::HBU_STATIC_WRITE_ONLY, HardwareBuffer::Usage indexBufferUsage=HardwareBuffer::HBU_STATIC_WRITE_ONLY, bool vertexShadowBuffer=true, bool indexShadowBuffer=true)
 Creates a plane, which because of it's texture coordinates looks like a curved surface, useful for skies in a skybox.

MeshcreateCurvedPlane (const String &name, const Plane &plane, Real width, Real height, Real bow=0.5f, int xsegments=1, int ysegments=1, bool normals=false, int numTexCoordSets=1, Real xTile=1.0f, Real yTile=1.0f, const Vector3 &upVector=Vector3::UNIT_Y, HardwareBuffer::Usage vertexBufferUsage=HardwareBuffer::HBU_STATIC_WRITE_ONLY, HardwareBuffer::Usage indexBufferUsage=HardwareBuffer::HBU_STATIC_WRITE_ONLY, bool vertexShadowBuffer=true, bool indexShadowBuffer=true)
 Creates a genuinely curved plane, by default majoring on the x/y axes facing positive Z.

PatchMeshcreateBezierPatch (const String &name, void *controlPointBuffer, VertexDeclaration *declaration, size_t width, size_t height, size_t uMaxSubdivisionLevel=PatchSurface::AUTO_LEVEL, size_t vMaxSubdivisionLevel=PatchSurface::AUTO_LEVEL, PatchSurface::VisibleSide visibleSide=PatchSurface::VS_FRONT, HardwareBuffer::Usage vbUsage=HardwareBuffer::HBU_STATIC_WRITE_ONLY, HardwareBuffer::Usage ibUsage=HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY, bool vbUseShadow=true, bool ibUseShadow=true)
 Creates a Bezier patch based on an array of control vertices.

void setPrepareAllMeshesForShadowVolumes (bool enable)
 Tells the mesh manager that all future meshes should prepare themselves for shadow volumes on loading.

bool getPrepareAllMeshesForShadowVolumes (void)
 Retrieves whether all Meshes should prepare themselves for shadow volumes.

virtual void setMemoryBudget (size_t bytes)
 Set a limit on the amount of memory this resource handler may use.

virtual void load (Resource *res, int priority)
 Load a resource.

virtual void add (Resource *res)
 Add a resource to this manager; normally only done by subclasses.

virtual void unload (Resource *res)
 Unloads a Resource from the managed resources list, calling it's unload() method.

virtual void unloadAndDestroyAll (void)
 Unloads all Resources from memory.

virtual ResourcegetByName (const String &name)
 Retrieves a pointer to a resource by name, or null if the resource does not exist.

virtual ResourcegetByHandle (ResourceHandle handle)
 Retrieves a pointer to a resource by handle, or null if the resource does not exist.

void addSearchPath (const String &path)
 Adds a relative path to search for resources of this type.

void addArchiveEx (const String &strName, const String &strDriverName)
 Adds an archive to the search path for this type of resource.

bool _findResourceData (const String &filename, DataChunk &refChunk)
 Internal method, used for locating resource data in the file system / archives.

std::set< String_getAllNamesLike (const String &startPath, const String &extension)
 Returns a collection of files with the given extension in all resource paths, common and specific to this resource type.

ResourceMapIterator getResourceIterator (void)
 Returns an iterator over all resources in this manager.


Static Public Methods

MeshManager & getSingleton (void)
 Override standard Singleton retrieval.

MeshManager * getSingletonPtr (void)
 Override standard Singleton retrieval.

void addCommonSearchPath (const String &path)
 Adds a relative search path for resources of ALL types.

void addCommonArchiveEx (const String &strName, const String &strDriverName)
 Adds an archive to the search path for all resources.

std::set< String_getAllCommonNamesLike (const String &startPath, const String &extension)
 Returns a collection of files with the given extension in the common resource paths.

bool _findCommonResourceData (const String &filename, DataChunk &refChunk)
 Internal method, used for locating common resource data in the file system / archives.


Protected Types

typedef HashMap< String, ArchiveEx *,
_StringHash
FileMap
typedef HashMap< String, Resource *,
_StringHash
ResourceMap

Protected Methods

void tesselate2DMesh (SubMesh *pSub, int meshWidth, int meshHeight, bool doubleSided=false, HardwareBuffer::Usage indexBufferUsage=HardwareBuffer::HBU_STATIC_WRITE_ONLY, bool indexSysMem=false)
 Utility method for tesselating 2D meshes.

void createPrefabPlane (void)
ResourceHandle getNextHandle (void)
 Allocates the next handle.

void checkUsage (void)
 Checks memory usage and pages out if required.


Protected Attributes

bool mPrepAllMeshesForShadowVolumes
FileMap mArchiveFiles
ResourceHandleMap mResourcesByHandle
ResourceMap mResources
ResourceHandle mNextHandle
size_t mMemoryBudget
size_t mMemoryUsage
std::vector< ArchiveEx * > mVFS
 Collection of searchable ArchiveEx classes (virtual file system) for this resource type.


Static Protected Attributes

FileMap mCommonArchiveFiles
std::vector< ArchiveEx * > mCommonVFS
 Collection of searchable ArchiveEx classes (virtual file system) for all resource types.

MeshManager * ms_Singleton = 0

Detailed Description

Handles the management of mesh resources.

Remarks:
This class deals with the runtime management of mesh data; like other resource managers it handles the creation of resources (in this case mesh data), working within a fixed memory budget.

Definition at line 45 of file OgreMeshManager.h.


Member Typedef Documentation

typedef HashMap< String, ArchiveEx *, _StringHash > Ogre::ResourceManager::FileMap [protected, inherited]
 

Definition at line 195 of file OgreResourceManager.h.

typedef std::map<ResourceHandle, Resource*> Ogre::ResourceManager::ResourceHandleMap [inherited]
 

Definition at line 203 of file OgreResourceManager.h.

typedef HashMap< String, Resource*, _StringHash > Ogre::ResourceManager::ResourceMap [protected, inherited]
 

Definition at line 196 of file OgreResourceManager.h.

typedef MapIterator<ResourceHandleMap> Ogre::ResourceManager::ResourceMapIterator [inherited]
 

Definition at line 224 of file OgreResourceManager.h.


Constructor & Destructor Documentation

Ogre::MeshManager::MeshManager  
 

Definition at line 54 of file OgreMeshManager.cpp.

References mPrepAllMeshesForShadowVolumes.


Member Function Documentation

bool Ogre::ResourceManager::_findCommonResourceData const String   filename,
DataChunk   refChunk
[static, inherited]
 

Internal method, used for locating common resource data in the file system / archives.

Remarks:
This is a static version of _findResourceData specifically designed to only search in the common resource archives, and is therefore usable from non-ResourceManager subclasses.
Parameters:
filename  File to find
refChunk  Reference to a DataChunk object to fill with the data from the file
Returns:
On success, true is returned

On failiure, false is returned

Definition at line 294 of file OgreResourceManager.cpp.

References Except, Ogre::ResourceManager::mCommonArchiveFiles, and Ogre::ResourceManager::mCommonVFS.

bool Ogre::ResourceManager::_findResourceData const String   filename,
DataChunk   refChunk
[inherited]
 

Internal method, used for locating resource data in the file system / archives.

Parameters:
filename  File to find
refChunk  Reference to a DataChunk object to fill with the data from the file
Returns:
On success, true is returned

On failiure, false is returnec

Definition at line 212 of file OgreResourceManager.cpp.

References Except, Ogre::ResourceManager::mArchiveFiles, Ogre::ResourceManager::mCommonArchiveFiles, Ogre::ResourceManager::mCommonVFS, and Ogre::ResourceManager::mVFS.

std::set< String > Ogre::ResourceManager::_getAllCommonNamesLike const String   startPath,
const String   extension
[static, inherited]
 

Returns a collection of files with the given extension in the common resource paths.

Remarks:
This is a convenience method to allow non-subclasses to search for files in the common paths.
Parameters:
startPath  The path, relative to each common resource start, to search in (use "./" for the root)
extension  The extension of file to search for.
Returns:
A set of String filenames (it is a set because duplicates will be ignored)

Definition at line 255 of file OgreResourceManager.cpp.

References Ogre::ResourceManager::mCommonVFS, and Ogre::StringVector.

std::set< String > Ogre::ResourceManager::_getAllNamesLike const String   startPath,
const String   extension
[inherited]
 

Returns a collection of files with the given extension in all resource paths, common and specific to this resource type.

Parameters:
startPath  The path, relative to each common resource start, to search in (use "./" for the root)
extension  The extension of file to search for.
Returns:
A set of String filenames (it is a set because duplicates will be ignored)

Definition at line 274 of file OgreResourceManager.cpp.

References Ogre::ResourceManager::mVFS, and Ogre::StringVector.

void Ogre::MeshManager::_initialise void   
 

Initialises the manager, only to be called by OGRE internally.

Definition at line 61 of file OgreMeshManager.cpp.

References createPrefabPlane().

void Ogre::ResourceManager::add Resource   res [virtual, inherited]
 

Add a resource to this manager; normally only done by subclasses.

Definition at line 75 of file OgreResourceManager.cpp.

References Except, Ogre::Resource::getName(), Ogre::ResourceManager::getNextHandle(), Ogre::Resource::mHandle, Ogre::ResourceManager::mResources, and Ogre::ResourceManager::mResourcesByHandle.

Referenced by Ogre::Quake3ShaderManager::create(), Ogre::MaterialManager::create(), createManual(), Ogre::HighLevelGpuProgramManager::createProgram(), and Ogre::ResourceManager::load().

void Ogre::ResourceManager::addArchiveEx const String   strName,
const String   strDriverName
[inherited]
 

Adds an archive to the search path for this type of resource.

Remarks:
Ogre can load resources from archives. This method adds the named archive to the search path for the type of resource managed by the specific resource manager. Archives are not searched for themselves so a complete path must be specified here (or relative to the current path). Archives take precedence over files in the filesystem.

Definition at line 188 of file OgreResourceManager.cpp.

References Ogre::ArchiveEx::getAllNamesLike(), Ogre::ResourceManager::mArchiveFiles, Ogre::ResourceManager::mVFS, and Ogre::StringVector.

Referenced by Ogre::ResourceManager::addSearchPath().

void Ogre::ResourceManager::addCommonArchiveEx const String   strName,
const String   strDriverName
[static, inherited]
 

Adds an archive to the search path for all resources.

Remarks:
As ResourceManager::addArchive, except this archive is used for all types of resources, not just the type managed by the resource manager in question.

Definition at line 200 of file OgreResourceManager.cpp.

References Ogre::ArchiveEx::getAllNamesLike(), Ogre::ResourceManager::mCommonArchiveFiles, Ogre::ResourceManager::mCommonVFS, and Ogre::StringVector.

Referenced by Ogre::ResourceManager::addCommonSearchPath().

void Ogre::ResourceManager::addCommonSearchPath const String   path [static, inherited]
 

Adds a relative search path for resources of ALL types.

This method has the same effect as ResourceManager::addSearchPath, except that the path added applies to ALL resources, not just the one managed by the subclass in question.

Definition at line 182 of file OgreResourceManager.cpp.

References Ogre::ResourceManager::addCommonArchiveEx(), and Ogre::convertPath().

void Ogre::ResourceManager::addSearchPath const String   path [inherited]
 

Adds a relative path to search for resources of this type.

Remarks:
This method adds the supplied path to the list of relative locations that that will be searched for a single type of resource only. Each subclass of ResourceManager will maintain it's own list of specific subpaths, which it will append to the current path as it searches for matching files.

Definition at line 176 of file OgreResourceManager.cpp.

References Ogre::ResourceManager::addArchiveEx(), and Ogre::convertPath().

void Ogre::ResourceManager::checkUsage void    [protected, inherited]
 

Checks memory usage and pages out if required.

Definition at line 170 of file OgreResourceManager.cpp.

Referenced by Ogre::ResourceManager::setMemoryBudget().

Resource * Ogre::MeshManager::create const String   name [virtual]
 

Creates a Mesh resource.

Note:
Mainly used internally.

Implements Ogre::ResourceManager.

Definition at line 69 of file OgreMeshManager.cpp.

Referenced by createManual(), createPrefabPlane(), and load().

PatchMesh * Ogre::MeshManager::createBezierPatch const String   name,
void *    controlPointBuffer,
VertexDeclaration   declaration,
size_t    width,
size_t    height,
size_t    uMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL,
size_t    vMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL,
PatchSurface::VisibleSide    visibleSide = PatchSurface::VS_FRONT,
HardwareBuffer::Usage    vbUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
HardwareBuffer::Usage    ibUsage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY,
bool    vbUseShadow = true,
bool    ibUseShadow = true
 

Creates a Bezier patch based on an array of control vertices.

Parameters:
name  The name to give the newly created mesh.
controlPointBuffer  A pointer to a buffer containing the vertex data which defines control points of the curves rather than actual vertices. Note that you are expected to provide not just position information, but potentially normals and texture coordinates too. The format of the buffer is defined in the VertexDeclaration parameter
decaration  VertexDeclaration describing the contents of the buffer. Note this declaration must _only_ draw on buffer source 0!
width  Specifies the width of the patch in control points.
height  Specifies the height of the patch in control points.
uMaxSubdivisionLevel,vMaxSubdivisionLevel  If you want to manually set the top level of subdivision, do it here, otherwise let the system decide.
visibleSide  Determines which side of the patch (or both) triangles are generated for.
vbUsage  Vertex buffer usage flags. Recommend the default since vertex buffer should be static.
ibUsage  Index buffer usage flags. Recommend the default since index buffer should be dynamic to change levels but not readable.
vbUseShadow  Flag to determine if a shadow buffer is generated for the vertex buffer. See HardwareBuffer for full details.
ibUseShadow  Flag to determine if a shadow buffer is generated for the index buffer. See HardwareBuffer for full details.

Definition at line 758 of file OgreMeshManager.cpp.

References Except, Ogre::ResourceManager::getByName(), and Ogre::Mesh::setManuallyDefined().

Mesh * Ogre::MeshManager::createCurvedIllusionPlane const String   name,
const Plane   plane,
Real    width,
Real    height,
Real    curvature,
int    xsegments = 1,
int    ysegments = 1,
bool    normals = true,
int    numTexCoordSets = 1,
Real    uTile = 1.0f,
Real    vTile = 1.0f,
const Vector3   upVector = Vector3::UNIT_Y,
const Quaternion   orientation = Quaternion::IDENTITY,
HardwareBuffer::Usage    vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
HardwareBuffer::Usage    indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
bool    vertexShadowBuffer = true,
bool    indexShadowBuffer = true
 

Creates a plane, which because of it's texture coordinates looks like a curved surface, useful for skies in a skybox.

Parameters:
name  The name to give the resulting mesh
plane  The orientation of the plane and distance from the origin
width  The width of the plane in world coordinates
height  The height of the plane in world coordinates
curvature  The curvature of the plane. Good values are between 2 and 65. Higher values are more curved leading to a smoother effect, lower values are less curved meaning more distortion at the horizons but a better distance effect.
xsegments  The number of segements to the plane in the x direction
ysegments  The number of segements to the plane in the y direction
normals  If true, normals are created perpendicular to the plane
numTexCoordSets  The number of 2D texture coordinate sets created - by default the corners are created to be the corner of the texture.
uTile  The number of times the texture should be repeated in the u direction
vTile  The number of times the texture should be repeated in the v direction
upVector  The 'Up' direction of the plane.
orientation  The orientation of the overall sphere that's used to create the illusion
vertexBufferUsage  The usage flag with which the vertex buffer for this plane will be created
indexBufferUsage  The usage flag with which the index buffer for this plane will be created
vertexShadowBuffer  If this flag is set to true, the vertex buffer will be created with a system memory shadow buffer, allowing you to read it back more efficiently than if it is in hardware
indexShadowBuffer  If this flag is set to true, the index buffer will be created with a system memory shadow buffer, allowing you to read it back more efficiently than if it is in hardware

Definition at line 422 of file OgreMeshManager.cpp.

References Ogre::Mesh::_setBoundingSphereRadius(), Ogre::Mesh::_setBounds(), Ogre::VertexDeclaration::addElement(), createManual(), Ogre::Mesh::createSubMesh(), Ogre::Vector3::crossProduct(), Ogre::Plane::d, Except, Ogre::firstTime, Ogre::Matrix3::FromAxes(), Ogre::VertexDeclaration::getVertexSize(), Ogre::Quaternion::Inverse(), Ogre::Vector3::length(), Ogre::Mesh::load(), Ogre::Vector3::makeCeil(), Ogre::Vector3::makeFloor(), Ogre::Plane::normal, Ogre::Vector3::normalise(), Ogre::Real, Ogre::VertexBufferBinding::setBinding(), Ogre::Matrix4::setTrans(), Ogre::Mesh::sharedVertexData, Ogre::Vector3::squaredLength(), tesselate2DMesh(), Ogre::Resource::touch(), Ogre::SubMesh::useSharedVertices, Ogre::VertexData::vertexBufferBinding, Ogre::VertexData::vertexCount, Ogre::VertexData::vertexDeclaration, Ogre::VES_NORMAL, Ogre::VES_POSITION, Ogre::VES_TEXTURE_COORDINATES, Ogre::VET_FLOAT2, Ogre::VET_FLOAT3, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Referenced by Ogre::SceneManager::createSkydomePlane().

Mesh * Ogre::MeshManager::createCurvedPlane const String   name,
const Plane   plane,
Real    width,
Real    height,
Real    bow = 0.5f,
int    xsegments = 1,
int    ysegments = 1,
bool    normals = false,
int    numTexCoordSets = 1,
Real    xTile = 1.0f,
Real    yTile = 1.0f,
const Vector3   upVector = Vector3::UNIT_Y,
HardwareBuffer::Usage    vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
HardwareBuffer::Usage    indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
bool    vertexShadowBuffer = true,
bool    indexShadowBuffer = true
 

Creates a genuinely curved plane, by default majoring on the x/y axes facing positive Z.

Parameters:
name  The name to give the resulting mesh
plane  The orientation of the plane and distance from the origin
width  The width of the plane in world coordinates
height  The height of the plane in world coordinates
bow  The amount of 'bow' in the curved plane. (Could also be concidered the depth.)
xsegments  The number of segements to the plane in the x direction
ysegments  The number of segements to the plane in the y direction
normals  If true, normals are created perpendicular to the plane
numTexCoordSets  The number of 2D texture coordinate sets created - by default the corners are created to be the corner of the texture.
uTile  The number of times the texture should be repeated in the u direction
vTile  The number of times the texture should be repeated in the v direction
upVector  The 'Up' direction of the plane.
vertexBufferUsage  The usage flag with which the vertex buffer for this plane will be created
indexBufferUsage  The usage flag with which the index buffer for this plane will be created
vertexShadowBuffer  If this flag is set to true, the vertex buffer will be created with a system memory shadow buffer, allowing you to read it back more efficiently than if it is in hardware
indexShadowBuffer  If this flag is set to true, the index buffer will be created with a system memory shadow buffer, allowing you to read it back more efficiently than if it is in hardware

Definition at line 262 of file OgreMeshManager.cpp.

References Ogre::Mesh::_setBoundingSphereRadius(), Ogre::Mesh::_setBounds(), Ogre::VertexDeclaration::addElement(), createManual(), Ogre::Mesh::createSubMesh(), Ogre::Vector3::crossProduct(), Ogre::Plane::d, Except, Ogre::Matrix3::FromAxes(), Ogre::Vector3::length(), Ogre::Mesh::load(), Ogre::Vector3::makeCeil(), Ogre::Vector3::makeFloor(), Ogre::Plane::normal, Ogre::Vector3::normalise(), PI, Ogre::Real, Ogre::VertexBufferBinding::setBinding(), Ogre::Matrix4::setTrans(), Ogre::Mesh::sharedVertexData, Ogre::Vector3::squaredLength(), tesselate2DMesh(), Ogre::Resource::touch(), Ogre::VertexData::vertexBufferBinding, Ogre::VertexData::vertexCount, Ogre::VertexData::vertexDeclaration, Ogre::VertexData::vertexStart, Ogre::VES_NORMAL, Ogre::VES_POSITION, Ogre::VES_TEXTURE_COORDINATES, Ogre::VET_FLOAT2, Ogre::VET_FLOAT3, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Mesh * Ogre::MeshManager::createManual const String   name
 

Creates a new Mesh specifically for manual definition rather than loading from an object file.

Remarks:
Note that once you've defined your mesh, you must call Mesh::_setBounds and Mesh::_setBoundingRadius in order to define the bounds of your mesh. In previous versions of OGRE you could call Mesh::_updateBounds, but OGRE's support of write-only vertex buffers makes this no longer appropriate.

Definition at line 93 of file OgreMeshManager.cpp.

References Ogre::ResourceManager::add(), create(), Ogre::ResourceManager::getByName(), and Ogre::Mesh::setManuallyDefined().

Referenced by createCurvedIllusionPlane(), createCurvedPlane(), and createPlane().

Mesh * Ogre::MeshManager::createPlane const String   name,
const Plane   plane,
Real    width,
Real    height,
int    xsegments = 1,
int    ysegments = 1,
bool    normals = true,
int    numTexCoordSets = 1,
Real    uTile = 1.0f,
Real    vTile = 1.0f,
const Vector3   upVector = Vector3::UNIT_Y,
HardwareBuffer::Usage    vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
HardwareBuffer::Usage    indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
bool    vertexShadowBuffer = true,
bool    indexShadowBuffer = true
 

Creates a basic plane, by default majoring on the x/y axes facing positive Z.

Parameters:
name  The name to give the resulting mesh
plane  The orientation of the plane and distance from the origin
width  The width of the plane in world coordinates
height  The height of the plane in world coordinates
xsegments  The number of segements to the plane in the x direction
ysegments  The number of segements to the plane in the y direction
normals  If true, normals are created perpendicular to the plane
numTexCoordSets  The number of 2D texture coordinate sets created - by default the corners are created to be the corner of the texture.
uTile  The number of times the texture should be repeated in the u direction
vTile  The number of times the texture should be repeated in the v direction
upVector  The 'Up' direction of the plane.
vertexBufferUsage  The usage flag with which the vertex buffer for this plane will be created
indexBufferUsage  The usage flag with which the index buffer for this plane will be created
vertexShadowBuffer  If this flag is set to true, the vertex buffer will be created with a system memory shadow buffer, allowing you to read it back more efficiently than if it is in hardware
indexShadowBuffer  If this flag is set to true, the index buffer will be created with a system memory shadow buffer, allowing you to read it back more efficiently than if it is in hardware

Definition at line 106 of file OgreMeshManager.cpp.

References Ogre::Mesh::_setBoundingSphereRadius(), Ogre::Mesh::_setBounds(), Ogre::VertexDeclaration::addElement(), createManual(), Ogre::Mesh::createSubMesh(), Ogre::Vector3::crossProduct(), Ogre::Plane::d, Except, Ogre::firstTime, Ogre::Matrix3::FromAxes(), Ogre::VertexDeclaration::getVertexSize(), Ogre::Vector3::length(), Ogre::Mesh::load(), Ogre::Vector3::makeCeil(), Ogre::Vector3::makeFloor(), Ogre::Plane::normal, Ogre::Vector3::normalise(), Ogre::Real, Ogre::VertexBufferBinding::setBinding(), Ogre::Matrix4::setTrans(), Ogre::Mesh::sharedVertexData, Ogre::Vector3::squaredLength(), tesselate2DMesh(), Ogre::Resource::touch(), Ogre::SubMesh::useSharedVertices, Ogre::VertexData::vertexBufferBinding, Ogre::VertexData::vertexCount, Ogre::VertexData::vertexDeclaration, Ogre::VES_NORMAL, Ogre::VES_POSITION, Ogre::VES_TEXTURE_COORDINATES, Ogre::VET_FLOAT2, Ogre::VET_FLOAT3, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Referenced by Ogre::SceneManager::createSkyboxPlane().

void Ogre::MeshManager::createPrefabPlane void    [protected]
 

Definition at line 700 of file OgreMeshManager.cpp.

References Ogre::Mesh::_setBoundingSphereRadius(), Ogre::Mesh::_setBounds(), Ogre::VertexDeclaration::addElement(), create(), Ogre::Mesh::createSubMesh(), Ogre::Resource::getName(), Ogre::IndexData::indexBuffer, Ogre::IndexData::indexCount, Ogre::SubMesh::indexData, Ogre::IndexData::indexStart, Ogre::ResourceManager::mResources, Ogre::Real, Ogre::VertexBufferBinding::setBinding(), Ogre::Mesh::sharedVertexData, Ogre::SubMesh::useSharedVertices, Ogre::VertexData::vertexBufferBinding, Ogre::VertexData::vertexCount, Ogre::VertexData::vertexDeclaration, Ogre::VES_NORMAL, Ogre::VES_POSITION, Ogre::VES_TEXTURE_COORDINATES, Ogre::VET_FLOAT2, and Ogre::VET_FLOAT3.

Referenced by _initialise().

Resource * Ogre::ResourceManager::getByHandle ResourceHandle    handle [virtual, inherited]
 

Retrieves a pointer to a resource by handle, or null if the resource does not exist.

Definition at line 151 of file OgreResourceManager.cpp.

References Ogre::ResourceManager::mResourcesByHandle, and Ogre::ResourceHandle.

Resource * Ogre::ResourceManager::getByName const String   name [virtual, inherited]
 

Retrieves a pointer to a resource by name, or null if the resource does not exist.

Definition at line 139 of file OgreResourceManager.cpp.

References Ogre::ResourceManager::mResources.

Referenced by Ogre::MaterialManager::create(), Ogre::FontManager::create(), createBezierPatch(), createManual(), Ogre::SceneManager::createSkyboxPlane(), Ogre::SceneManager::createSkydomePlane(), Ogre::TextureManager::load(), Ogre::SkeletonManager::load(), load(), Ogre::DynLibManager::load(), Ogre::ArchiveManager::load(), Ogre::SceneManager::setSkyBox(), and Ogre::TextureManager::unload().

ResourceHandle Ogre::ResourceManager::getNextHandle void    [protected, inherited]
 

Allocates the next handle.

Definition at line 165 of file OgreResourceManager.cpp.

References Ogre::ResourceManager::mNextHandle, and Ogre::ResourceHandle.

Referenced by Ogre::ResourceManager::add().

bool Ogre::MeshManager::getPrepareAllMeshesForShadowVolumes void   
 

Retrieves whether all Meshes should prepare themselves for shadow volumes.

Definition at line 787 of file OgreMeshManager.cpp.

References mPrepAllMeshesForShadowVolumes.

ResourceMapIterator Ogre::ResourceManager::getResourceIterator void    [inherited]
 

Returns an iterator over all resources in this manager.

Definition at line 226 of file OgreResourceManager.h.

MeshManager & Ogre::MeshManager::getSingleton void    [static]
 

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.

This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< MeshManager >.

Definition at line 49 of file OgreMeshManager.cpp.

References Ogre::Singleton< MeshManager >::ms_Singleton.

MeshManager * Ogre::MeshManager::getSingletonPtr void    [static]
 

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.

This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< MeshManager >.

Definition at line 45 of file OgreMeshManager.cpp.

References Ogre::Singleton< MeshManager >::ms_Singleton.

void Ogre::ResourceManager::load Resource   res,
int    priority
[virtual, inherited]
 

Load a resource.

Resources will be subclasses.

Reimplemented in Ogre::TextureManager.

Definition at line 67 of file OgreResourceManager.cpp.

References Ogre::ResourceManager::add(), Ogre::Resource::load(), and Ogre::Resource::touch().

Referenced by Ogre::OverlayManager::create().

Mesh * Ogre::MeshManager::load const String   filename,
HardwareBuffer::Usage    vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
HardwareBuffer::Usage    indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
bool    vertexBufferShadowed = true,
bool    indexBufferShadowed = true,
int    priority = 1
 

Loads a mesh from a file, making it available for use.

Note:
If the model has already been loaded, the existing instance will be returned.
Remarks:
Ogre loads model files from it's own proprietary format called .mesh. This is because having a single file format is better for runtime performance, and we also have control over pre-processed data (such as collision boxes, LOD reductions etc).
Parameters:
filename  The name of the .mesh file
vertexBufferUsage  The usage flags with which the vertex buffer(s) will be created
indexBufferUsage  The usage flags with which the index buffer(s) created for this mesh will be created with.
vertexBufferShadowed  If true, the vertex buffers will be shadowed by system memory copies for faster read access
indexBufferShadowed  If true, the index buffers will be shadowed by system memory copies for faster read access
priority  The priority of this mesh in the resource system

Definition at line 74 of file OgreMeshManager.cpp.

References create(), Ogre::ResourceManager::getByName(), Ogre::Mesh::setIndexBufferPolicy(), and Ogre::Mesh::setVertexBufferPolicy().

void Ogre::ResourceManager::setMemoryBudget size_t    bytes [virtual, inherited]
 

Set a limit on the amount of memory this resource handler may use.

Remarks:
If, when asked to load a new resource, the manager believes it will exceed this memory budget, it will temporarily unload a resource to make room for the new one. This unloading is not permanent and the Resource is not destroyed; it simply needs to be reloaded when next used.

Definition at line 97 of file OgreResourceManager.cpp.

References Ogre::ResourceManager::checkUsage(), and Ogre::ResourceManager::mMemoryBudget.

void Ogre::MeshManager::setPrepareAllMeshesForShadowVolumes bool    enable
 

Tells the mesh manager that all future meshes should prepare themselves for shadow volumes on loading.

Definition at line 782 of file OgreMeshManager.cpp.

References mPrepAllMeshesForShadowVolumes.

void Ogre::MeshManager::tesselate2DMesh SubMesh   pSub,
int    meshWidth,
int    meshHeight,
bool    doubleSided = false,
HardwareBuffer::Usage    indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
bool    indexSysMem = false
[protected]
 

Utility method for tesselating 2D meshes.

Definition at line 614 of file OgreMeshManager.cpp.

References Ogre::IndexData::indexBuffer, Ogre::IndexData::indexCount, and Ogre::SubMesh::indexData.

Referenced by createCurvedIllusionPlane(), createCurvedPlane(), and createPlane().

void Ogre::ResourceManager::unload Resource   res [virtual, inherited]
 

Unloads a Resource from the managed resources list, calling it's unload() method.

Remarks:
This method removes a resource from the list maintained by this manager, and unloads it from memory. It does NOT destroy the resource itself, although the memory used by it will be largely freed up. This would allow you to reload the resource again if you wished.

Permanently destroying the resource is, as mentioned in ResourceManager::create, the library user's responsibility.

Definition at line 105 of file OgreResourceManager.cpp.

References Ogre::Resource::getHandle(), Ogre::Resource::getName(), Ogre::Resource::getSize(), Ogre::ResourceManager::mMemoryUsage, Ogre::ResourceManager::mResources, Ogre::ResourceManager::mResourcesByHandle, and Ogre::Resource::unload().

Referenced by Ogre::SceneManager::createSkyboxPlane(), and Ogre::SceneManager::createSkydomePlane().

void Ogre::ResourceManager::unloadAndDestroyAll void    [virtual, inherited]
 

Unloads all Resources from memory.

Remarks:
Note that unlike ResourceManager::unload, Resource objects are DESTROYED as well as unloaded. This is because you are unlikely to be managing the deletion of the objects individually in this case.

Reimplemented in Ogre::D3D9TextureManager, and Ogre::GLTextureManager.

Definition at line 122 of file OgreResourceManager.cpp.

References Ogre::ResourceManager::mResources, and Ogre::ResourceManager::mResourcesByHandle.

Referenced by Ogre::BspResourceManager::load(), Ogre::D3DTextureManager::~D3DTextureManager(), and Ogre::ResourceManager::~ResourceManager().


Member Data Documentation

FileMap Ogre::ResourceManager::mArchiveFiles [protected, inherited]
 

Definition at line 200 of file OgreResourceManager.h.

Referenced by Ogre::ResourceManager::_findResourceData(), and Ogre::ResourceManager::addArchiveEx().

ResourceManager::FileMap Ogre::ResourceManager::mCommonArchiveFiles [static, protected, inherited]
 

Definition at line 37 of file OgreResourceManager.cpp.

Referenced by Ogre::ResourceManager::_findCommonResourceData(), Ogre::ResourceManager::_findResourceData(), and Ogre::ResourceManager::addCommonArchiveEx().

std::vector< ArchiveEx * > Ogre::ResourceManager::mCommonVFS [static, protected, inherited]
 

Collection of searchable ArchiveEx classes (virtual file system) for all resource types.

Definition at line 36 of file OgreResourceManager.cpp.

Referenced by Ogre::ResourceManager::_findCommonResourceData(), Ogre::ResourceManager::_findResourceData(), Ogre::ResourceManager::_getAllCommonNamesLike(), Ogre::ResourceManager::addCommonArchiveEx(), Ogre::OverlayManager::loadAndParseOverlayFile(), Ogre::Quake3ShaderManager::parseAllSources(), Ogre::OverlayManager::parseAllSources(), Ogre::MaterialManager::parseAllSources(), and Ogre::FontManager::parseAllSources().

size_t Ogre::ResourceManager::mMemoryBudget [protected, inherited]
 

Definition at line 210 of file OgreResourceManager.h.

Referenced by Ogre::ResourceManager::ResourceManager(), and Ogre::ResourceManager::setMemoryBudget().

size_t Ogre::ResourceManager::mMemoryUsage [protected, inherited]
 

Definition at line 211 of file OgreResourceManager.h.

Referenced by Ogre::ResourceManager::ResourceManager(), and Ogre::ResourceManager::unload().

ResourceHandle Ogre::ResourceManager::mNextHandle [protected, inherited]
 

Definition at line 208 of file OgreResourceManager.h.

Referenced by Ogre::ResourceManager::getNextHandle(), and Ogre::ResourceManager::ResourceManager().

bool Ogre::MeshManager::mPrepAllMeshesForShadowVolumes [protected]
 

Definition at line 341 of file OgreMeshManager.h.

Referenced by getPrepareAllMeshesForShadowVolumes(), MeshManager(), and setPrepareAllMeshesForShadowVolumes().

ResourceMap Ogre::ResourceManager::mResources [protected, inherited]
 

Definition at line 206 of file OgreResourceManager.h.

Referenced by Ogre::OverlayManager::_queueOverlaysForRendering(), Ogre::ResourceManager::add(), Ogre::FontManager::create(), createPrefabPlane(), Ogre::TextureManager::enable32BitTextures(), Ogre::ResourceManager::getByName(), Ogre::OverlayManager::getPositionTargetAt(), Ogre::TextureManager::loadImage(), Ogre::TextureManager::loadRawData(), Ogre::ResourceManager::unload(), Ogre::ResourceManager::unloadAndDestroyAll(), Ogre::GLTextureManager::unloadAndDestroyAll(), Ogre::D3D9TextureManager::unloadAndDestroyAll(), Ogre::ArchiveManager::~ArchiveManager(), and Ogre::DynLibManager::~DynLibManager().

ResourceHandleMap Ogre::ResourceManager::mResourcesByHandle [protected, inherited]
 

Definition at line 205 of file OgreResourceManager.h.

Referenced by Ogre::ResourceManager::add(), Ogre::ResourceManager::getByHandle(), Ogre::ResourceManager::unload(), and Ogre::ResourceManager::unloadAndDestroyAll().

MeshManager * Ogre::Singleton< MeshManager >::ms_Singleton = 0 [static, protected, inherited]
 

Definition at line 44 of file OgreMeshManager.cpp.

Referenced by getSingleton(), and getSingletonPtr().

std::vector<ArchiveEx*> Ogre::ResourceManager::mVFS [protected, inherited]
 

Collection of searchable ArchiveEx classes (virtual file system) for this resource type.

Definition at line 221 of file OgreResourceManager.h.

Referenced by Ogre::ResourceManager::_findResourceData(), Ogre::ResourceManager::_getAllNamesLike(), Ogre::ResourceManager::addArchiveEx(), Ogre::OverlayManager::loadAndParseOverlayFile(), Ogre::Quake3ShaderManager::parseAllSources(), Ogre::OverlayManager::parseAllSources(), Ogre::MaterialManager::parseAllSources(), and Ogre::FontManager::parseAllSources().


The documentation for this class was generated from the following files:

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