Brush Class Reference

#include <brush.h>

Inheritance diagram for Brush:
Inheritance graph
[legend]
Collaboration diagram for Brush:
Collaboration graph
[legend]

Data Structures

class  BrushUndoMemento
 The undo memento for a brush stores only the list of face references - the faces are not copied. More...

Public Types

typedef MemberCaller< Brush,&Brush::transformChanged > TransformChangedCaller
typedef Faces::const_iterator const_iterator

Public Member Functions

 STRING_CONSTANT (Name,"Brush")
 Brush (scene::Node &node, const Callback &evaluateTransform, const Callback &boundsChanged)
 Brush (const Brush &other, scene::Node &node, const Callback &evaluateTransform, const Callback &boundsChanged)
 Brush (const Brush &other)
 ~Brush ()
Brushoperator= (const Brush &other)
void attach (BrushObserver &observer)
void detach (BrushObserver &observer)
void forEachFace (const BrushVisitor &visitor) const
void forEachFace_instanceAttach (MapFile *map) const
void forEachFace_instanceDetach (MapFile *map) const
void instanceAttach (const scene::Path &path)
void instanceDetach (const scene::Path &path)
std::string name () const
void attach (const NameCallback &callback)
void detach (const NameCallback &callback)
void updateFiltered ()
void planeChanged ()
void shaderChanged ()
void evaluateBRep () const
void transformChanged ()
void evaluateTransform ()
const Matrix4 & localToParent () const
void aabbChanged ()
const AABB & localAABB () const
VolumeIntersectionValue intersectVolume (const VolumeTest &test, const Matrix4 &localToWorld) const
void renderComponents (SelectionSystem::EComponentMode mode, Renderer &renderer, const VolumeTest &volume, const Matrix4 &localToWorld) const
void transform (const Matrix4 &matrix)
void snapto (float snap)
void revertTransform ()
void freezeTransform ()
std::size_t absoluteIndex (FaceVertexId faceVertex)
 Returns the absolute index of the faceVertex.
void appendFaces (const Faces &other)
void undoSave ()
UndoMementoexportState () const
 export the current state via UndoMemento
void importState (const UndoMemento *state)
 restore a previously stored memento
bool isDetail ()
FaceaddFace (const Face &face)
 Appends a copy of face to the end of the face list.
FaceaddPlane (const Vector3 &p0, const Vector3 &p1, const Vector3 &p2, const std::string &shader, const TextureProjection &projection)
 Appends a new face constructed from the parameters to the end of the face list.
std::size_t DEBUG_size ()
const_iterator begin () const
const_iterator end () const
Faceback ()
const Faceback () const
void reserve (std::size_t count)
void push_back (Faces::value_type face)
void pop_back ()
void erase (std::size_t index)
void connectivityChanged ()
void clear ()
std::size_t size () const
bool empty () const
bool hasContributingFaces () const
 Returns true if any face of the brush contributes to the final B-Rep.
void removeEmptyFaces ()
 Removes faces that do not contribute to the brush. This is useful for cleaning up after CSG operations on the brush. Note: removal of empty faces is not performed during direct brush manipulations, because it would make a manipulation irreversible if it created an empty face.
void windingForClipPlane (Winding &winding, const Plane3 &plane) const
 Constructs winding from the intersection of plane with the other planes of the brush.
void update_wireframe (RenderableWireframe &wire, const bool *faces_visible) const
void update_faces_wireframe (Array< PointVertex > &wire, const bool *faces_visible) const
void copy (const Brush &other)
 Makes this brush a deep-copy of the other.

Static Public Member Functions

static void constructStatic ()
static void destroyStatic ()

Data Fields

Callback m_lightsChanged
InstanceCounter m_instanceCounter

Static Public Attributes

static Shader * m_state_point
static double m_maxWorldCoord

Private Types

typedef UniqueSet
< BrushObserver * > 
Observers
typedef std::vector
< SelectableVertex
SelectableVertices
typedef std::vector
< SelectableEdge
SelectableEdges

Private Member Functions

void edge_push_back (FaceVertexId faceVertex)
void edge_clear ()
void vertex_push_back (FaceVertexId faceVertex)
void vertex_clear ()
bool plane_unique (std::size_t index) const
 Returns true if the face identified by index is preceded by another plane that takes priority over it.
void removeDegenerateEdges ()
 Removes edges that are smaller than the tolerance used when generating brush windings.
void removeDegenerateFaces ()
 Invalidates faces that have only two vertices in their winding, while preserving edge-connectivity information.
