Browse Source

Fix back-to-front sorting with gl-coordinate-system set to a custom value

rdb 9 years ago
parent
commit
b1d61b7b10

+ 4 - 0
panda/src/display/graphicsStateGuardian.cxx

@@ -147,6 +147,10 @@ GraphicsStateGuardian(CoordinateSystem internal_coordinate_system,
   _coordinate_system = CS_invalid;
   _internal_transform = TransformState::make_identity();
 
+  if (_internal_coordinate_system == CS_default) {
+    _internal_coordinate_system = get_default_coordinate_system();
+  }
+
   set_coordinate_system(get_default_coordinate_system());
 
   _data_reader = (GeomVertexDataPipelineReader *)NULL;

+ 1 - 1
panda/src/display/graphicsStateGuardian.h

@@ -322,7 +322,7 @@ public:
   virtual void set_state_and_transform(const RenderState *state,
                                        const TransformState *transform);
 
-  virtual PN_stdfloat compute_distance_to(const LPoint3 &point) const;
+  PN_stdfloat compute_distance_to(const LPoint3 &point) const;
 
   virtual void clear(DrawableRegion *clearable);
 

+ 0 - 10
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -6024,16 +6024,6 @@ make_geom_munger(const RenderState *state, Thread *current_thread) {
   return GeomMunger::register_munger(munger, current_thread);
 }
 
-/**
- * This function will compute the distance to the indicated point, assumed to
- * be in eye coordinates, from the camera plane.  The point is assumed to be
- * in the GSG's internal coordinate system.
- */
-PN_stdfloat CLP(GraphicsStateGuardian)::
-compute_distance_to(const LPoint3 &point) const {
-  return -point[2];
-}
-
 /**
  * Copy the pixels within the indicated display region from the framebuffer
  * into texture memory.

+ 0 - 2
panda/src/glstuff/glGraphicsStateGuardian_src.h

@@ -358,8 +358,6 @@ public:
   virtual PT(GeomMunger) make_geom_munger(const RenderState *state,
                                           Thread *current_thread);
 
-  virtual PN_stdfloat compute_distance_to(const LPoint3 &point) const;
-
   virtual void clear(DrawableRegion *region);
 
   virtual bool framebuffer_copy_to_texture