Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
#5584: Remove old patch control point renderable code
  • Loading branch information
codereader committed Jan 7, 2022
1 parent 4bd70cb commit 7d41466
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 40 deletions.
31 changes: 0 additions & 31 deletions radiantcore/patch/PatchNode.cpp
Expand Up @@ -11,10 +11,8 @@
PatchNode::PatchNode(patch::PatchDefType type) :
scene::SelectableNode(),
m_dragPlanes(std::bind(&PatchNode::selectedChangedComponent, this, std::placeholders::_1)),
m_render_selected(GL_POINTS),
m_patch(*this),
_untransformedOriginChanged(true),
_selectedControlVerticesNeedUpdate(true),
_renderableSurfaceSolid(m_patch.getTesselation(), true),
_renderableSurfaceWireframe(m_patch.getTesselation(), false),
_renderableCtrlLattice(m_patch, m_ctrl_instances),
Expand All @@ -36,10 +34,8 @@ PatchNode::PatchNode(const PatchNode& other) :
PlaneSelectable(other),
Transformable(other),
m_dragPlanes(std::bind(&PatchNode::selectedChangedComponent, this, std::placeholders::_1)),
m_render_selected(GL_POINTS),
m_patch(other.m_patch, *this), // create the patch out of the <other> one
_untransformedOriginChanged(true),
_selectedControlVerticesNeedUpdate(true),
_renderableSurfaceSolid(m_patch.getTesselation(), true),
_renderableSurfaceWireframe(m_patch.getTesselation(), false),
_renderableCtrlLattice(m_patch, m_ctrl_instances),
Expand Down Expand Up @@ -268,7 +264,6 @@ bool PatchNode::hasVisibleMaterial() const
void PatchNode::selectedChangedComponent(const ISelectable& selectable)
{
// We need to update our vertex colours next time we render them
_selectedControlVerticesNeedUpdate = true;
_renderableCtrlPoints.queueUpdate();

// Notify the selection system that this PatchNode was selected. The RadiantSelectionSystem adds
Expand Down Expand Up @@ -349,8 +344,6 @@ void PatchNode::onPreRender(const VolumeTest& volume)

if (isSelected() && GlobalSelectionSystem().ComponentMode() == selection::ComponentSelectionMode::Vertex)
{
updateSelectedControlVertices();

// Selected patches in component mode render the lattice connecting the control points
_renderableCtrlLattice.update(_ctrlLatticeShader);
_renderableCtrlPoints.update(_ctrlPointShader);
Expand Down Expand Up @@ -458,29 +451,6 @@ void PatchNode::renderComponents(IRenderableCollector& collector, const VolumeTe
#endif
}

void PatchNode::updateSelectedControlVertices() const
{
if (!_selectedControlVerticesNeedUpdate) return;

_selectedControlVerticesNeedUpdate = false;

// Clear the renderable point vector that represents the selection
m_render_selected.clear();

// Cycle through the transformed patch vertices and set the colour of all selected control vertices to BLUE (hardcoded)
auto ctrl = m_patch.getControlPointsTransformed().begin();

for (auto i = m_ctrl_instances.begin(); i != m_ctrl_instances.end(); ++i, ++ctrl)
{
if (i->isSelected())
{
const Colour4b colour_selected(0, 0, 0, 255);
// Add this patch control instance to the render list
m_render_selected.push_back(VertexCb(reinterpret_cast<const Vertex3f&>(ctrl->vertex), colour_selected));
}
}
}

#if 0
void PatchNode::renderComponentsSelected(IRenderableCollector& collector, const VolumeTest& volume) const
{
Expand Down Expand Up @@ -543,7 +513,6 @@ void PatchNode::transformComponents(const Matrix4& matrix) {

// mark this patch transform as dirty
m_patch.transformChanged();
_selectedControlVerticesNeedUpdate = true;
}

// Also, check if there are any drag planes selected
Expand Down
9 changes: 0 additions & 9 deletions radiantcore/patch/PatchNode.h
Expand Up @@ -32,9 +32,6 @@ class PatchNode final :
typedef std::vector<PatchControlInstance> PatchControlInstances;
PatchControlInstances m_ctrl_instances;

// An array of renderable points
mutable RenderablePointVector m_render_selected;

Patch m_patch;

// An internal AABB variable to calculate the bounding box of the selected components (has to be mutable)
Expand All @@ -48,8 +45,6 @@ class PatchNode final :
// If true, the _untransformedOrigin member needs an update
bool _untransformedOriginChanged;

mutable bool _selectedControlVerticesNeedUpdate;

RenderablePatchTesselation<TesselationIndexer_Triangles> _renderableSurfaceSolid;
RenderablePatchTesselation<TesselationIndexer_Quads> _renderableSurfaceWireframe;
RenderablePatchLattice _renderableCtrlLattice; // Wireframe connecting the control points
Expand Down Expand Up @@ -164,10 +159,6 @@ class PatchNode final :
// Transforms the patch components with the given transformation matrix
void transformComponents(const Matrix4& matrix);

// greebo: Updates the internal render array m_render_selected, that contains all control vertices that should be
// rendered as highlighted.
void updateSelectedControlVertices() const;

#if 0
// greebo: Renders the selected components. This is called by the above two render functions
void renderComponentsSelected(IRenderableCollector& collector, const VolumeTest& volume) const;
Expand Down

0 comments on commit 7d41466

Please sign in to comment.