Browse Source

resolve dependency issue

David Rose 18 years ago
parent
commit
e75c8695dd
3 changed files with 23 additions and 20 deletions
  1. 0 19
      panda/src/pgraph/renderState.I
  2. 22 0
      panda/src/pgraph/renderState.cxx
  3. 1 1
      panda/src/pgraph/renderState.h

+ 0 - 19
panda/src/pgraph/renderState.I

@@ -651,22 +651,3 @@ CompositionCycleDescEntry(const RenderState *obj,
   _inverted(inverted)
 {
 }
-
-////////////////////////////////////////////////////////////////////
-//     Function: RenderState::get_generated_shader
-//       Access: Public
-//  Description: Generate a ShaderAttrib for this RenderState.  This
-//               generated ShaderAttrib can be thought of as a
-//               replacement for the regular ShaderAttrib that is a
-//               standard part of the RenderState.
-////////////////////////////////////////////////////////////////////
-INLINE const ShaderAttrib *RenderState::
-get_generated_shader() const {
-  if (_generated_shader != (RenderAttrib*)NULL) {
-    return DCAST(ShaderAttrib, _generated_shader);
-  }
-  ((RenderState*)this)->_generated_shader =
-    ShaderGenerator::synthesize_shader(this);
-  return DCAST(ShaderAttrib, _generated_shader);
-}
-

+ 22 - 0
panda/src/pgraph/renderState.cxx

@@ -1126,6 +1126,28 @@ get_geom_rendering(int geom_rendering) const {
   return geom_rendering;
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: RenderState::get_generated_shader
+//       Access: Public
+//  Description: Generate a ShaderAttrib for this RenderState.  This
+//               generated ShaderAttrib can be thought of as a
+//               replacement for the regular ShaderAttrib that is a
+//               standard part of the RenderState.
+////////////////////////////////////////////////////////////////////
+const ShaderAttrib *RenderState::
+get_generated_shader() const {
+  // This method cannot be declared inline, because of the circular
+  // dependency on shaderAttrib.h.
+
+  if (_generated_shader != (RenderAttrib*)NULL) {
+    return DCAST(ShaderAttrib, _generated_shader);
+  }
+  ((RenderState*)this)->_generated_shader =
+    ShaderGenerator::synthesize_shader(this);
+  return DCAST(ShaderAttrib, _generated_shader);
+}
+
+
 ////////////////////////////////////////////////////////////////////
 //     Function: RenderState::store_into_slots
 //       Access: Public

+ 1 - 1
panda/src/pgraph/renderState.h

@@ -155,7 +155,7 @@ PUBLISHED:
   
   int get_geom_rendering(int geom_rendering) const;
 
-  INLINE const ShaderAttrib *get_generated_shader() const;
+  const ShaderAttrib *get_generated_shader() const;
   
 public:
   void store_into_slots(AttribSlots *slots) const;