Browse Source

prepare_scene() should also prepare shaders

rdb 12 years ago
parent
commit
ccf4863ca1
1 changed files with 13 additions and 0 deletions
  1. 13 0
      panda/src/pgraph/geomNode.cxx

+ 13 - 0
panda/src/pgraph/geomNode.cxx

@@ -21,6 +21,7 @@
 #include "colorScaleAttrib.h"
 #include "texMatrixAttrib.h"
 #include "textureAttrib.h"
+#include "shaderAttrib.h"
 #include "bamReader.h"
 #include "bamWriter.h"
 #include "datagram.h"
@@ -431,6 +432,18 @@ r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state,
         }
       }
     }
+
+    // As well as the shaders.
+    attrib = geom_state->get_attrib(ShaderAttrib::get_class_slot());
+    if (attrib != (const RenderAttrib *)NULL) {
+      const ShaderAttrib *sa;
+      DCAST_INTO_V(sa, attrib);
+      Shader *shader = (Shader *)sa->get_shader();
+      if (shader != (Shader *)NULL) {
+        shader->prepare(prepared_objects);
+      }
+      //TODO: Invoke the shader generator if enabled.
+    }
   }
   
   PandaNode::r_prepare_scene(gsg, node_state, transformer, current_thread);