void removeDuplicateEdges ()
 Removes edges that have the same adjacent-face as their immediate neighbour.
void verifyConnectivityGraph ()
 Removes edges that do not have a matching pair in their adjacent-face.
bool isBounded ()
 Returns true if the brush is a finite volume. A brush without a finite volume extends past the maximum world bounds and is not valid.
bool buildWindings ()
 Constructs the polygon windings for each face of the brush. Also updates the brush bounding-box and face texture-coordinates.
void buildBRep ()
 Constructs the face windings and updates anything that depends on them.

Private Attributes

scene::Node * m_node
Observers m_observers
UndoObserverm_undoable_observer
MapFilem_map
Faces m_faces
Array< PointVertex > m_faceCentroidPoints
RenderablePointArray m_render_faces
Array< PointVertex > m_uniqueVertexPoints
SelectableVertices m_select_vertices
RenderablePointArray m_render_vertices
Array< PointVertex > m_uniqueEdgePoints
SelectableEdges m_select_edges
RenderablePointArray m_render_edges
Array< EdgeRenderIndicesm_edge_indices
Array< EdgeFacesm_edge_faces
AABB m_aabb_local
Callback m_evaluateTransform
Callback m_boundsChanged
bool m_planeChanged
bool m_transformChanged

Detailed Description

Definition at line 1431 of file brush.h.


Member Typedef Documentation

typedef Faces::const_iterator Brush::const_iterator

Definition at line 1810 of file brush.h.

Definition at line 1442 of file brush.h.

typedef std::vector<SelectableEdge> Brush::SelectableEdges [private]

Definition at line 1460 of file brush.h.

typedef std::vector<SelectableVertex> Brush::SelectableVertices [private]

Definition at line 1455 of file brush.h.

typedef MemberCaller<Brush, &Brush::transformChanged> Brush::TransformChangedCaller

Definition at line 1632 of file brush.h.


Constructor & Destructor Documentation

Brush::Brush ( scene::Node &  node,
const Callback &  evaluateTransform,
const Callback &  boundsChanged 
) [inline]

Definition at line 1485 of file brush.h.

References planeChanged().

Brush::Brush ( const Brush other,
scene::Node &  node,
const Callback &  evaluateTransform,
const Callback &  boundsChanged 
) [inline]

Definition at line 1493 of file brush.h.

References copy().

Brush::Brush ( const Brush other  )  [inline]

Definition at line 1501 of file brush.h.

References copy().

Brush::~Brush (  )  [inline]

Definition at line 1510 of file brush.h.

References UniqueSet< Value >::empty(), and m_observers.


Member Function Documentation

void Brush::aabbChanged (  )  [inline]

Definition at line 1646 of file brush.h.

References m_boundsChanged.

Referenced by planeChanged().

std::size_t Brush::absoluteIndex ( FaceVertexId  faceVertex  )  [inline]

Returns the absolute index of the faceVertex.

Definition at line 1707 of file brush.h.

References FaceVertexId::getFace(), FaceVertexId::getVertex(), i, and m_faces.

Face* Brush::addFace ( const Face face  )  [inline]

Appends a copy of face to the end of the face list.

Definition at line 1768 of file brush.h.

References isDetail(), m_faces, planeChanged(), push_back(), and undoSave().

Referenced by copy().

Face* Brush::addPlane ( const Vector3 p0,
const Vector3 p1,
const Vector3 p2,
const std::string shader,
const TextureProjection &  projection 
) [inline]

Appends a new face constructed from the parameters to the end of the face list.

Definition at line 1781 of file brush.h.

References isDetail(), m_faces, planeChanged(), push_back(), and undoSave().

void Brush::appendFaces ( const Faces other  )  [inline]

Definition at line 1716 of file brush.h.

References clear(), i, and push_back().

Referenced by importState().

void Brush::attach ( const NameCallback callback  )  [inline, virtual]

Reimplemented from Nameable.

Definition at line 1587 of file brush.h.

void Brush::attach ( BrushObserver observer  )  [inline]
const Face* Brush::back (  )  const [inline]

Definition at line 1825 of file brush.h.

References m_faces.

Face* Brush::back (  )  [inline]

Definition at line 1821 of file brush.h.

References m_faces.

const_iterator Brush::begin (  )  const [inline]

Definition at line 1812 of file brush.h.

References m_faces.

Referenced by hasContributingFaces(), isBounded(), and BrushInstance::selectPlanes().

