}
-
inline bool texdef_sane( const texdef_t& texdef ){
return fabs( texdef.shift[0] ) < ( 1 << 16 )
&& fabs( texdef.shift[1] ) < ( 1 << 16 );
{
public:
virtual void realiseShader() = 0;
+
virtual void unrealiseShader() = 0;
};
public:
ContentsFlagsValue(){
}
+
ContentsFlagsValue( int surfaceFlags, int contentFlags, int value, bool specified ) :
m_surfaceFlags( surfaceFlags ),
m_contentFlags( contentFlags ),
m_value( value ),
m_specified( specified ){
}
+
int m_surfaceFlags;
int m_contentFlags;
int m_value;
void exportState( FaceShader& faceShader ) const {
faceShader.setShader( m_shader.c_str() );
- faceShader.setFlags( m_flags );
+ faceShader.m_flags = m_flags;
}
};
m_realised( false ){
captureShader();
}
+
~FaceShader(){
releaseShader();
}
+
// copy-construction not supported
FaceShader( const FaceShader& other );
m_instanced = true;
m_state->incrementUsed();
}
+
void instanceDetach(){
m_state->decrementUsed();
m_instanced = false;
m_state = GlobalShaderCache().capture( m_shader.c_str() );
m_state->attach( *this );
}
+
void releaseShader(){
ASSERT_MESSAGE( m_state != 0, "shader cannot be released" );
m_state->detach( *this );
observer.realiseShader();
});
}
+
void unrealise(){
ASSERT_MESSAGE( m_realised, "FaceTexdef::unrealise: already unrealised" );
m_observers.forEach([](FaceShaderObserver &observer) {
m_state->incrementUsed();
}
}
+
ContentsFlagsValue getFlags() const {
ASSERT_MESSAGE( m_realised, "FaceShader::getFlags: flags not valid when unrealised" );
if ( !m_flags.m_specified ) {
}
return m_flags;
}
+
void setFlags( const ContentsFlagsValue& flags ){
ASSERT_MESSAGE( m_realised, "FaceShader::setFlags: flags not valid when unrealised" );
ContentsFlagsValue_assignMasked( m_flags, flags );
}
return 1;
}
+
std::size_t height() const {
if ( m_realised ) {
return m_state->getTexture().height;
}
return 1;
}
+
unsigned int shaderFlags() const {
if ( m_realised ) {
return m_state->getFlags();
};
-
-
class FaceTexdef : public FaceShaderObserver
{
// not copyable
FaceTexdef( const FaceTexdef& other );
+
// not assignable
FaceTexdef& operator=( const FaceTexdef& other );
+
public:
class SavedState
{
m_scaleApplied( false ){
m_shader.attach( *this );
}
+
~FaceTexdef(){
m_shader.detach( *this );
}
m_scaleApplied = true;
m_projection.m_brushprimit_texdef.addScale( m_shader.width(), m_shader.height() );
}
+
void removeScale(){
ASSERT_MESSAGE( m_scaleApplied, "texture scale aready removed" );
m_scaleApplied = false;
addScale();
}
}
+
void unrealiseShader(){
if ( m_projectionInitialised && m_scaleApplied ) {
removeScale();
tmp.removeScale( m_shader.width(), m_shader.height() );
return TextureProjection( m_projection.m_texdef, tmp, m_projection.m_basis_s, m_projection.m_basis_t );
}
+
void setBasis( const Vector3& normal ){
Matrix4 basis;
Normal_GetTransform( normal, basis );
FacePlane() : m_funcStaticOrigin( 0, 0, 0 ){
}
+
FacePlane( const FacePlane& other ) : m_funcStaticOrigin( 0, 0, 0 ){
if ( !isDoom3Plane() ) {
planepts_assign( m_planepts, other.m_planepts );
updateSource();
}
}
+
void transform( const Matrix4& matrix, bool mirror ){
if ( !isDoom3Plane() ) {
updateSource();
}
}
+
void offset( float offset ){
if ( !isDoom3Plane() ) {
Vector3 move( vector3_scaled( m_planeCached.normal(), -offset ) );
void updateTranslated(){
m_planeCached = Plane3_applyTranslation( m_plane, m_funcStaticOrigin );
}
+
void updateSource(){
m_plane = Plane3_applyTranslation( m_planeCached, vector3_negated( m_funcStaticOrigin ) );
}
PlanePoints& planePoints(){
return m_planepts;
}
+
const PlanePoints& planePoints() const {
return m_planepts;
}
+
const Plane3& plane3() const {
return m_planeCached;
}
+
void setDoom3Plane( const Plane3& plane ){
m_plane = plane;
updateTranslated();
}
+
const Plane3& getDoom3Plane() const {
return m_plane;
}
updateSource();
}
}
+
void copy( const Vector3& p0, const Vector3& p1, const Vector3& p2 ){
if ( !isDoom3Plane() ) {
m_planepts[0] = p0;
};
bool face_filtered( Face& face );
+
void add_face_filter( FaceFilter& filter, int mask, bool invert = false );
void Brush_addTextureChangedCallback( const SignalHandler& callback );
+
void Brush_textureChanged();
{
public:
virtual void planeChanged() = 0;
+
virtual void connectivityChanged() = 0;
+
virtual void shaderChanged() = 0;
+
virtual void evaluateTransform() = 0;
};
// assignment not supported
Face& operator=( const Face& other );
+
// copy-construction not supported
Face( const Face& other );
m_texdef.setBasis( m_plane.plane3().normal() );
planeChanged();
}
+
Face(
const Vector3& p0,
const Vector3& p1,
planeChanged();
updateFiltered();
}
+
Face( const Face& other, FaceObserver* observer ) :
m_refcount( 0 ),
m_shader( other.m_shader.getShader(), other.m_shader.m_flags ),
planeChanged();
updateFiltered();
}
+
~Face(){
m_shader.detach( *this );
}
void realiseShader(){
m_observer->shaderChanged();
}
+
void unrealiseShader(){
}
void updateFiltered(){
m_filtered = face_filtered( *this );
}
+
bool isFiltered() const {
return m_filtered;
}
UndoMemento* exportState() const {
return new SavedState( *this );
}
+
void importState( const UndoMemento* data ){
undoSave();
void IncRef(){
++m_refcount;
}
+
void DecRef(){
if ( --m_refcount == 0 ) {
delete this;
planepts_assign( m_move_planeptsTransformed, m_move_planepts );
m_texdefTransformed = m_texdef.m_projection;
}
+
void freezeTransform(){
undoSave();
m_plane = m_planeTransformed;
const char* GetShader() const {
return m_shader.getShader();
}
+
void SetShader( const char* name ){
undoSave();
m_shader.setShader( name );
void revertTexdef(){
m_texdefTransformed = m_texdef.m_projection;
}
+
void texdefChanged(){
revertTexdef();
EmitTextureCoordinates();
void GetTexdef( TextureProjection& projection ) const {
projection = m_texdef.normalised();
}
+
void SetTexdef( const TextureProjection& projection ){
undoSave();
m_texdef.setTexdef( projection );
void GetFlags( ContentsFlagsValue& flags ) const {
flags = m_shader.getFlags();
}
+
void SetFlags( const ContentsFlagsValue& flags ){
undoSave();
m_shader.setFlags( flags );
const Winding& getWinding() const {
return m_winding;
}
+
Winding& getWinding(){
return m_winding;
}
m_observer->evaluateTransform();
return m_planeTransformed.plane3();
}
+
FacePlane& getPlane(){
return m_plane;
}
+
const FacePlane& getPlane() const {
return m_plane;
}
+
FaceTexdef& getTexdef(){
return m_texdef;
}
+
const FaceTexdef& getTexdef() const {
return m_texdef;
}
+
FaceShader& getShader(){
return m_shader;
}
+
const FaceShader& getShader() const {
return m_shader;
}
bool isDetail() const {
return ( m_shader.m_flags.m_contentFlags & BRUSH_DETAIL_MASK ) != 0;
}
+
void setDetail( bool detail ){
undoSave();
if ( detail && !isDetail() ) {
bool contributes() const {
return m_winding.numpoints > 2;
}
+
bool is_bounded() const {
for ( Winding::const_iterator i = m_winding.begin(); i != m_winding.end(); ++i )
{
std::size_t getFace() const {
return m_face;
}
+
std::size_t getVertex() const {
return m_vertex;
}
EdgeRenderIndices()
: first( 0 ), second( 0 ){
}
+
EdgeRenderIndices( const RenderIndex _first, const RenderIndex _second )
: first( _first ), second( _second ){
}
EdgeFaces()
: first( c_brush_maxFaces ), second( c_brush_maxFaces ){
}
+
EdgeFaces( const faceIndex_t _first, const faceIndex_t _second )
: first( _first ), second( _second ){
}
};
class Brush;
+
typedef std::vector<Brush*> brush_vector_t;
class BrushFilter
};
bool brush_filtered( Brush& brush );
+
void add_brush_filter( BrushFilter& filter, int mask, bool invert = false );
SelectableEdge( Faces& faces, FaceVertexId faceVertex )
: m_faces( faces ), m_faceVertex( faceVertex ){
}
+
SelectableEdge& operator=( const SelectableEdge& other ){
m_faceVertex = other.m_faceVertex;
return *this;
SelectableVertex( Faces& faces, FaceVertexId faceVertex )
: m_faces( faces ), m_faceVertex( faceVertex ){
}
+
SelectableVertex& operator=( const SelectableVertex& other ){
m_faceVertex = other.m_faceVertex;
return *this;
{
public:
virtual void reserve( std::size_t size ) = 0;
+
virtual void clear() = 0;
+
virtual void push_back( Face& face ) = 0;
+
virtual void pop_back() = 0;
+
virtual void erase( std::size_t index ) = 0;
+
virtual void connectivityChanged() = 0;
virtual void edge_clear() = 0;
+
virtual void edge_push_back( SelectableEdge& edge ) = 0;
virtual void vertex_clear() = 0;
+
virtual void vertex_push_back( SelectableVertex& vertex ) = 0;
virtual void DEBUG_verify() const = 0;
AABB m_aabb_local;
// ----
-Callback m_evaluateTransform;
-Callback m_boundsChanged;
+Callback<void()> m_evaluateTransform;
+Callback<void()> m_boundsChanged;
mutable bool m_planeChanged; // b-rep evaluation required
mutable bool m_transformChanged; // transform evaluation required
public:
STRING_CONSTANT( Name, "Brush" );
-Callback m_lightsChanged;
+Callback<void()> m_lightsChanged;
// static data
static Shader* m_state_point;
static EBrushType m_type;
static double m_maxWorldCoord;
-Brush( scene::Node& node, const Callback& evaluateTransform, const Callback& boundsChanged ) :
+Brush( scene::Node& node, const Callback<void()>& evaluateTransform, const Callback<void()>& boundsChanged ) :
m_node( &node ),
m_undoable_observer( 0 ),
m_map( 0 ),
m_transformChanged( false ){
planeChanged();
}
-Brush( const Brush& other, scene::Node& node, const Callback& evaluateTransform, const Callback& boundsChanged ) :
+Brush( const Brush& other, scene::Node& node, const Callback<void()>& evaluateTransform, const Callback<void()>& boundsChanged ) :
m_node( &node ),
m_undoable_observer( 0 ),
m_map( 0 ),
m_transformChanged( false ){
copy( other );
}
+
Brush( const Brush& other ) :
TransformNode( other ),
Bounded( other ),
m_transformChanged( false ){
copy( other );
}
+
~Brush(){
ASSERT_MESSAGE( m_observers.empty(), "Brush::~Brush: observers still attached" );
}
m_observers.insert( &observer );
}
+
void detach( BrushObserver& observer ){
m_observers.erase( &observer );
}
( *i )->instanceAttach( map );
}
}
+
void forEachFace_instanceDetach( MapFile* map ) const {
for ( Faces::const_iterator i = m_faces.begin(); i != m_faces.end(); ++i )
{
}
InstanceCounter m_instanceCounter;
+
void instanceAttach( const scene::Path& path ){
if ( ++m_instanceCounter.m_count == 1 ) {
m_map = path_find_mapfile( path.begin(), path.end() );
ASSERT_MESSAGE( path_find_mapfile( path.begin(), path.end() ) == m_map, "node is instanced across more than one file" );
}
}
+
void instanceDetach( const scene::Path& path ){
if ( --m_instanceCounter.m_count == 0 ) {
forEachFace_instanceDetach( m_map );
const char* name() const {
return "brush";
}
+
void attach( const NameCallback& callback ){
}
+
void detach( const NameCallback& callback ){
}
aabbChanged();
m_lightsChanged();
}
+
void shaderChanged(){
updateFiltered();
planeChanged();
m_transformChanged = true;
planeChanged();
}
-typedef MemberCaller<Brush, &Brush::transformChanged> TransformChangedCaller;
+
+typedef MemberCaller<Brush, void(), &Brush::transformChanged> TransformChangedCaller;
void evaluateTransform(){
if ( m_transformChanged ) {
m_evaluateTransform();
}
}
+
const Matrix4& localToParent() const {
return g_matrix4_identity;
}
+
void aabbChanged(){
m_boundsChanged();
}
+
const AABB& localAABB() const {
evaluateBRep();
return m_aabb_local;
( *i )->transform( matrix, mirror );
}
}
+
void snapto( float snap ){
for ( Faces::iterator i = m_faces.begin(); i != m_faces.end(); ++i )
{
( *i )->snapto( snap );
}
}
+
void revertTransform(){
for ( Faces::iterator i = m_faces.begin(); i != m_faces.end(); ++i )
{
( *i )->revertTransform();
}
}
+
void freezeTransform(){
for ( Faces::iterator i = m_faces.begin(); i != m_faces.end(); ++i )
{
public:
BrushUndoMemento( const Faces& faces ) : m_faces( faces ){
}
+
void release(){
delete this;
}
m_state_point = GlobalShaderCache().capture( "$POINT" );
}
+
static void destroyStatic(){
GlobalShaderCache().release( "$POINT" );
}
const_iterator begin() const {
return m_faces.begin();
}
+
const_iterator end() const {
return m_faces.end();
}
Face* back(){
return m_faces.back();
}
+
const Face* back() const {
return m_faces.back();
}
+
void reserve( std::size_t count ){
m_faces.reserve( count );
for ( Observers::iterator i = m_observers.begin(); i != m_observers.end(); ++i )
( *i )->reserve( count );
}
}
+
void push_back( Faces::value_type face ){
m_faces.push_back( face );
if ( m_instanceCounter.m_count != 0 ) {
( *i )->DEBUG_verify();
}
}
+
void pop_back(){
if ( m_instanceCounter.m_count != 0 ) {
m_faces.back()->instanceDetach( m_map );
( *i )->DEBUG_verify();
}
}
+
void erase( std::size_t index ){
if ( m_instanceCounter.m_count != 0 ) {
m_faces[index]->instanceDetach( m_map );
( *i )->DEBUG_verify();
}
}
+
void connectivityChanged(){
for ( Observers::iterator i = m_observers.begin(); i != m_observers.end(); ++i )
{
( *i )->DEBUG_verify();
}
}
+
std::size_t size() const {
return m_faces.size();
}
+
bool empty() const {
return m_faces.empty();
}
( *i )->edge_push_back( m_select_edges.back() );
}
}
+
void edge_clear(){
m_select_edges.clear();
for ( Observers::iterator i = m_observers.begin(); i != m_observers.end(); ++i )
( *i )->edge_clear();
}
}
+
void vertex_push_back( FaceVertexId faceVertex ){
m_select_vertices.push_back( SelectableVertex( m_faces, faceVertex ) );
for ( Observers::iterator i = m_observers.begin(); i != m_observers.end(); ++i )
( *i )->vertex_push_back( m_select_vertices.back() );
}
}
+
void vertex_clear(){
m_select_vertices.clear();
for ( Observers::iterator i = m_observers.begin(); i != m_observers.end(); ++i )
};
-
class FaceInstance;
class FaceInstanceSet
void insert( FaceInstance& faceInstance ){
m_faceInstances.append( faceInstance );
}
+
void erase( FaceInstance& faceInstance ){
m_faceInstances.erase( faceInstance );
}
bool empty() const {
return m_faceInstances.empty();
}
+
FaceInstance& last() const {
return m_faceInstances.back();
}
}
return i;
}
+
inline void VertexSelection_erase( VertexSelection& self, std::size_t value ){
VertexSelection::iterator i = VertexSelection_find( self, value );
if ( i != self.end() ) {
inline bool triangle_reversed( std::size_t x, std::size_t y, std::size_t z ){
return !( ( x < y && y < z ) || ( z < x && x < y ) || ( y < z && z < x ) );
}
+
template<typename Element>
inline Vector3 triangle_cross( const BasicVector3<Element>& x, const BasicVector3<Element> y, const BasicVector3<Element>& z ){
return vector3_cross( y - x, z - x );
}
+
template<typename Element>
inline bool triangles_same_winding( const BasicVector3<Element>& x1, const BasicVector3<Element> y1, const BasicVector3<Element>& z1, const BasicVector3<Element>& x2, const BasicVector3<Element> y2, const BasicVector3<Element>& z2 ){
return vector3_dot( triangle_cross( x1, y1, z1 ), triangle_cross( x2, y2, z2 ) ) > 0;
void addLight( const RendererLight& light ){
m_lights.push_back( &light );
}
+
void clear(){
m_lights.clear();
}
+
void evaluateLights() const {
}
+
void lightsChanged() const {
}
+
void forEachLight( const RendererLightCallback& callback ) const {
for ( Lights::const_iterator i = m_lights.begin(); i != m_lights.end(); ++i )
{
m_selectableEdges( observer ),
m_selectionChanged( observer ){
}
+
FaceInstance( const FaceInstance& other ) :
m_face( other.m_face ),
m_selectable( SelectedChangedCaller( *this ) ),
m_selectableEdges( other.m_selectableEdges ),
m_selectionChanged( other.m_selectionChanged ){
}
+
FaceInstance& operator=( const FaceInstance& other ){
m_face = other.m_face;
return *this;
Face& getFace(){
return *m_face;
}
+
const Face& getFace() const {
return *m_face;
}
}
m_selectionChanged( selectable );
}
-typedef MemberCaller1<FaceInstance, const Selectable&, &FaceInstance::selectedChanged> SelectedChangedCaller;
+
+typedef MemberCaller<FaceInstance, void(const Selectable&), &FaceInstance::selectedChanged> SelectedChangedCaller;
bool selectedVertices() const {
return !m_vertexSelection.empty();
}
+
bool selectedEdges() const {
return !m_edgeSelection.empty();
}
+
bool isSelected() const {
return m_selectable.isSelected();
}
bool selectedComponents() const {
return selectedVertices() || selectedEdges() || isSelected();
}
+
bool selectedComponents( SelectionSystem::EComponentMode mode ) const {
switch ( mode )
{
return false;
}
}
+
void setSelected( SelectionSystem::EComponentMode mode, bool select ){
switch ( mode )
{
}
}
}
+
template<typename Functor>
void SelectedEdges_foreach( Functor functor ) const {
for ( VertexSelection::const_iterator i = m_edgeSelection.begin(); i != m_edgeSelection.end(); ++i )
}
}
}
+
template<typename Functor>
void SelectedFaces_foreach( Functor functor ) const {
if ( isSelected() ) {
m_face->testSelect( test, best );
}
}
+
void testSelect( Selector& selector, SelectionTest& test ){
SelectionIntersection best;
testSelect( test, best );
Selector_add( selector, m_selectable, best );
}
}
+
void testSelect_centroid( Selector& selector, SelectionTest& test ){
if ( m_face->contributes() && !m_face->isFiltered() ) {
SelectionIntersection best;
selectedPlaneCallback( getFace().plane3() );
}
+
void selectReversedPlane( Selector& selector, const SelectedPlanes& selectedPlanes ){
if ( selectedPlanes.contains( plane3_flipped( getFace().plane3() ) ) ) {
Selector_add( selector, m_selectable );
m_face->freezeTransform();
}
}
+
void update_move_planepts_vertex( std::size_t index ){
m_face->update_move_planepts_vertex( index, m_face->m_move_planepts );
}
+
void update_move_planepts_vertex2( std::size_t index, std::size_t other ){
const std::size_t numpoints = m_face->getWinding().numpoints;
ASSERT_MESSAGE( index < numpoints, "select_vertex: invalid index" );
m_face->m_move_planepts[2] = m_face->getWinding()[other].vertex;
planepts_quantise( m_face->m_move_planepts, GRID_MIN ); // winding points are very inaccurate
}
+
void update_selection_vertex(){
if ( m_vertexSelection.size() == 0 ) {
m_selectableVertices.setSelected( false );
}
}
}
+
void select_vertex( std::size_t index, bool select ){
if ( select ) {
VertexSelection_insert( m_vertexSelection, getFace().getWinding()[index].adjacent );
m_face->m_move_planepts[2] = m_face->getWinding()[opposite].vertex;
planepts_quantise( m_face->m_move_planepts, GRID_MIN ); // winding points are very inaccurate
}
+
void update_selection_edge(){
if ( m_edgeSelection.size() == 0 ) {
m_selectableEdges.setSelected( false );
}
}
}
+
void select_edge( std::size_t index, bool select ){
if ( select ) {
VertexSelection_insert( m_edgeSelection, getFace().getWinding()[index].adjacent );
static void constructStatic(){
m_state = GlobalShaderCache().capture( "$CLIPPER_OVERLAY" );
}
+
static void destroyStatic(){
GlobalShaderCache().release( "$CLIPPER_OVERLAY" );
}
}
-
typedef std::vector<FaceInstance> FaceInstances;
class EdgeInstance : public Selectable
faceVertex = next_edge( m_edge->m_faces, faceVertex );
m_faceInstances[faceVertex.getFace()].select_edge( faceVertex.getVertex(), select );
}
+
bool selected_edge() const {
FaceVertexId faceVertex = m_edge->m_faceVertex;
if ( !m_faceInstances[faceVertex.getFace()].selected_edge( faceVertex.getVertex() ) ) {
void setSelected( bool select ){
select_edge( select );
}
+
bool isSelected() const {
return selected_edge();
}
}
while ( faceVertex.getFace() != m_vertex->m_faceVertex.getFace() );
}
+
bool selected_vertex() const {
FaceVertexId faceVertex = m_vertex->m_faceVertex;
do
void setSelected( bool select ){
select_vertex( select );
}
+
bool isSelected() const {
return selected_vertex();
}
InstanceIdentityCast<BrushInstance>::install( m_casts );
InstanceContainedCast<BrushInstance, Transformable>::install( m_casts );
}
+
InstanceTypeCastTable& get(){
return m_casts;
}
void lightsChanged(){
m_lightList->lightsChanged();
}
-typedef MemberCaller<BrushInstance, &BrushInstance::lightsChanged> LightsChangedCaller;
+
+typedef MemberCaller<BrushInstance, void(), &BrushInstance::lightsChanged> LightsChangedCaller;
STRING_CONSTANT( Name, "BrushInstance" );
Instance::setTransformChangedCallback( LightsChangedCaller( *this ) );
}
+
~BrushInstance(){
- Instance::setTransformChangedCallback( Callback() );
+ Instance::setTransformChangedCallback( Callback<void()>() );
- m_brush.m_lightsChanged = Callback();
+ m_brush.m_lightsChanged = Callback<void()>();
GlobalShaderCache().detach( *this );
m_counter->decrement();
Bounded& get( NullType<Bounded>){
return m_brush;
}
+
Cullable& get( NullType<Cullable>){
return m_brush;
}
+
Transformable& get( NullType<Transformable>){
return m_transform;
}
Instance::selectedChanged();
}
-typedef MemberCaller1<BrushInstance, const Selectable&, &BrushInstance::selectedChanged> SelectedChangedCaller;
+typedef MemberCaller<BrushInstance, void(const Selectable&), &BrushInstance::selectedChanged> SelectedChangedCaller;
void selectedChangedComponent( const Selectable& selectable ){
GlobalSelectionSystem().getObserver ( SelectionSystem::eComponent )( selectable );
GlobalSelectionSystem().onComponentSelection( *this, selectable );
}
-typedef MemberCaller1<BrushInstance, const Selectable&, &BrushInstance::selectedChangedComponent> SelectedChangedComponentCaller;
+typedef MemberCaller<BrushInstance, void(const Selectable&), &BrushInstance::selectedChangedComponent> SelectedChangedComponentCaller;
const BrushInstanceVisitor& forEachFaceInstance( const BrushInstanceVisitor& visitor ){
for ( FaceInstances::iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i )
static void constructStatic(){
m_state_selpoint = GlobalShaderCache().capture( "$SELPOINT" );
}
+
static void destroyStatic(){
GlobalShaderCache().release( "$SELPOINT" );
}
void clear(){
m_faceInstances.clear();
}
+
void reserve( std::size_t size ){
m_faceInstances.reserve( size );
}
void push_back( Face& face ){
m_faceInstances.push_back( FaceInstance( face, SelectedChangedComponentCaller( *this ) ) );
}
+
void pop_back(){
ASSERT_MESSAGE( !m_faceInstances.empty(), "erasing invalid element" );
m_faceInstances.pop_back();
}
+
void erase( std::size_t index ){
ASSERT_MESSAGE( index < m_faceInstances.size(), "erasing invalid element" );
m_faceInstances.erase( m_faceInstances.begin() + index );
}
+
void connectivityChanged(){
for ( FaceInstances::iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i )
{
void edge_clear(){
m_edgeInstances.clear();
}
+
void edge_push_back( SelectableEdge& edge ){
m_edgeInstances.push_back( EdgeInstance( m_faceInstances, edge ) );
}
void vertex_clear(){
m_vertexInstances.clear();
}
+
void vertex_push_back( SelectableVertex& vertex ){
m_vertexInstances.push_back( VertexInstance( m_faceInstances, vertex ) );
}
bool isSelected() const {
return m_selectable.isSelected();
}
+
void setSelected( bool select ){
m_selectable.setSelected( select );
}
}
return false;
}
+
void setSelectedComponents( bool select, SelectionSystem::EComponentMode mode ){
for ( FaceInstances::iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i )
{
( *i ).setSelected( mode, select );
}
}
+
void testSelectComponents( Selector& selector, SelectionTest& test, SelectionSystem::EComponentMode mode ){
test.BeginMesh( localToWorld() );
( *i ).selectPlane( selector, Line( test.getNear(), test.getFar() ), brushPlanes, j, selectedPlaneCallback );
}
}
+
void selectReversedPlanes( Selector& selector, const SelectedPlanes& selectedPlanes ){
for ( FaceInstances::iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i )
{
( *i ).transformComponents( matrix );
}
}
+
const AABB& getSelectedComponentsBounds() const {
m_aabb_component = AABB();
( *i ).snapComponents( snap );
}
}
+
void evaluateTransform(){
Matrix4 matrix( m_transform.calculateTransform() );
//globalOutputStream() << "matrix: " << matrix << "\n";
transformComponents( matrix );
}
}
+
void applyTransform(){
m_brush.revertTransform();
evaluateTransform();
m_brush.freezeTransform();
}
-typedef MemberCaller<BrushInstance, &BrushInstance::applyTransform> ApplyTransformCaller;
+
+typedef MemberCaller<BrushInstance, void(), &BrushInstance::applyTransform> ApplyTransformCaller;
void setClipPlane( const Plane3& plane ){
m_clipPlane.setPlane( m_brush, plane );
bool testLight( const RendererLight& light ) const {
return light.testAABB( worldAABB() );
}
+
void insertLight( const RendererLight& light ){
const Matrix4& localToWorld = Instance::localToWorld();
for ( FaceInstances::const_iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i )
Face_addLight( *i, localToWorld, light );
}
}
+
void clearLights(){
for ( FaceInstances::const_iterator i = m_faceInstances.begin(); i != m_faceInstances.end(); ++i )
{
public:
BrushSelectedVisitor( const Functor& functor ) : m_functor( functor ){
}
+
void visit( scene::Instance& instance ) const {
BrushInstance* brush = Instance_getBrush( instance );
if ( brush != 0 ) {
public:
BrushVisibleSelectedVisitor( const Functor& functor ) : m_functor( functor ){
}
+
void visit( scene::Instance& instance ) const {
BrushInstance* brush = Instance_getBrush( instance );
if ( brush != 0
public:
BrushForEachFace( const BrushInstanceVisitor& visitor ) : m_visitor( visitor ){
}
+
void operator()( BrushInstance& brush ) const {
brush.forEachFaceInstance( m_visitor );
}
FaceInstanceVisitFace( const Functor& functor )
: functor( functor ){
}
+
void visit( FaceInstance& face ) const {
functor( face.getFace() );
}
FaceVisitAll( const Functor& functor )
: functor( functor ){
}
+
void visit( Face& face ) const {
functor( face );
}
FaceInstanceVisitAll( const Functor& functor )
: functor( functor ){
}
+
void visit( FaceInstance& face ) const {
functor( face );
}
public:
InstanceIfVisible( const Functor& functor ) : Functor( functor ){
}
+
void operator()( scene::Instance& instance ){
if ( instance.path().top().get().visible() ) {
Functor::operator()( instance );
public:
BrushVisibleWalker( const Functor& functor ) : m_functor( functor ){
}
+
bool pre( const scene::Path& path, scene::Instance& instance ) const {
if ( path.top().get().visible() ) {
BrushInstance* brush = Instance_getBrush( instance );