added clearColor attribute in sparrowRenderer
This commit is contained in:
parent
f5dfd8f5d3
commit
97032c2fe6
@ -29,9 +29,6 @@ void ForwardModule::renderGL(Camera* myCamera, Scene* scene)
|
|||||||
renderTarget->bindFBO();
|
renderTarget->bindFBO();
|
||||||
|
|
||||||
// render ambient lighting
|
// render ambient lighting
|
||||||
glAssert(glClearColor(0, 0.1f, 0.05f, 1.)); // add attribute, and setter for clear color
|
|
||||||
glAssert(glClearDepth(1.0));
|
|
||||||
glAssert(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
|
||||||
glAssert(glDepthFunc(GL_LESS));
|
glAssert(glDepthFunc(GL_LESS));
|
||||||
glAssert(glDisable(GL_BLEND));
|
glAssert(glDisable(GL_BLEND));
|
||||||
|
|
||||||
|
@ -58,6 +58,9 @@ void SparrowRenderer::resizeGL(int width, int height)
|
|||||||
|
|
||||||
void SparrowRenderer::renderGL()
|
void SparrowRenderer::renderGL()
|
||||||
{
|
{
|
||||||
|
glAssert(glClearColor(clearColor.r, clearColor.g, clearColor.b, 1));
|
||||||
|
glAssert(glClearDepth(1.0));
|
||||||
|
glAssert(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
||||||
for(ModuleNode &m : modules)
|
for(ModuleNode &m : modules)
|
||||||
{
|
{
|
||||||
if(m.isEnabled)
|
if(m.isEnabled)
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <glm/vec3.hpp>
|
||||||
|
|
||||||
class Camera;
|
class Camera;
|
||||||
class Module;
|
class Module;
|
||||||
@ -11,12 +12,19 @@ class Scene;
|
|||||||
class SparrowRenderer
|
class SparrowRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
SparrowRenderer() :
|
||||||
|
camera(NULL),
|
||||||
|
scene(NULL),
|
||||||
|
clearColor(0)
|
||||||
|
{}
|
||||||
|
|
||||||
// main methods
|
// main methods
|
||||||
void initGL(int width, int height, bool forceCrappy = false);
|
void initGL(int width, int height, bool forceCrappy = false);
|
||||||
void destroyGL();
|
void destroyGL();
|
||||||
void resizeGL(int width, int height);
|
void resizeGL(int width, int height);
|
||||||
void renderGL();
|
void renderGL();
|
||||||
static bool isModernOpenGLAvailable();
|
static bool isModernOpenGLAvailable();
|
||||||
|
void setClearColor(glm::vec3 color) {clearColor=color;}
|
||||||
|
|
||||||
// clock methods
|
// clock methods
|
||||||
double getFPS();
|
double getFPS();
|
||||||
@ -48,6 +56,7 @@ protected:
|
|||||||
Scene* scene;
|
Scene* scene;
|
||||||
std::vector<ModuleNode> modules;
|
std::vector<ModuleNode> modules;
|
||||||
static bool modernOpenglAvailable;
|
static bool modernOpenglAvailable;
|
||||||
|
glm::vec3 clearColor;
|
||||||
|
|
||||||
std::vector<ModuleNode>::iterator getModuleNode(std::string name);
|
std::vector<ModuleNode>::iterator getModuleNode(std::string name);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user