Skip to content

Commit

Permalink
#5584: Remove render-related code from VertexInstance class.
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 22, 2022
1 parent fa3a453 commit 9537c3f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 60 deletions.
51 changes: 6 additions & 45 deletions radiantcore/entity/VertexInstance.h
@@ -1,6 +1,5 @@
#pragma once

#include "irender.h"
#include "iregistry.h"
#include "iselection.h"
#include "iselectiontest.h"
Expand All @@ -9,7 +8,6 @@
#include "EntitySettings.h"

class VertexInstance :
public OpenGLRenderable,
public ISelectable
{
protected:
Expand All @@ -20,9 +18,6 @@ class VertexInstance :

Vector3 _colour;

// Shader to use for the point
ShaderPtr _shader;

public:
// Construct the instance with the given <vertex> coordinates and connect the selectionChangeCallback
VertexInstance(Vector3& vertex, const SelectionChangedSlot& observer) :
Expand All @@ -31,18 +26,6 @@ class VertexInstance :
_colour(entity::EntitySettings::InstancePtr()->getLightVertexColour(LightEditVertexType::Deselected))
{}

void setRenderSystem(const RenderSystemPtr& renderSystem)
{
if (renderSystem)
{
_shader = renderSystem->capture("$BIGPOINT");
}
else
{
_shader.reset();
}
}

void setVertex(const Vector3& vertex) {
_vertex = vertex;
}
Expand All @@ -51,11 +34,6 @@ class VertexInstance :
return _vertex;
}

// Return the Shader for rendering
const ShaderPtr& getShader() const {
return _shader;
}

void setSelected(bool select) {
_selectable.setSelected(select);
// Change the colour according to the selection
Expand All @@ -81,26 +59,7 @@ class VertexInstance :
Selector_add(selector, *this, best);
}
}

// Front-end render function
void render(IRenderableCollector& collector,
const VolumeTest& volume,
const Matrix4& localToWorld) const
{
collector.setHighlightFlag(IRenderableCollector::Highlight::Primitives, false);
collector.setHighlightFlag(IRenderableCollector::Highlight::Faces, false);
collector.addRenderable(*_shader, *this, localToWorld);
}

// GL render function (backend)
virtual void render(const RenderInfo& info) const {
// Draw the center point
glBegin(GL_POINTS);
glColor3dv(_colour);
glVertex3dv(_vertex);
glEnd();
}
}; // class VertexInstance
};

/* This is the vertexinstance class for the light_right and light_up vertex, as they
* are calculated relatively to the light_target, which in turn is relative to the light origin
Expand All @@ -114,11 +73,13 @@ class VertexInstanceRelative : public VertexInstance {
_origin(origin)
{}

const Vector3 getVertex() const {
const Vector3 getVertex() const override
{
return _origin + _vertex;
}

void testSelect(Selector& selector, SelectionTest& test) {
void testSelect(Selector& selector, SelectionTest& test) override
{
SelectionIntersection best;
Vector3 testVertex = _origin + _vertex;
test.TestPoint(testVertex, best);
Expand All @@ -128,4 +89,4 @@ class VertexInstanceRelative : public VertexInstance {
Selector_add(selector, *this, best);
}
}
}; // class VertexInstanceRelative
};
13 changes: 0 additions & 13 deletions radiantcore/entity/doom3group/StaticGeometryNode.cpp
Expand Up @@ -400,19 +400,6 @@ void StaticGeometryNode::setRenderSystem(const RenderSystemPtr& renderSystem)
_pivotShader.reset();
_pointShader.reset();
}

_originInstance.setRenderSystem(renderSystem);
}

void StaticGeometryNode::renderComponents(IRenderableCollector& collector, const VolumeTest& volume) const
{
#if 0
if (!isModel() && GlobalSelectionSystem().ComponentMode() == selection::ComponentSelectionMode::Vertex)
{
// Register the renderable with OpenGL
_originInstance.render(collector, volume, localToWorld());
}
#endif
}

void StaticGeometryNode::evaluateTransform()
Expand Down
2 changes: 0 additions & 2 deletions radiantcore/entity/doom3group/StaticGeometryNode.h
Expand Up @@ -137,8 +137,6 @@ class StaticGeometryNode :
void renderHighlights(IRenderableCollector& collector, const VolumeTest& volume) override;
void setRenderSystem(const RenderSystemPtr& renderSystem) override;

void renderComponents(IRenderableCollector& collector, const VolumeTest& volume) const override;

void transformComponents(const Matrix4& matrix);

// Returns the original "origin" value
Expand Down

0 comments on commit 9537c3f

Please sign in to comment.