fixed conflict between methods render of module and Qt widgets

This commit is contained in:
Anselme 2015-07-21 07:42:37 +02:00
parent b7a61f3c66
commit bf4daa27b3
8 changed files with 13 additions and 11 deletions

View File

@ -8,7 +8,7 @@ void BasicModule::addEntity(Entity* myEntity)
entities.push_back(myEntity);
}
void BasicModule::render(Camera* myCamera)
void BasicModule::renderGL(Camera* myCamera)
{
shader->bind();
bindModule();

View File

@ -21,7 +21,7 @@ protected:
public:
void addEntity(Entity* myEntity);
void virtual render(Camera* myCamera);
void virtual renderGL(Camera* myCamera);
};
#endif // BASICMODULE_H

View File

@ -6,7 +6,7 @@ class Camera;
class Module
{
public:
virtual void render(Camera* myCamera) = 0;
virtual void renderGL(Camera* myCamera) = 0;
};
#endif // MODULE

View File

@ -16,6 +16,8 @@ class Lights;
class ResourceBase
{
public:
enum {TEXTURES, MESHES, MATERIALS, SHADERS, ENTITIES};
static void setTexture(const std::string &textureName, Texture* myTexture);
static void setMesh(const std::string &meshName, Mesh* myMesh);
static void setMaterial(const std::string &materialName, Material* myMaterial);

View File

@ -31,7 +31,7 @@ SkyboxModule::~SkyboxModule()
glAssert(glDeleteBuffers(1, &vbo));
}
void SkyboxModule::render(Camera* myCamera)
void SkyboxModule::renderGL(Camera* myCamera)
{
shader->bind();
glm::mat4 mvp = myCamera->getProjectionMatrix() * glm::mat4(glm::mat3(myCamera->getViewMatrix()));

View File

@ -22,7 +22,7 @@ class SkyboxModule : public Module
public:
SkyboxModule(Texture* myCubeMap);
~SkyboxModule();
virtual void render(Camera* myCamera);
virtual void renderGL(Camera* myCamera);
};
#endif // SKYBOXMODULE_H

View File

@ -30,7 +30,7 @@ void SparrowRenderer::initGL(int width, int height)
glAssert(glEnable(GL_DEPTH_TEST));
glAssert(glEnable(GL_CULL_FACE));
glAssert(glEnable(GL_TEXTURE_2D));
resize(width, height);
resizeGL(width, height);
}
void SparrowRenderer::destroyGL()
@ -38,20 +38,20 @@ void SparrowRenderer::destroyGL()
}
void SparrowRenderer::resize(int width, int height)
void SparrowRenderer::resizeGL(int width, int height)
{
glAssert(glViewport(0, 0, width, height));
camera.resize(width, height);
}
void SparrowRenderer::render()
void SparrowRenderer::renderGL()
{
glAssert(glClearColor(0.60, 0.65, 0.75, 1.0));
glAssert(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
for(ModuleNode &m : modules)
{
if(m.isEnabled)
m.module->render(getCamera());
m.module->renderGL(getCamera());
}
}

View File

@ -13,8 +13,8 @@ public:
// main methods
void initGL(int width, int height);
void destroyGL();
void resize(int width, int height);
void render();
void resizeGL(int width, int height);
void renderGL();
// modules methods
void addModule(Module* myModule, std::string name);