Skip to content

Commit

Permalink
#5584: Remove a bunch of deactivated code
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 21, 2022
1 parent b2a1d33 commit f14c321
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 288 deletions.
60 changes: 0 additions & 60 deletions radiantcore/brush/Brush.cpp
Expand Up @@ -257,27 +257,6 @@ const AABB& Brush::localAABB() const {
return m_aabb_local;
}

#if 0
void Brush::renderComponents(selection::ComponentSelectionMode mode, IRenderableCollector& collector,
const VolumeTest& volume, const Matrix4& localToWorld) const
{
switch (mode)
{
case selection::ComponentSelectionMode::Vertex:
collector.addRenderable(*m_state_point, _uniqueVertexPoints, localToWorld);
break;
case selection::ComponentSelectionMode::Edge:
collector.addRenderable(*m_state_point, _uniqueEdgePoints, localToWorld);
break;
case selection::ComponentSelectionMode::Face:
collector.addRenderable(*m_state_point, _faceCentroidPoints, localToWorld);
break;
default:
break;
}
}
#endif

void Brush::translate(const Vector3& translation)
{
std::for_each(m_faces.begin(), m_faces.end(),
Expand Down Expand Up @@ -568,45 +547,6 @@ void Brush::windingForClipPlane(Winding& winding, const Plane3& plane) const {
buffer[swap].writeToWinding(winding);
}

#if 0
void Brush::update_wireframe(RenderableWireframe& wire, const bool* faces_visible) const
{
wire.m_faceVertex.resize(_edgeIndices.size());
wire.m_vertices = _uniqueVertexPoints.size() > 0 ? &_uniqueVertexPoints.front() : NULL;
wire.m_size = 0;

for (std::size_t i = 0; i < _edgeFaces.size(); ++i)
{
if (faces_visible[_edgeFaces[i].first] || faces_visible[_edgeFaces[i].second])
{
wire.m_faceVertex[wire.m_size++] = _edgeIndices[i];
}
}
}
#endif

void Brush::update_faces_wireframe(RenderablePointVector& wire,
const std::size_t* visibleFaceIndices,
std::size_t numVisibleFaces) const
{
if (numVisibleFaces > _faceCentroidPoints.size())
{
wire.clear();
return;
}

// Assure that the pointvector can carry as many faces as are visible
wire.resize(numVisibleFaces);

const std::size_t* visibleFaceIter = visibleFaceIndices;

// Pick all the visible face centroids from the vector
for (std::size_t i = 0; i < numVisibleFaces; ++i)
{
wire[i] = _faceCentroidPoints[*visibleFaceIter++];
}
}

/// \brief Makes this brush a deep-copy of the \p other.
void Brush::copy(const Brush& other)
{
Expand Down
12 changes: 0 additions & 12 deletions radiantcore/brush/Brush.h
Expand Up @@ -208,10 +208,6 @@ class Brush :

const AABB& localAABB() const override;

#if 0
void renderComponents(selection::ComponentSelectionMode mode, IRenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld) const;
#endif

void transform(const Matrix4& matrix);

void snapto(float snap) override;
Expand Down Expand Up @@ -269,14 +265,6 @@ class Brush :
/// \brief Constructs \p winding from the intersection of \p plane with the other planes of the brush.
void windingForClipPlane(Winding& winding, const Plane3& plane) const;

#if 0
void update_wireframe(RenderableWireframe& wire, const bool* faces_visible) const;
#endif

void update_faces_wireframe(RenderablePointVector& wire,
const std::size_t* visibleFaceIndices,
std::size_t numVisibleFaces) const;

/// \brief Makes this brush a deep-copy of the \p other.
void copy(const Brush& other);

Expand Down
185 changes: 0 additions & 185 deletions radiantcore/brush/BrushNode.cpp
Expand Up @@ -376,37 +376,12 @@ void BrushNode::onPreRender(const VolumeTest& volume)
}
}

void BrushNode::renderComponents(IRenderableCollector& collector, const VolumeTest& volume) const
{
#if 0
const Matrix4& l2w = localToWorld();

if (volume.fill() && GlobalSelectionSystem().ComponentMode() == selection::ComponentSelectionMode::Face)
{
updateFaceCentroidPoints();
collector.addRenderable(*_pointShader, _visibleFaceCentroidPoints, l2w);
}
#if 0
else
{
m_brush.renderComponents(GlobalSelectionSystem().ComponentMode(), collector, volume, l2w);
}
#endif
#endif
}

void BrushNode::renderSolid(IRenderableCollector& collector, const VolumeTest& volume) const
{
#if 0
renderSolid(collector, volume, localToWorld());
#endif
}

void BrushNode::renderWireframe(IRenderableCollector& collector, const VolumeTest& volume) const
{
#if 0
renderWireframe(collector, volume, localToWorld());
#endif
}

void BrushNode::renderHighlights(IRenderableCollector& collector, const VolumeTest& volume)
Expand Down Expand Up @@ -445,9 +420,6 @@ void BrushNode::renderHighlights(IRenderableCollector& collector, const VolumeTe
}

collector.setHighlightFlag(IRenderableCollector::Highlight::Primitives, false);

// Render any selected points (vertices, edges, faces)
renderSelectedPoints(collector, volume, Matrix4::getIdentity());
}

