MarSTDv2004: CGeomBuilder Class Reference

MarSTDv2004

CGeomBuilder Class Reference

Collaboration diagram for CGeomBuilder:

Collaboration graph
[legend]
List of all members.

Detailed Description

The geometry builder provides methods to dynamically generate geometry like cubes, spheres and cilinders. All generated geometry is transformed by the geometry builder's matrix. Unlike other classes the geometry builder cannot be instantiated by the programmer. The geometry builder class is a so called singleton, which means only one instance exists of which a reference is acquired by called the I() method.
// Example:

CMesh mesh;

CGeomBuilder::I().matrix.push();
{
        // Create a (4, 6, 2) sized box with center at (0, 0, 0).
        CGeomBuilder::I().matrix.identity();
        CGeomBuilder::I().matrix.scale(2.0, 3.0, 1.0);
        CGeomBuilder::I().cube(mesh);
}
CGeomBuilder::I().matrix.pop();

Definition at line 47 of file CGeomBuilder.h.

Public Member Functions

void cube (CMesh &mesh)
void cilinder (CMesh &mesh, int sides)
void circle (CMesh &mesh, int sides)
void cone (CMesh &mesh, int sides)
void sphere (CMesh &mesh, int div1, int div2)
void donut (CMesh &mesh, int sides, int slices, float r1, float r2)

Static Public Member Functions

static CGeomBuilderI ()

Public Attributes

CMatrix matrix
 Generates geometric primitives are transformed by this matrix before being outputted.

Member Function Documentation

static CGeomBuilder& CGeomBuilder::I  )  [static]
 

Get interface method. Call this to acquire an instace of the geometry builder object.

Definition at line 65 of file CGeomBuilder.h.

void CGeomBuilder::cube CMesh mesh  ) 
 

Generate a cube from (-1, -1, -1) to (1, 1, 1).

void CGeomBuilder::cilinder CMesh mesh,
int  sides
 

Circles are at z = -1 and z = +1 Cilinder is oriented along the z axis.

Parameters:
sides The number of sides the cilinder has. Higher means better silhouette.

void CGeomBuilder::circle CMesh mesh,
int  sides
 

Generate a circle with radius 1, in the XY plane.

Parameters:
sides The number of edges.

void CGeomBuilder::cone CMesh mesh,
int  sides
 

Generate a cone shape. Cone converges in (0, 0, 1).

Parameters:
sides Subdivision factor.

void CGeomBuilder::sphere CMesh mesh,
int  div1,
int  div2
 

Generate a sphere with radius 1.

Parameters:
div1 Subdivisions along the z axis.
div2 Subdivisions in the XY plane.


The documentation for this class was generated from the following file:
Generated on Tue Feb 8 21:59:38 2005 for MarSTDv2004 by  doxygen 1.4.1