Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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...
 

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.

Definition at line 35 of file Brush.h.

Member Typedef Documentation

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

Definition at line 100 of file Brush.h.

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

Definition at line 99 of file Brush.h.

Constructor & Destructor Documentation

CBrush::CBrush ( )
inline

Definition at line 40 of file Brush.h.

CBrush::CBrush ( const CBoundingBoxAligned bounds)

CBrush: Construct a brush from a bounds object.

Parameters
boundsthe CBoundingBoxAligned object to construct the brush from.

Definition at line 35 of file Brush.cpp.

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

Definition at line 63 of file Brush.cpp.

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.

Definition at line 387 of file Brush.cpp.

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.

Definition at line 382 of file Brush.cpp.

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

Definition at line 348 of file Brush.cpp.

bool CBrush::IsEmpty ( ) const
inline

IsEmpty: Returns whether the brush is empty.

Returns
true if the brush is empty, false otherwise

Definition at line 54 of file Brush.h.

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

Definition at line 192 of file Brush.cpp.

Friends And Related Function Documentation

friend class TestBrush
friend

Definition at line 37 of file Brush.h.

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.

Definition at line 110 of file Brush.h.

Vertices CBrush::m_Vertices
private

Collection of unique vertices that make up this shape.

Definition at line 103 of file Brush.h.

const size_t CBrush::NO_VERTEX = ~0u
staticprivate

Definition at line 97 of file Brush.h.


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