void BrushNode::setRenderSystem(const RenderSystemPtr& renderSystem)
Expand All @@ -457,15 +429,11 @@ void BrushNode::setRenderSystem(const RenderSystemPtr& renderSystem)
if (renderSystem)
{
_pointShader = renderSystem->capture("$POINT");
m_state_selpoint = renderSystem->capture("$SELPOINT");

_renderableVertices.queueUpdate();
}
else
{
_pointShader.reset();
m_state_selpoint.reset();

_renderableVertices.clear();
}

Expand All @@ -480,144 +448,6 @@ std::size_t BrushNode::getHighlightFlags()
return isGroupMember() ? (Highlight::Selected | Highlight::GroupMember) : Highlight::Selected;
}

#if 0
void BrushNode::updateFaceCentroidPoints() const
{
if (!_faceCentroidPointsNeedUpdate) return;

static const auto& colourSetting = GlobalBrushCreator().getSettings().getVertexColour();
const Colour4b vertexColour(
static_cast<int>(colourSetting[0] * 255),
static_cast<int>(colourSetting[1] * 255),
static_cast<int>(colourSetting[2] * 255),
255);

_faceCentroidPointsNeedUpdate = false;

_visibleFaceCentroidPoints.clear();

for (const auto& faceInstance: m_faceInstances)
{
if (faceInstance.faceIsVisible())
{
_visibleFaceCentroidPoints.emplace_back(faceInstance.centroid(), vertexColour);
}
}
}
#endif
#if 0
void BrushNode::updateWireframeVisibility() const
{
if (!_faceCentroidPointsNeedUpdate) return;

_faceCentroidPointsNeedUpdate = false;

// Array of booleans to indicate which faces are visible
static bool faces_visible[brush::c_brush_maxFaces];

// Will hold the indices of all visible faces (from the current viewpoint)
static std::size_t visibleFaceIndices[brush::c_brush_maxFaces];

std::size_t numVisibleFaces(0);
bool* j = faces_visible;
bool forceVisible = isForcedVisible();

_visibleFaceCentroidPoints.clear();

// Iterator to an index of a visible face
std::size_t* visibleFaceIter = visibleFaceIndices;
std::size_t curFaceIndex = 0;

for (FaceInstances::const_iterator i = m_faceInstances.begin();
i != m_faceInstances.end();
++i, ++j, ++curFaceIndex)
{
// Check if face is filtered before adding to visibility matrix
// greebo: Removed localToWorld transformation here, brushes don't have a non-identity l2w
// Don't cull backfacing planes to make those faces visible in orthoview (#5465)
if (forceVisible || i->faceIsVisible())
{
_visibleFaceCentroidPoints.push_back(i->centroid());
#if 0
*j = true;

// Store the index of this visible face in the array
*visibleFaceIter++ = curFaceIndex;
numVisibleFaces++;
}
else
{
*j = false;
#endif
}
}
#if 0
m_brush.update_wireframe(m_render_wireframe, faces_visible);
#endif
#if 0
m_brush.update_faces_wireframe(_visibleFaceCentroidPoints, visibleFaceIndices, numVisibleFaces);
#endif
}
#endif

