prepare_scene() should also prepare shaders

This commit is contained in:
rdb 2013-07-28 22:00:38 +00:00
parent 1354fbf5cd
commit ccf4863ca1

View File

@ -21,6 +21,7 @@
#include "colorScaleAttrib.h" #include "colorScaleAttrib.h"
#include "texMatrixAttrib.h" #include "texMatrixAttrib.h"
#include "textureAttrib.h" #include "textureAttrib.h"
#include "shaderAttrib.h"
#include "bamReader.h" #include "bamReader.h"
#include "bamWriter.h" #include "bamWriter.h"
#include "datagram.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); PandaNode::r_prepare_scene(gsg, node_state, transformer, current_thread);