Skip to content

Commit

Permalink
#5988: The RenderableBox renderable should take the local bounds orig…
Browse files Browse the repository at this point in the history
…in into account, it's not always located at 0,0,0.

(This is related to a change in #5968.) The visible Entity Boxes are not necessarily centered at the value of their origin key, they are offset using editor_mins and editor_maxs vectors that are not necessarily symmetric.
  • Loading branch information
codereader committed Aug 15, 2022
1 parent 8799d29 commit 7ee4cbe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions libs/render/RenderableBox.h
Expand Up @@ -168,11 +168,9 @@ class RenderableBox :

_needsUpdate = false;

static Vector3 Origin(0, 0, 0);

// Calculate the corner vertices of this bounding box
Vector3 max(Origin + _bounds.extents);
Vector3 min(Origin - _bounds.extents);
Vector3 max(_bounds.origin + _bounds.extents);
Vector3 min(_bounds.origin - _bounds.extents);

auto colour = getVertexColour();

Expand Down
4 changes: 2 additions & 2 deletions radiantcore/entity/generic/GenericEntityNode.cpp
Expand Up @@ -14,7 +14,7 @@ GenericEntityNode::GenericEntityNode(const IEntityClassPtr& eclass) :
m_angle(AngleKey::IDENTITY),
m_rotationKey(std::bind(&GenericEntityNode::rotationChanged, this)),
_renderableArrow(*this),
_renderableBox(*this, localAABB(), worldAABB().getOrigin()),
_renderableBox(*this, localAABB(), m_origin),
_allow3Drotations(_spawnArgs.getKeyValue("editor_rotatable") == "1")
{}

Expand All @@ -27,7 +27,7 @@ GenericEntityNode::GenericEntityNode(const GenericEntityNode& other) :
m_angle(AngleKey::IDENTITY),
m_rotationKey(std::bind(&GenericEntityNode::rotationChanged, this)),
_renderableArrow(*this),
_renderableBox(*this, localAABB(), worldAABB().getOrigin()),
_renderableBox(*this, localAABB(), m_origin),
_allow3Drotations(_spawnArgs.getKeyValue("editor_rotatable") == "1")
{}

Expand Down

0 comments on commit 7ee4cbe

Please sign in to comment.