]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
- Entity names are now drawn for group entities in Doom3 and Quake 3 mode (namespace)
authornamespace <namespace@8a3a26a2-13c4-0310-b231-cf6edde360e5>
Fri, 8 Dec 2006 19:52:48 +0000 (19:52 +0000)
committernamespace <namespace@8a3a26a2-13c4-0310-b231-cf6edde360e5>
Fri, 8 Dec 2006 19:52:48 +0000 (19:52 +0000)
- 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
libs/render.h
plugins/entity/curve.h
plugins/entity/doom3group.cpp
plugins/entity/group.cpp
radiant/brush.h
radiant/renderstate.cpp

diff --git a/CHANGES b/CHANGES
index 3970d7c0ebe342cccade909e07e3b6d39ffcf52a..ae8aaac642c6d7a3e4bceaac9b88b7b9bda9c2c1 100644 (file)
--- 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.
index 1411303cc8fc1827a61c6139e09433883f6bda1b..fb243650a5e1d24b87e18abca04b919e4f794bda 100644 (file)
@@ -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)
index 71ff385af6cf6feca01a75a44ed3ccd77c96b4bd..39629549255bbedf24e387dec8d18583b879713c 100644 (file)
@@ -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;
index c8a0b8cf1fe821bed251fec7d759fce339c6e573..49b38e9770966b6c9f2254150633a3d34ebaf654 100644 (file)
@@ -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());
index 1d078c11847beb3e9e60376cf6319c338fd3043d..8d8d8ca221409751634e95f022f464771d324381 100644 (file)
@@ -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
index 5d06d7c932a27f1d3fe3470705c8af1a4ab3b88a..092652e2107f2b97b57daaa929f3bda4f4b0a5c7 100644 (file)
@@ -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"
 
index 2f5596d13f23ba14d20860bc0d9d0845b6d61ef5..db71b2263ada0dcc11ec2c2ac443adb7bb92a330 100644 (file)
@@ -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"))