Skip to content

Commit

Permalink
#5584: Curves are writing the entity colour in their vertex attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Dec 17, 2021
1 parent 6a71e99 commit 4bf23fc
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 14 deletions.
3 changes: 2 additions & 1 deletion radiantcore/entity/curve/Curve.cpp
Expand Up @@ -20,7 +20,8 @@ namespace entity {

} // namespace

Curve::Curve(const Callback& boundsChanged) :
Curve::Curve(const IEntityNode& entity, const Callback& boundsChanged) :
_renderCurve(entity),
_boundsChanged(boundsChanged)
{}

Expand Down
2 changes: 1 addition & 1 deletion radiantcore/entity/curve/Curve.h
Expand Up @@ -36,7 +36,7 @@ class Curve :
sigc::signal<void> _sigCurveChanged;

public:
Curve(const Callback& boundsChanged);
Curve(const IEntityNode& entity, const Callback& boundsChanged);

virtual ~Curve() {}

Expand Down
4 changes: 2 additions & 2 deletions radiantcore/entity/curve/CurveCatmullRom.cpp
Expand Up @@ -2,8 +2,8 @@

namespace entity {

CurveCatmullRom::CurveCatmullRom(const Callback& callback) :
Curve(callback)
CurveCatmullRom::CurveCatmullRom(const IEntityNode& entity, const Callback& callback) :
Curve(entity, callback)
{}

void CurveCatmullRom::clearCurve() {
Expand Down
2 changes: 1 addition & 1 deletion radiantcore/entity/curve/CurveCatmullRom.h
Expand Up @@ -13,7 +13,7 @@ class CurveCatmullRom :
public Curve
{
public:
CurveCatmullRom(const Callback& callback);
CurveCatmullRom(const IEntityNode& entity, const Callback& callback);

// Subdivides the segments between the control points
virtual void tesselate();
Expand Down
4 changes: 2 additions & 2 deletions radiantcore/entity/curve/CurveNURBS.cpp
Expand Up @@ -6,8 +6,8 @@ namespace entity {
const int NURBS_degree = 3;
}

CurveNURBS::CurveNURBS(const Callback& callback) :
Curve(callback)
CurveNURBS::CurveNURBS(const IEntityNode& entity, const Callback& callback) :
Curve(entity, callback)
{}

void CurveNURBS::tesselate() {
Expand Down
2 changes: 1 addition & 1 deletion radiantcore/entity/curve/CurveNURBS.h
Expand Up @@ -15,7 +15,7 @@ class CurveNURBS :
NURBSWeights _weights;
Knots _knots;
public:
CurveNURBS(const Callback& callback);
CurveNURBS(const IEntityNode& entity, const Callback& callback);

// Subdivides the segments between the control points
virtual void tesselate();
Expand Down
8 changes: 6 additions & 2 deletions radiantcore/entity/curve/RenderableCurve.h
Expand Up @@ -12,12 +12,14 @@ class RenderableCurve :
public render::RenderableGeometry
{
private:
const IEntityNode& _entity;
bool _needsUpdate;

public:
std::vector<VertexCb> m_vertices;

RenderableCurve() :
RenderableCurve(const IEntityNode& entity) :
_entity(entity),
_needsUpdate(true)
{}

Expand Down Expand Up @@ -47,9 +49,11 @@ class RenderableCurve :

unsigned int index = 0;

auto colour = _entity.getEntityColour();

for (const auto& v : m_vertices)
{
vertices.push_back(ArbitraryMeshVertex(v.vertex, { 0,0,1 }, { 0,0 }));
vertices.push_back(ArbitraryMeshVertex(v.vertex, { 0,0,1 }, { 0,0 }, colour));
indices.push_back(index);
indices.push_back(++index);
};
Expand Down
8 changes: 4 additions & 4 deletions radiantcore/entity/doom3group/Doom3GroupNode.cpp
Expand Up @@ -16,8 +16,8 @@ Doom3GroupNode::Doom3GroupNode(const IEntityClassPtr& eclass) :
m_rotationKey(std::bind(&Doom3GroupNode::rotationChanged, this)),
m_renderOrigin(m_nameOrigin),
m_isModel(false),
m_curveNURBS(std::bind(&scene::Node::boundsChanged, this)),
m_curveCatmullRom(std::bind(&scene::Node::boundsChanged, this)),
m_curveNURBS(*this, std::bind(&scene::Node::boundsChanged, this)),
m_curveCatmullRom(*this, std::bind(&scene::Node::boundsChanged, this)),
_nurbsEditInstance(m_curveNURBS,
std::bind(&Doom3GroupNode::selectionChangedComponent, this, std::placeholders::_1)),
_catmullRomEditInstance(m_curveCatmullRom,
Expand All @@ -39,8 +39,8 @@ Doom3GroupNode::Doom3GroupNode(const Doom3GroupNode& other) :
m_rotationKey(std::bind(&Doom3GroupNode::rotationChanged, this)),
m_renderOrigin(m_nameOrigin),
m_isModel(other.m_isModel),
m_curveNURBS(std::bind(&scene::Node::boundsChanged, this)),
m_curveCatmullRom(std::bind(&scene::Node::boundsChanged, this)),
m_curveNURBS(*this, std::bind(&scene::Node::boundsChanged, this)),
m_curveCatmullRom(*this, std::bind(&scene::Node::boundsChanged, this)),
_nurbsEditInstance(m_curveNURBS,
std::bind(&Doom3GroupNode::selectionChangedComponent, this, std::placeholders::_1)),
_catmullRomEditInstance(m_curveCatmullRom,
Expand Down

0 comments on commit 4bf23fc

Please sign in to comment.