void Brush::buildBRep (  )  [private]

Constructs the face windings and updates anything that depends on them.

Referenced by evaluateBRep().

bool Brush::buildWindings (  )  [inline, private]

Constructs the polygon windings for each face of the brush. Also updates the brush bounding-box and face texture-coordinates.

Definition at line 2145 of file brush.h.

References Face::EmitTextureCoordinates(), f, Face::getWinding(), i, isBounded(), m_aabb_local, m_faces, Face::plane3(), plane3_valid(), plane_unique(), removeDegenerateEdges(), removeDegenerateFaces(), removeDuplicateEdges(), verifyConnectivityGraph(), and windingForClipPlane().

void Brush::clear (  )  [inline]

Clears the planes vector

Definition at line 1883 of file brush.h.

References UniqueSet< Value >::begin(), UniqueSet< Value >::end(), forEachFace_instanceDetach(), i, m_faces, m_instanceCounter, m_map, m_observers, and undoSave().

Referenced by appendFaces().

void Brush::connectivityChanged (  )  [inline, virtual]

Implements FaceObserver.

Definition at line 1873 of file brush.h.

References UniqueSet< Value >::begin(), UniqueSet< Value >::end(), i, and m_observers.

static void Brush::constructStatic (  )  [inline, static]

Definition at line 1794 of file brush.h.

References Face::m_quantise, m_state_point, and quantiseFloating().

void Brush::copy ( const Brush other  )  [inline]

Makes this brush a deep-copy of the other.

Definition at line 1997 of file brush.h.

References addFace(), i, m_faces, and planeChanged().

Referenced by Brush().

std::size_t Brush::DEBUG_size (  )  [inline]

Definition at line 1805 of file brush.h.

References m_faces.

Referenced by BrushInstance::DEBUG_verify().

static void Brush::destroyStatic (  )  [inline, static]

Definition at line 1800 of file brush.h.

void Brush::detach ( const NameCallback callback  )  [inline, virtual]

Reimplemented from Nameable.

Definition at line 1590 of file brush.h.

void Brush::detach ( BrushObserver observer  )  [inline]

Definition at line 1534 of file brush.h.

References UniqueSet< Value >::erase(), and m_observers.

Referenced by BrushInstance::~BrushInstance().

void Brush::edge_clear (  )  [inline, private]
void Brush::edge_push_back ( FaceVertexId  faceVertex  )  [inline, private]
bool Brush::empty (  )  const [inline]

Definition at line 1899 of file brush.h.

References m_faces.

const_iterator Brush::end (  )  const [inline]

Definition at line 1816 of file brush.h.

References m_faces.

Referenced by hasContributingFaces(), isBounded(), and BrushInstance::selectPlanes().

void Brush::erase ( std::size_t  index  )  [inline]
void Brush::evaluateBRep (  )  const [inline]
void Brush::evaluateTransform (  )  [inline, virtual]

Implements FaceObserver.

Definition at line 1634 of file brush.h.

References m_evaluateTransform, m_transformChanged, and revertTransform().

UndoMemento* Brush::exportState (  )  const [inline, virtual]

export the current state via UndoMemento

Returns:
a memento that represents current state

Implements Undoable.

Definition at line 1746 of file brush.h.

References m_faces.

void Brush::forEachFace ( const BrushVisitor visitor  )  const [inline]

Definition at line 1539 of file brush.h.

References i, m_faces, and BrushVisitor::visit().

Referenced by Brush_forEachFace().

void Brush::forEachFace_instanceAttach ( MapFile map  )  const [inline]

Definition at line 1546 of file brush.h.

References i, and m_faces.

Referenced by instanceAttach().

void Brush::forEachFace_instanceDetach ( MapFile map  )  const [inline]

Definition at line 1552 of file brush.h.

References i, and m_faces.

Referenced by clear(), and instanceDetach().

void Brush::freezeTransform (  )  [inline]

Definition at line 1699 of file brush.h.

References i, and m_faces.

Referenced by BrushInstance::applyTransform().

bool Brush::hasContributingFaces (  )  const [inline]

Returns true if any face of the brush contributes to the final B-Rep.

Definition at line 1905 of file brush.h.

References begin(), end(), and i.

void Brush::importState ( const UndoMemento state  )  [inline, virtual]

restore a previously stored memento

Parameters:
state state that should be restored

Implements Undoable.

Definition at line 1751 of file brush.h.

