From 4325745d1d49e8d7ff14de36eebae2482636f22f Mon Sep 17 00:00:00 2001 From: namespace Date: Fri, 8 Dec 2006 19:52:48 +0000 Subject: [PATCH] - Entity names are now drawn for group entities in Doom3 and Quake 3 mode (namespace) - Fixed translucent brushes becoming invisible when selected (Shaderman) git-svn-id: https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/trunk@123 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- CHANGES | 5 +++++ libs/render.h | 3 +++ plugins/entity/curve.h | 3 --- plugins/entity/doom3group.cpp | 24 ++++++++++++++++++++---- plugins/entity/group.cpp | 23 ++++++++++++++++------- radiant/brush.h | 2 -- radiant/renderstate.cpp | 6 +++++- 7 files changed, 49 insertions(+), 17 deletions(-) diff --git a/CHANGES b/CHANGES index 3970d7c0..ae8aaac6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,11 @@ This is the changelog for developers, != changelog for the end user that we distribute with the binaries. (see changelog) +08/12/2006 +namespace +- Entity names are now drawn for group entities in Doom3 and Quake 3 mode (namespace) +- Fixed translucent brushes becoming invisible when selected (Shaderman) + 06/11/2006 namespace - (TODO) Texture sizes sometimes vary wildly. New texture browser option: View -> Fixed Size. diff --git a/libs/render.h b/libs/render.h index 1411303c..fb243650 100644 --- a/libs/render.h +++ b/libs/render.h @@ -328,6 +328,9 @@ struct Colour4b } }; +const Colour4b colour_vertex(0, 255, 0, 255); +const Colour4b colour_selected(0, 0, 255, 255); + inline bool operator<(const Colour4b& self, const Colour4b& other) { if(self.r != other.r) diff --git a/plugins/entity/curve.h b/plugins/entity/curve.h index 71ff385a..39629549 100644 --- a/plugins/entity/curve.h +++ b/plugins/entity/curve.h @@ -148,9 +148,6 @@ public: } }; -const Colour4b colour_vertex(0, 255, 0, 255); -const Colour4b colour_selected(0, 0, 255, 255); - class ControlPointAdd { RenderablePointVector& m_points; diff --git a/plugins/entity/doom3group.cpp b/plugins/entity/doom3group.cpp index c8a0b8cf..49b38e97 100644 --- a/plugins/entity/doom3group.cpp +++ b/plugins/entity/doom3group.cpp @@ -82,6 +82,7 @@ class Doom3Group : SingletonModel m_model; OriginKey m_originKey; Vector3 m_origin; + RotationKey m_rotationKey; Float9 m_rotation; @@ -92,6 +93,7 @@ class Doom3Group : Doom3GroupOrigin m_funcStaticOrigin; RenderablePivot m_renderOrigin; RenderableNamedEntity m_renderName; + mutable Vector3 m_name_origin; ModelSkinKey m_skin; public: @@ -276,7 +278,8 @@ public: m_named(m_entity), m_nameKeys(m_entity), m_funcStaticOrigin(m_traverse, m_origin), - m_renderName(m_named, g_vector3_identity), + m_renderName(m_named, m_name_origin), + m_name_origin(g_vector3_identity), m_skin(SkinChangedCaller(*this)), m_curveNURBS(boundsChanged), m_curveCatmullRom(boundsChanged), @@ -399,11 +402,24 @@ public: renderer.addRenderable(m_curveCatmullRom.m_renderCurve, localToWorld); } } - void renderWireframe(Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld, bool selected) const + + void renderWireframe(Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld, bool selected, const AABB& childBounds) const { renderSolid(renderer, volume, localToWorld, selected); - if(g_showNames && isModel()) + + if(g_showNames) { + // draw models as usual + if(!isModel()) + { + // don't draw the name for worldspawn + if(!strcmp(m_entity.getEntityClass().name(), "worldspawn")) + return; + + // place name in the middle of the "children cloud" + m_name_origin = childBounds.origin; + } + renderer.addRenderable(m_renderName, localToWorld); } } @@ -546,7 +562,7 @@ public: } void renderWireframe(Renderer& renderer, const VolumeTest& volume) const { - m_contained.renderWireframe(renderer, volume, Instance::localToWorld(), getSelectable().isSelected()); + m_contained.renderWireframe(renderer, volume, Instance::localToWorld(), getSelectable().isSelected(), Instance::childBounds()); m_curveNURBS.renderComponentsSelected(renderer, volume, localToWorld()); m_curveCatmullRom.renderComponentsSelected(renderer, volume, localToWorld()); diff --git a/plugins/entity/group.cpp b/plugins/entity/group.cpp index 1d078c11..8d8d8ca2 100644 --- a/plugins/entity/group.cpp +++ b/plugins/entity/group.cpp @@ -59,6 +59,7 @@ class Group NameKeys m_nameKeys; RenderableNamedEntity m_renderName; + mutable Vector3 m_name_origin; Callback m_transformChanged; @@ -74,7 +75,8 @@ public: m_filter(m_entity, node), m_named(m_entity), m_nameKeys(m_entity), - m_renderName(m_named, g_vector3_identity), + m_renderName(m_named, m_name_origin), + m_name_origin(g_vector3_identity), m_transformChanged(transformChanged) { construct(); @@ -151,15 +153,22 @@ public: { renderer.SetState(m_entity.getEntityClass().m_state_wire, Renderer::eWireframeOnly); } - void renderWireframe(Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld) const + + void renderWireframe(Renderer& renderer, const VolumeTest& volume, const Matrix4& localToWorld, const AABB& childBounds) const { renderSolid(renderer, volume, localToWorld); -#if 0 - if(g_showNames) + + if(g_showNames) { - renderer.addRenderable(m_renderName, m_transform.localToParent()); + // don't draw the name for worldspawn + if(!strcmp(m_entity.getEntityClass().name(), "worldspawn")) + return; + + // place name in the middle of the "children cloud" + m_name_origin = childBounds.origin; + + renderer.addRenderable(m_renderName, localToWorld); } -#endif } }; @@ -280,7 +289,7 @@ public: } void renderWireframe(Renderer& renderer, const VolumeTest& volume) const { - m_contained.renderWireframe(renderer, volume, Instance::localToWorld()); + m_contained.renderWireframe(renderer, volume, Instance::localToWorld(), Instance::childBounds()); } #if 0 diff --git a/radiant/brush.h b/radiant/brush.h index 5d06d7c9..092652e2 100644 --- a/radiant/brush.h +++ b/radiant/brush.h @@ -201,8 +201,6 @@ inline void Winding_Draw(const Winding& winding, const Vector3& normal, RenderSt #endif } -const Colour4b colour_vertex(0, 255, 0, 255); - #include "shaderlib.h" diff --git a/radiant/renderstate.cpp b/radiant/renderstate.cpp index 2f5596d1..db71b226 100644 --- a/radiant/renderstate.cpp +++ b/radiant/renderstate.cpp @@ -2387,7 +2387,11 @@ void OpenGLShader::construct(const char* name) state.m_colour[2] = 0; state.m_colour[3] = 0.3f; state.m_state = RENDER_FILL|RENDER_DEPTHTEST|RENDER_CULLFACE|RENDER_BLEND|RENDER_COLOURWRITE|RENDER_DEPTHWRITE; - state.m_sort = OpenGLState::eSortHighlight; + + // The bug "Selecting translucent brushes, such as clip, cause them to disappear leaving + // only the red selection box." seems to be fixed by removing the next line. + + // state.m_sort = OpenGLState::eSortHighlight; state.m_depthfunc = GL_LEQUAL; } else if(string_equal(name+1, "CAM_OVERLAY")) -- 2.39.2