#ifndef FORWARDMODULE_H #define FORWARDMODULE_H #include "opengl.h" #include "module.h" #include #include #include #include "shadersource.h" #include "material.h" #include "framebuffer.h" #include "light.h" #include class GeometryNode; class Scene; class PhongEntity; class ForwardModule : public Module { public: ForwardModule() : shaderSources(NULL) { } virtual void renderGL(Camera* myCamera, Scene* scene); virtual void resize(int w, int h) {width = w; height = h;} void setShaderSource(ShaderSource* source); void compileShaders(Scene* scene); private: struct Pass { Shader* shader; const std::vector &geometry; const std::vector &lights; Pass(Shader *myShader, const std::vector &geomIt, const std::vector &lightIt) : shader(myShader), geometry(geomIt), lights(lightIt) {} }; std::unordered_map> geometry; std::unordered_map> lights; AmbientLight ambientLight; std::vector passes; ShaderSource* shaderSources; int width; int height; }; class PassScheduler { struct Pass { Shader* shader; const std::vector &geometry; const std::vector &lights; Pass(Shader *myShader, const std::vector &geomIt, const std::vector &lightIt) : shader(myShader), geometry(geomIt), lights(lightIt) {} }; std::unordered_map> geometry; std::unordered_map> lights; ShaderSource* shaderSources; public: void compileShaders(Scene *scene, std::vector &passes); }; #endif // FORWARDMODULE_H