References appendFaces(), UniqueSet< Value >::begin(), UniqueSet< Value >::end(), i, m_faces, m_observers, planeChanged(), and undoSave().

void Brush::instanceAttach ( const scene::Path path  )  [inline]
void Brush::instanceDetach ( const scene::Path path  )  [inline]
VolumeIntersectionValue Brush::intersectVolume ( const VolumeTest test,
const Matrix4 &  localToWorld 
) const [inline, virtual]

Implements Cullable.

Definition at line 1656 of file brush.h.

References m_aabb_local, and VolumeTest::TestAABB().

bool Brush::isBounded (  )  [inline, private]

Returns true if the brush is a finite volume. A brush without a finite volume extends past the maximum world bounds and is not valid.

Definition at line 2134 of file brush.h.

References begin(), end(), and i.

Referenced by buildWindings().

bool Brush::isDetail (  )  [inline]

Definition at line 1762 of file brush.h.

References m_faces.

Referenced by addFace(), and addPlane().

const AABB& Brush::localAABB (  )  const [inline, virtual]

Return the local AABB for this object.

Implements Bounded.

Definition at line 1650 of file brush.h.

References evaluateBRep(), and m_aabb_local.

const Matrix4& Brush::localToParent (  )  const [inline]

Definition at line 1642 of file brush.h.

std::string Brush::name (  )  const [inline, virtual]

Implements Nameable.

Definition at line 1583 of file brush.h.

Brush& Brush::operator= ( const Brush other  ) 
bool Brush::plane_unique ( std::size_t  index  )  const [inline, private]

Returns true if the face identified by index is preceded by another plane that takes priority over it.

Definition at line 2036 of file brush.h.

References i, m_faces, and plane3_inside().

Referenced by buildWindings(), and windingForClipPlane().

void Brush::planeChanged (  )  [inline, virtual]
void Brush::pop_back (  )  [inline]
void Brush::push_back ( Faces::value_type  face  )  [inline]
void Brush::removeDegenerateEdges (  )  [inline, private]

Removes edges that are smaller than the tolerance used when generating brush windings.

Definition at line 2048 of file brush.h.

References i, m_faces, and next.

Referenced by buildWindings().

void Brush::removeDegenerateFaces (  )  [inline, private]

Invalidates faces that have only two vertices in their winding, while preserving edge-connectivity information.

Definition at line 2070 of file brush.h.

References i, and m_faces.

Referenced by buildWindings().

void Brush::removeDuplicateEdges (  )  [inline, private]

Removes edges that have the same adjacent-face as their immediate neighbour.

Definition at line 2099 of file brush.h.

References i, m_faces, and next.

Referenced by buildWindings().

void Brush::removeEmptyFaces (  )  [inline]

Removes faces that do not contribute to the brush. This is useful for cleaning up after CSG operations on the brush. Note: removal of empty faces is not performed during direct brush manipulations, because it would make a manipulation irreversible if it created an empty face.

Definition at line 1917 of file brush.h.

References erase(), evaluateBRep(), i, m_faces, and planeChanged().

void Brush::renderComponents ( SelectionSystem::EComponentMode  mode,
Renderer renderer,
const VolumeTest volume,
const Matrix4 &  localToWorld 
) const [inline]
void Brush::reserve ( std::size_t  count  )  [inline]

Reserve space in the planes vector

Parameters:
count The amount of planes to reserve

Definition at line 1833 of file brush.h.

References UniqueSet< Value >::begin(), UniqueSet< Value >::end(), i, m_faces, and m_observers.

void Brush::revertTransform (  )  [inline]

Definition at line 1693 of file brush.h.

References i, and m_faces.

Referenced by BrushInstance::applyTransform(), and evaluateTransform().

void Brush::shaderChanged (  )  [inline, virtual]

Implements FaceObserver.

Definition at line 1613 of file brush.h.

References planeChanged(), and updateFiltered().

std::size_t Brush::size (  )  const [inline]

Definition at line 1895 of file brush.h.

References m_faces.

void Brush::snapto ( float  snap  )  [inline, virtual]

Implements Snappable.

Definition at line 1687 of file brush.h.

References i, and m_faces.

Brush::STRING_CONSTANT ( Name  ,
"Brush"   
)
void Brush::transform ( const Matrix4 &  matrix  )  [inline]

Definition at line 1679 of file brush.h.

References i, and m_faces.

Referenced by BrushInstance::evaluateTransform().

void Brush::transformChanged (  )  [inline]

Definition at line 1627 of file brush.h.

References m_transformChanged, and planeChanged().

