Skip to content
Permalink
Browse files

Resolve #5117: Entities with non-existent classnames are shown white …

…instead of blue in orthoview.

Eclasses now return a default shader name if the corresponding member is found empty.
  • Loading branch information
codereader committed Jan 10, 2020
1 parent 6a41c6d commit 5f5028b4bf083331a94321b25930dd527b075805
Showing with 11 additions and 8 deletions.
  1. +7 −7 radiant/eclassmgr/Doom3EntityClass.cpp
  2. +4 −1 radiant/eclassmgr/Doom3EntityClass.h
@@ -195,6 +195,9 @@ class Doom3EntityClass::Attachments
}
};

const std::string Doom3EntityClass::DefaultWireShader("<0.3 0.3 1>");
const std::string Doom3EntityClass::DefaultFillShader("(0.3 0.3 1)");

// Constructor
Doom3EntityClass::Doom3EntityClass(const std::string& name,
const Vector3& colour,
@@ -205,7 +208,6 @@ Doom3EntityClass::Doom3EntityClass(const std::string& name,
_parent(NULL),
_isLight(false),
_colour(colour),
_colourSpecified(false),
_colourTransparent(false),
_fixedSize(fixedSize),
_model(""),
@@ -279,9 +281,6 @@ void Doom3EntityClass::setIsLight(bool val)

void Doom3EntityClass::setColour(const Vector3& colour)
{
// Set the specified flag
_colourSpecified = true;

_colour = colour;

// Set the entity colour to default, if none was specified
@@ -304,12 +303,14 @@ const Vector3& Doom3EntityClass::getColour() const {

const std::string& Doom3EntityClass::getWireShader() const
{
return _wireShader;
// Use a fallback shader colour in case we don't have anything
return !_wireShader.empty() ? _wireShader : DefaultWireShader;
}

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

/* ATTRIBUTES */
@@ -501,7 +502,6 @@ void Doom3EntityClass::clear()
_isLight = false;

_colour = Vector3(-1,-1,-1);
_colourSpecified = false;
_colourTransparent = false;

_fixedSize = false;
@@ -53,9 +53,12 @@ class Doom3EntityClass

// Colour of this entity and flag to indicate it has been specified
Vector3 _colour;
bool _colourSpecified;
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;

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

0 comments on commit 5f5028b

Please sign in to comment.
You can’t perform that action at this time.