Skip to content

Commit

Permalink
Hotwire the evaluateTransform call and remove the legacy Callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Sep 14, 2017
1 parent ce88f01 commit fd37893
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
14 changes: 7 additions & 7 deletions radiant/brush/Brush.cpp
Expand Up @@ -45,29 +45,27 @@ const std::size_t Brush::CONE_MAX_SIDES = 32;
const std::size_t Brush::SPHERE_MIN_SIDES = 3;
const std::size_t Brush::SPHERE_MAX_SIDES = 7;

Brush::Brush(BrushNode& owner, const Callback& evaluateTransform) :
Brush::Brush(BrushNode& owner) :
_owner(owner),
_undoStateSaver(nullptr),
_mapFileChangeTracker(nullptr),
_faceCentroidPoints(GL_POINTS),
_uniqueVertexPoints(GL_POINTS),
_uniqueEdgePoints(GL_POINTS),
m_evaluateTransform(evaluateTransform),
m_planeChanged(false),
m_transformChanged(false),
_detailFlag(Structural)
{
onFacePlaneChanged();
}

Brush::Brush(BrushNode& owner, const Brush& other, const Callback& evaluateTransform) :
Brush::Brush(BrushNode& owner, const Brush& other) :
_owner(owner),
_undoStateSaver(nullptr),
_mapFileChangeTracker(nullptr),
_faceCentroidPoints(GL_POINTS),
_uniqueVertexPoints(GL_POINTS),
_uniqueEdgePoints(GL_POINTS),
m_evaluateTransform(evaluateTransform),
m_planeChanged(false),
m_transformChanged(false),
_detailFlag(Structural)
Expand Down Expand Up @@ -230,11 +228,13 @@ void Brush::transformChanged() {
onFacePlaneChanged();
}

void Brush::evaluateTransform() {
if(m_transformChanged) {
void Brush::evaluateTransform()
{
if (m_transformChanged)
{
m_transformChanged = false;
revertTransform();
m_evaluateTransform();
_owner.evaluateTransform();
}
}

Expand Down
7 changes: 2 additions & 5 deletions radiant/brush/Brush.h
Expand Up @@ -2,7 +2,6 @@

#include "editable.h"

#include "generic/callback.h"
#include "Face.h"
#include "SelectableComponents.h"
#include "RenderableWireFrame.h"
Expand Down Expand Up @@ -123,8 +122,6 @@ class Brush :
AABB m_aabb_local;
// ----

Callback m_evaluateTransform;

mutable bool m_planeChanged; // b-rep evaluation required
mutable bool m_transformChanged; // transform evaluation required
// ----
Expand Down Expand Up @@ -165,8 +162,8 @@ class Brush :
static double m_maxWorldCoord;

// Constructors
Brush(BrushNode& owner, const Callback& evaluateTransform);
Brush(BrushNode& owner, const Brush& other, const Callback& evaluateTransform);
Brush(BrushNode& owner);
Brush(BrushNode& owner, const Brush& other);

// Destructor
virtual ~Brush();
Expand Down
6 changes: 2 additions & 4 deletions radiant/brush/BrushNode.cpp
Expand Up @@ -13,8 +13,7 @@
BrushNode::BrushNode() :
scene::SelectableNode(),
m_lightList(&GlobalRenderSystem().attachLitObject(*this)),
m_brush(*this,
Callback(std::bind(&BrushNode::evaluateTransform, this))),
m_brush(*this),
_selectedPoints(GL_POINTS),
_faceCentroidPointsCulled(GL_POINTS),
m_viewChanged(false),
Expand All @@ -41,8 +40,7 @@ BrushNode::BrushNode(const BrushNode& other) :
LitObject(other),
Transformable(other),
m_lightList(&GlobalRenderSystem().attachLitObject(*this)),
m_brush(*this, other.m_brush,
Callback(std::bind(&BrushNode::evaluateTransform, this))),
m_brush(*this, other.m_brush),
_selectedPoints(GL_POINTS),
_faceCentroidPointsCulled(GL_POINTS),
m_viewChanged(false),
Expand Down

0 comments on commit fd37893

Please sign in to comment.