void Brush::undoSave (  )  [inline]

Definition at line 1736 of file brush.h.

References MapFile::changed(), m_map, m_undoable_observer, and UndoObserver::save().

Referenced by addFace(), addPlane(), clear(), and importState().

void Brush::update_faces_wireframe ( Array< PointVertex > &  wire,
const bool *  faces_visible 
) const [inline]
void Brush::update_wireframe ( RenderableWireframe wire,
const bool *  faces_visible 
) const [inline]
void Brush::updateFiltered (  )  [inline, virtual]

Implements Filterable.

Definition at line 1595 of file brush.h.

References brush_filtered(), and m_node.

Referenced by shaderChanged().

void Brush::verifyConnectivityGraph (  )  [inline, private]

Removes edges that do not have a matching pair in their adjacent-face.

Definition at line 2116 of file brush.h.

References i, and m_faces.

Referenced by buildWindings().

void Brush::vertex_clear (  )  [inline, private]
void Brush::vertex_push_back ( FaceVertexId  faceVertex  )  [inline, private]
void Brush::windingForClipPlane ( Winding &  winding,
const Plane3 plane 
) const [inline]

Constructs winding from the intersection of plane with the other planes of the brush.

Definition at line 1933 of file brush.h.

References Plane3::dist(), i, m_faces, m_maxWorldCoord, Plane3::normal(), Face::plane3(), plane3_equal(), plane3_opposing(), plane3_valid(), plane_unique(), and std::swap().

Referenced by buildWindings(), and BrushClipPlane::setPlane().


Field Documentation

AABB Brush::m_aabb_local [private]

Definition at line 1467 of file brush.h.

Referenced by buildWindings(), intersectVolume(), and localAABB().

Callback Brush::m_boundsChanged [private]

Definition at line 1470 of file brush.h.

Referenced by aabbChanged().

Definition at line 1465 of file brush.h.

Referenced by update_wireframe().

Definition at line 1464 of file brush.h.

Referenced by update_wireframe().

Callback Brush::m_evaluateTransform [private]

Definition at line 1469 of file brush.h.

Referenced by evaluateTransform().

Array<PointVertex> Brush::m_faceCentroidPoints [private]

Definition at line 1451 of file brush.h.

Referenced by update_faces_wireframe().

Faces Brush::m_faces [private]
InstanceCounter Brush::m_instanceCounter

Definition at line 1559 of file brush.h.

Referenced by clear(), erase(), instanceAttach(), instanceDetach(), pop_back(), and push_back().

MapFile* Brush::m_map [private]

Definition at line 1445 of file brush.h.

Referenced by clear(), erase(), instanceAttach(), instanceDetach(), pop_back(), push_back(), and undoSave().

double Brush::m_maxWorldCoord [static]

Definition at line 1483 of file brush.h.

Referenced by BrushClipPlane::render(), and windingForClipPlane().

scene::Node* Brush::m_node [private]

Definition at line 1441 of file brush.h.

Referenced by updateFiltered().

bool Brush::m_planeChanged [mutable, private]

Definition at line 1472 of file brush.h.

Referenced by evaluateBRep(), and planeChanged().

RenderablePointArray Brush::m_render_edges [private]

Definition at line 1462 of file brush.h.

Referenced by renderComponents().

RenderablePointArray Brush::m_render_faces [private]

Definition at line 1452 of file brush.h.

Referenced by renderComponents().

RenderablePointArray Brush::m_render_vertices [private]

Definition at line 1457 of file brush.h.

Referenced by renderComponents().

Definition at line 1461 of file brush.h.

Referenced by attach(), edge_clear(), and edge_push_back().

Definition at line 1456 of file brush.h.

Referenced by attach(), vertex_clear(), and vertex_push_back().

Shader* Brush::m_state_point [static]

Definition at line 1481 of file brush.h.

Referenced by constructStatic(), and BrushInstance::renderComponents().

bool Brush::m_transformChanged [mutable, private]

Definition at line 1473 of file brush.h.

Referenced by evaluateTransform(), and transformChanged().

Definition at line 1444 of file brush.h.

Referenced by instanceAttach(), instanceDetach(), and undoSave().

Array<PointVertex> Brush::m_uniqueEdgePoints [private]

Definition at line 1459 of file brush.h.

Array<PointVertex> Brush::m_uniqueVertexPoints [private]

Definition at line 1454 of file brush.h.

Referenced by update_wireframe().


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

Generated by  doxygen 1.6.2