Browse Source

fix motiontrail color

David Rose 17 years ago
parent
commit
4b315b5170
1 changed files with 7 additions and 1 deletions
  1. 7 1
      direct/src/motiontrail/cMotionTrail.cxx

+ 7 - 1
direct/src/motiontrail/cMotionTrail.cxx

@@ -14,6 +14,8 @@
 
 #include "directbase.h"
 #include "cMotionTrail.h"
+#include "renderState.h"
+#include "colorAttrib.h"
 
 
 TypeHandle CMotionTrail::_type_handle;
@@ -326,6 +328,10 @@ add_geometry_quad (LVector4f &v0, LVector4f &v1, LVector4f &v2, LVector4f &v3, L
 //  Description: 
 ////////////////////////////////////////////////////////////////////
 void CMotionTrail::end_geometry ( ) {    
+  static CPT(RenderState) state;
+  if (state == (RenderState *)NULL) {
+    state = RenderState::make(ColorAttrib::make_vertex());
+  }
 
   PT(Geom) geometry;
   
@@ -334,7 +340,7 @@ void CMotionTrail::end_geometry ( ) {
 
   if (_geom_node) {
     _geom_node -> remove_all_geoms ( );
-    _geom_node -> add_geom (geometry);
+    _geom_node -> add_geom (geometry, state);
   }
 }