56 lines
1.3 KiB
C++
56 lines
1.3 KiB
C++
#ifndef FORWARDMODULE_H
|
|
#define FORWARDMODULE_H
|
|
|
|
#include "glew.h"
|
|
#include "module.h"
|
|
#include <vector>
|
|
#include <cstddef>
|
|
#include "shadersource.h"
|
|
#include "material.h"
|
|
#include "framebuffer.h"
|
|
|
|
class Light;
|
|
class Scene;
|
|
class PhongEntity;
|
|
|
|
class ForwardModule : public Module
|
|
{
|
|
public:
|
|
ForwardModule() :
|
|
shaderSources(NULL),
|
|
renderTarget(FrameBuffer::screen),
|
|
isWireframe(false),
|
|
clearBeforeDrawing(false)
|
|
{}
|
|
|
|
virtual void renderGL(Camera* myCamera, Scene* scene);
|
|
virtual bool requiresModernOpenGL() {return true;}
|
|
virtual void resize(int w, int h) {width = w; height = h;}
|
|
|
|
// modern opengl methods
|
|
|
|
void setShaderSource(ShaderSource* source);
|
|
void compileShaders(Scene* scene);
|
|
|
|
void setRenderTarget(const FrameBuffer* target);
|
|
void setWireframe(bool wireframe) {isWireframe = wireframe;}
|
|
void setClearBeforeDrawing(bool clear) {clearBeforeDrawing = clear;}
|
|
|
|
private:
|
|
ShaderSource* shaderSources;
|
|
std::vector<Shader*> shaders;
|
|
std::vector<unsigned int> geometryFlagList;
|
|
std::vector<unsigned int> lightFlagList;
|
|
const FrameBuffer* renderTarget;
|
|
|
|
int width;
|
|
int height;
|
|
|
|
bool isWireframe;
|
|
bool clearBeforeDrawing;
|
|
|
|
void lightPass(Camera* myCamera, Scene* scene, Light* light);
|
|
};
|
|
|
|
#endif // FORWARDMODULE_H
|