Pyrogenesis  trunk
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
CBrush Class Reference

Class CBrush: Represents a convex object, supports some CSG operations. More...

#include <Brush.h>

Classes

struct  Helper
 

Public Member Functions

 CBrush ()
 
 CBrush (const CBoundingBoxAligned &bounds)
 CBrush: Construct a brush from a bounds object. More...
 
bool IsEmpty () const
 IsEmpty: Returns whether the brush is empty. More...
 
void Bounds (CBoundingBoxAligned &result) const
 Bounds: Calculate the axis-aligned bounding box for this brush. More...
 
void Slice (const CPlane &plane, CBrush &result) const
 Slice: Cut the object along the given plane, resulting in a smaller (or even empty) brush representing the part of the object that lies in front of the plane (as defined by the positive direction of its normal vector). More...
 
void Intersect (const CFrustum &frustum, CBrush &result) const
 Intersect: Intersect the brush with the given frustum. More...
 
void Render (CShaderProgramPtr &shader) const
 Render the surfaces of the brush as triangles. More...
 
void RenderOutline (CShaderProgramPtr &shader) const
 Render the outline of the brush as lines. More...
 

Private Types

typedef std::vector< CVector3DVertices
 
typedef std::vector< size_t > FaceIndices
 

Private Member Functions

std::vector< CVector3DGetVertices () const
 Returns a copy of the vertices in this brush. More...
 
void GetFaces (std::vector< std::vector< size_t > > &out) const
 Writes a vector of the faces in this brush to out. More...
 

Private Attributes

Vertices m_Vertices
 Collection of unique vertices that make up this shape. More...
 
FaceIndices m_Faces
 Holds the face definitions of this brush. More...
 

Static Private Attributes

static const size_t NO_VERTEX = ~0u
 

Friends

class TestBrush
 

Detailed Description

Class CBrush: Represents a convex object, supports some CSG operations.

Member Typedef Documentation

typedef std::vector<size_t> CBrush::FaceIndices
private
typedef std::vector<CVector3D> CBrush::Vertices
private

Constructor & Destructor Documentation

CBrush::CBrush ( )
inline
CBrush::CBrush ( const CBoundingBoxAligned bounds)

CBrush: Construct a brush from a bounds object.

Parameters
boundsthe CBoundingBoxAligned object to construct the brush from.

Member Function Documentation

void CBrush::Bounds ( CBoundingBoxAligned result) const

Bounds: Calculate the axis-aligned bounding box for this brush.

Parameters
resultthe resulting bounding box is stored here
void CBrush::GetFaces ( std::vector< std::vector< size_t > > &  out) const
private

Writes a vector of the faces in this brush to out.

Each face is itself a vector, listing the vertex indices that make up the face, starting and ending with the same index. Intended for testing purposes; you should not need to use this method directly.

std::vector< CVector3D > CBrush::GetVertices ( ) const
private

Returns a copy of the vertices in this brush.

Intended for testing purposes; you should not need to use this method directly.

void CBrush::Intersect ( const CFrustum frustum,
CBrush result 
) const

Intersect: Intersect the brush with the given frustum.

Parameters
frustumthe frustum to intersect with
resultthe resulting brush is stored here
bool CBrush::IsEmpty ( ) const
inline

IsEmpty: Returns whether the brush is empty.

Returns
true if the brush is empty, false otherwise
void CBrush::Render ( CShaderProgramPtr shader) const

Render the surfaces of the brush as triangles.

void CBrush::RenderOutline ( CShaderProgramPtr shader) const

Render the outline of the brush as lines.

void CBrush::Slice ( const CPlane plane,
CBrush result 
) const

Slice: Cut the object along the given plane, resulting in a smaller (or even empty) brush representing the part of the object that lies in front of the plane (as defined by the positive direction of its normal vector).

Parameters
planethe slicing plane
resultthe resulting brush is stored here

Friends And Related Function Documentation

friend class TestBrush
friend

Member Data Documentation

FaceIndices CBrush::m_Faces
private

Holds the face definitions of this brush.

Each face is a sequence of indices into m_Vertices that starts and ends with the same vertex index, completing a loop through all the vertices that make up the face. This vector holds all the face sequences back-to-back, thus looking something like 'x—xy-----—yz–z' in the general case.

Vertices CBrush::m_Vertices
private

Collection of unique vertices that make up this shape.

const size_t CBrush::NO_VERTEX = ~0u
staticprivate

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