MGeometryManager Class Reference
#include <MGeometryManager.h>
This method is obsolete.
- Deprecated:
- Use MHWRender::MGeometry and MHWRender::MGeometryExtractor instead.
This class provides methods for managing MGeometry resources.
It provides an interface for loading and using hardware textures.
Default geometry shapes.
| Enumerator |
|---|
| kDefaultSphere |
Sphere with radius 1, centered at 0,0,0.
|
| kDefaultPlane |
Plane with width and height of 1, centered at 0,0,0.
Assuming "Y-Up" orientation: width = x-axis, and height = y-axis.
|
| kDefaultCube |
Cube with width, height and depth of 1, centered at 0,0,0.
|
Access the Geometry cache for a shape.
- Parameters
-
| [in] | shape | the surface |
| [in] | requirements | the surface data you want in the cache. Attempting to access cache data not included in the requirements will fail. |
| [in] | components | an optional component group, for accessing a sub-selection of faces (e.g. the faces assigned to a material) |
- Returns
- The cached geometry.
Obtain a reference to geometry for some "default" shapes maintained by the manager such that the geometry returned will match a set of geometric requirements (MGeometryRequirements).
The actual form is a geometric iterator (MGeometryList), which can be used to iterate over the internal data kept (MGeometry).
Note that all data is assumed to be "read-only", as the data is not owned by the caller. To maintain proper reference counting of internal data, the user must "deference" the data when no longer using it via the MGeometryManager::dereferenceGeometry() calls. It is recommended to immediately dereference the data after each use. There is negligable overhead to reference and dereference data in this manner.
Available default shapes include:
- A polygonal sphere : Sphere has radius of 1 and is centered at the origin (0,0,0) in object space.
- A polygonal cube : Cube has dimensions of 1 and is centered at the origin (0,0,0) in object space.
- A polygonal plane : Plane has dimensions of 1 is centered at the origin (0,0,0) in object space. Assuming "Y-Up" orientation, the width is the along the x-axis and the height is along the y-axis.
The following is an example usage via a hardware shader plugin for swatch rendering:
{
populateRequirements(path, requirements);
if(geomIter == NULL) {
}
{
glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(mtm[0]);
if (pos.
data() != NULL && primitives.
data() != NULL)
{
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, (
float*) pos.
data());
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, 0, normal.
data());
}
glDrawElements(GL_TRIANGLES, primitives.
elementCount(), GL_UNSIGNED_INT, primitives.
data());
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
}
}
}
- Parameters
-
- Returns
-
A pointer to a geometry iterator (MGeometryList), which contains a reference to the geometric data (MGeometry). The MGeometry information which tries to match the requirements passed in. ( e.g. position, normal, texture coordinates, tangents, and binormals etc). It can be assumed that all data is floating point such that:
<ul>
<li> Positions are 3 float (x,y,z) positions
<li> Normals are 3 float (x,y,z) vectors.
<li> Texture coordinates are 2 float (u,v) tuples.
<li> Tangents are 3 float (x,y,z) vectors.
<li> Binormals are 3 float (x,y,z) vectors.
</ul>
| const char * className |
( |
| ) |
|
|
static |
Returns the name of this class.
- Returns
- The name of this class.
The documentation for this class was generated from the following files:
- MGeometryManager.h
- MGeometryManager.cpp