#if 0
void BrushNode::renderSolid(IRenderableCollector& collector,
const VolumeTest& volume,
const Matrix4& localToWorld) const
{
assert(_renderEntity); // brushes rendered without parent entity - no way!

#if 0 // The faces already sent their geomtry in onPreRender()
// Check for the override status of this brush
bool forceVisible = isForcedVisible();

// Submit the renderable geometry for each face
for (const FaceInstance& faceInst : m_faceInstances)
{
// Skip invisible faces before traversing further
if (!forceVisible && !faceInst.faceIsVisible()) continue;

const Face& face = faceInst.getFace();
if (face.intersectVolume(volume))
{
bool highlight = faceInst.selectedComponents();
if (highlight)
collector.setHighlightFlag(IRenderableCollector::Highlight::Faces, true);

#if 1
// greebo: BrushNodes have always an identity l2w, don't do any transforms
collector.addRenderable(
*face.getFaceShader().getGLShader(), face.getWinding(),
Matrix4::getIdentity(), this, _renderEntity
);
#endif
if (highlight)
collector.setHighlightFlag(IRenderableCollector::Highlight::Faces, false);
}
}
#endif
#if 0
renderSelectedPoints(collector, volume, localToWorld);
#endif
}

void BrushNode::renderWireframe(IRenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld) const
{
//renderCommon(collector, volume);

//updateWireframeVisibility();
#if 0
if (m_render_wireframe.m_size != 0)
{
collector.addRenderable(*_renderEntity->getWireShader(), m_render_wireframe, localToWorld);
}
#endif
#if 0
renderSelectedPoints(collector, volume, localToWorld);
#endif
}
#endif

void BrushNode::updateSelectedPointsArray()
{
if (!_renderableComponentsNeedUpdate) return;
Expand All @@ -640,21 +470,6 @@ void BrushNode::updateSelectedPointsArray()
_renderableVertices.queueUpdate();
}

void BrushNode::renderSelectedPoints(IRenderableCollector& collector,
const VolumeTest& volume,
const Matrix4& localToWorld) const
{
#if 0
updateSelectedPointsArray();

if (!_selectedPoints.empty())
{
collector.setHighlightFlag(IRenderableCollector::Highlight::Primitives, false);
collector.addRenderable(*m_state_selpoint, _selectedPoints, localToWorld);
}
#endif
}

void BrushNode::evaluateTransform()
{
if (getTransformationType() == NoTransform)
Expand Down
16 changes: 2 additions & 14 deletions radiantcore/brush/BrushNode.h
Expand Up @@ -48,11 +48,10 @@ class BrushNode :
mutable AABB m_aabb_component;
BrushClipPlane m_clipPlane;

ShaderPtr m_state_selpoint;
ShaderPtr _pointShader;

// TRUE if any of the FaceInstance's component selection got changed or transformed
mutable bool _renderableComponentsNeedUpdate;
bool _renderableComponentsNeedUpdate;

// For pivoted rotations, we need a copy of this lying around
Vector3 _untransformedOrigin;
Expand Down Expand Up @@ -136,7 +135,6 @@ class BrushNode :

// Renderable implementation
void onPreRender(const VolumeTest& volume) override;
void renderComponents(IRenderableCollector& collector, const VolumeTest& volume) const override;
void renderSolid(IRenderableCollector& collector, const VolumeTest& volume) const override;
void renderWireframe(IRenderableCollector& collector, const VolumeTest& volume) const override;
void renderHighlights(IRenderableCollector& collector, const VolumeTest& volume) override;
Expand Down Expand Up @@ -183,17 +181,7 @@ class BrushNode :
private:
void transformComponents(const Matrix4& matrix);

#if 0
void renderSolid(IRenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld) const;
void renderWireframe(IRenderableCollector& collector, const VolumeTest& volume, const Matrix4& localToWorld) const;
#endif

void updateSelectedPointsArray();
void renderSelectedPoints(IRenderableCollector& collector,
const VolumeTest& volume,
const Matrix4& localToWorld) const;

void updateFaceCentroidPoints() const;

}; // class BrushNode
};
typedef std::shared_ptr<BrushNode> BrushNodePtr;
4 changes: 0 additions & 4 deletions radiantcore/brush/FaceInstance.cpp
Expand Up @@ -155,10 +155,6 @@ void FaceInstance::iterate_selected(AABB& aabb) const {
SelectedComponents_foreach(AABBExtendByPoint(aabb));
}

void FaceInstance::iterate_selected(RenderablePointVector& points) const {
SelectedComponents_foreach(RenderablePointVectorPushBack(points));
}

bool FaceInstance::intersectVolume(const VolumeTest& volume) const
{
return m_face->intersectVolume(volume);
Expand Down

0 comments on commit f14c321

Please sign in to comment.