Skip to content

Commit

Permalink
#5584: Remove unused code related to the legacy colour shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 25, 2022
1 parent 0a060fb commit 8577d86
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 59 deletions.
11 changes: 0 additions & 11 deletions include/ieclass.h
Expand Up @@ -9,7 +9,6 @@
#include "ModResource.h"

#include "imodule.h"
#include "math/Vector3.h"
#include "math/Vector4.h"

#include <vector>
Expand Down Expand Up @@ -159,16 +158,6 @@ class IEntityClass :
// Overrides the colour defined in the .def files
virtual void setColour(const Vector4& colour) = 0;

/// Get the shader used for rendering this entity class in wireframe mode.
//virtual const std::string& getWireShader() const = 0;
//
///// Get the shader used for rendering this entity class in filled mode.
//virtual const std::string& getFillShader() const = 0;
//
//// Get the shader name used for rendering coloured primitives in both cam and ortho
//virtual const std::string& getColourShader() const = 0;


/* ENTITY CLASS ATTRIBUTES */

/**
Expand Down
38 changes: 6 additions & 32 deletions radiantcore/eclass/EntityClass.cpp
Expand Up @@ -6,18 +6,18 @@
#include "string/convert.h"

#include "string/predicate.h"
#include <fmt/format.h>
#include <functional>

namespace eclass
{

const std::string EntityClass::DefaultWireShader("<0.3 0.3 1>");
const std::string EntityClass::DefaultFillShader("(0.3 0.3 1)");
const std::string EntityClass::DefaultColourShader("{0.3 0.3 1}");
const Vector3 EntityClass::DefaultEntityColour(0.3, 0.3, 1);
namespace
{
const Vector3 DefaultEntityColour(0.3, 0.3, 1);
const Vector4 UndefinedColour(-1, -1, -1, -1);
}

const EntityClassAttribute EntityClass::_emptyAttribute("", "", "");
const Vector4 UndefinedColour(-1, -1, -1, -1);

EntityClass::EntityClass(const std::string& name, const vfs::FileInfo& fileInfo) :
EntityClass(name, fileInfo, false)
Expand Down Expand Up @@ -103,14 +103,6 @@ void EntityClass::setColour(const Vector4& colour)
_colour = DefaultEntityColour;
}

// Define fill and wire versions of the entity colour
_fillShader = _colourTransparent ?
fmt::format("[{0:f} {1:f} {2:f}]", _colour[0], _colour[1], _colour[2]) :
fmt::format("({0:f} {1:f} {2:f})", _colour[0], _colour[1], _colour[2]);

_wireShader = fmt::format("<{0:f} {1:f} {2:f}>", _colour[0], _colour[1], _colour[2]);
_colourShader = fmt::format("{{{0:f} {1:f} {2:f}}}", _colour[0], _colour[1], _colour[2]);

emitChangedSignal();
}

Expand Down Expand Up @@ -145,25 +137,7 @@ const Vector4& EntityClass::getColour() const
{
return _colour;
}
#if 0
const std::string& EntityClass::getWireShader() const
{
// Use a fallback shader colour in case we don't have anything
return !_wireShader.empty() ? _wireShader : DefaultWireShader;
}

const std::string& EntityClass::getFillShader() const
{
// Use a fallback shader colour in case we don't have anything
return !_fillShader.empty() ? _fillShader : DefaultFillShader;
}

const std::string& EntityClass::getColourShader() const
{
// Use a fallback shader colour in case we don't have anything
return !_colourShader.empty() ? _colourShader : DefaultColourShader;
}
#endif
/* ATTRIBUTES */

/**
Expand Down
16 changes: 0 additions & 16 deletions radiantcore/eclass/EntityClass.h
Expand Up @@ -49,17 +49,6 @@ class EntityClass
Vector4 _colour;
bool _colourTransparent;

// Default shader names, in case we don't get any from the parent or otherwise
static const std::string DefaultWireShader;
static const std::string DefaultFillShader;
static const std::string DefaultColourShader;
static const Vector3 DefaultEntityColour;

// Shader versions of the colour
std::string _fillShader;
std::string _wireShader;
std::string _colourShader;

// Does this entity have a fixed size?
bool _fixedSize;

Expand Down Expand Up @@ -148,11 +137,6 @@ class EntityClass
void setColour(const Vector4& colour) override;
// Resets the colour to the value defined in the attributes
void resetColour();
#if 0
const std::string& getWireShader() const override;
const std::string& getFillShader() const override;
const std::string& getColourShader() const override;
#endif
EntityClassAttribute& getAttribute(const std::string&, bool includeInherited = true) override;
const EntityClassAttribute& getAttribute(const std::string&, bool includeInherited = true) const override;
const std::string& getAttributeType(const std::string& name) const override;
Expand Down

0 comments on commit 8577d86

Please sign in to comment.