Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
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...
 
const std::vector< CVector3D > & GetVertices () const
 Returns vertices in the 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 Types

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

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
 

Detailed Description

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

Member Typedef Documentation

◆ FaceIndices

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

◆ Vertices

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

Constructor & Destructor Documentation

◆ CBrush() [1/2]

CBrush::CBrush ( )
default

◆ CBrush() [2/2]

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

◆ Bounds()

void CBrush::Bounds ( CBoundingBoxAligned result) const

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

Parameters
resultthe resulting bounding box is stored here

◆ GetFaces()

void CBrush::GetFaces ( std::vector< std::vector< size_t > > &  out) const

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.

◆ GetVertices()

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

Returns vertices in the brush.

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

◆ Intersect()

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

◆ IsEmpty()

bool CBrush::IsEmpty ( ) const
inline

IsEmpty: Returns whether the brush is empty.

Returns
true if the brush is empty, false otherwise

◆ Slice()

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

Member Data Documentation

◆ m_Faces

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.

◆ m_Vertices

Vertices CBrush::m_Vertices
private

Collection of unique vertices that make up this shape.

◆ NO_VERTEX

const size_t CBrush::NO_VERTEX = ~0u
staticprivate

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