fixed conflict between methods render of module and Qt widgets
This commit is contained in:
parent
b7a61f3c66
commit
bf4daa27b3
@ -8,7 +8,7 @@ void BasicModule::addEntity(Entity* myEntity)
|
|||||||
entities.push_back(myEntity);
|
entities.push_back(myEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicModule::render(Camera* myCamera)
|
void BasicModule::renderGL(Camera* myCamera)
|
||||||
{
|
{
|
||||||
shader->bind();
|
shader->bind();
|
||||||
bindModule();
|
bindModule();
|
||||||
|
@ -21,7 +21,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void addEntity(Entity* myEntity);
|
void addEntity(Entity* myEntity);
|
||||||
void virtual render(Camera* myCamera);
|
void virtual renderGL(Camera* myCamera);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BASICMODULE_H
|
#endif // BASICMODULE_H
|
||||||
|
2
module.h
2
module.h
@ -6,7 +6,7 @@ class Camera;
|
|||||||
class Module
|
class Module
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void render(Camera* myCamera) = 0;
|
virtual void renderGL(Camera* myCamera) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MODULE
|
#endif // MODULE
|
||||||
|
@ -16,6 +16,8 @@ class Lights;
|
|||||||
class ResourceBase
|
class ResourceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum {TEXTURES, MESHES, MATERIALS, SHADERS, ENTITIES};
|
||||||
|
|
||||||
static void setTexture(const std::string &textureName, Texture* myTexture);
|
static void setTexture(const std::string &textureName, Texture* myTexture);
|
||||||
static void setMesh(const std::string &meshName, Mesh* myMesh);
|
static void setMesh(const std::string &meshName, Mesh* myMesh);
|
||||||
static void setMaterial(const std::string &materialName, Material* myMaterial);
|
static void setMaterial(const std::string &materialName, Material* myMaterial);
|
||||||
|
@ -31,7 +31,7 @@ SkyboxModule::~SkyboxModule()
|
|||||||
glAssert(glDeleteBuffers(1, &vbo));
|
glAssert(glDeleteBuffers(1, &vbo));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyboxModule::render(Camera* myCamera)
|
void SkyboxModule::renderGL(Camera* myCamera)
|
||||||
{
|
{
|
||||||
shader->bind();
|
shader->bind();
|
||||||
glm::mat4 mvp = myCamera->getProjectionMatrix() * glm::mat4(glm::mat3(myCamera->getViewMatrix()));
|
glm::mat4 mvp = myCamera->getProjectionMatrix() * glm::mat4(glm::mat3(myCamera->getViewMatrix()));
|
||||||
|
@ -22,7 +22,7 @@ class SkyboxModule : public Module
|
|||||||
public:
|
public:
|
||||||
SkyboxModule(Texture* myCubeMap);
|
SkyboxModule(Texture* myCubeMap);
|
||||||
~SkyboxModule();
|
~SkyboxModule();
|
||||||
virtual void render(Camera* myCamera);
|
virtual void renderGL(Camera* myCamera);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SKYBOXMODULE_H
|
#endif // SKYBOXMODULE_H
|
||||||
|
@ -30,7 +30,7 @@ void SparrowRenderer::initGL(int width, int height)
|
|||||||
glAssert(glEnable(GL_DEPTH_TEST));
|
glAssert(glEnable(GL_DEPTH_TEST));
|
||||||
glAssert(glEnable(GL_CULL_FACE));
|
glAssert(glEnable(GL_CULL_FACE));
|
||||||
glAssert(glEnable(GL_TEXTURE_2D));
|
glAssert(glEnable(GL_TEXTURE_2D));
|
||||||
resize(width, height);
|
resizeGL(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SparrowRenderer::destroyGL()
|
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));
|
glAssert(glViewport(0, 0, width, height));
|
||||||
camera.resize(width, height);
|
camera.resize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SparrowRenderer::render()
|
void SparrowRenderer::renderGL()
|
||||||
{
|
{
|
||||||
glAssert(glClearColor(0.60, 0.65, 0.75, 1.0));
|
glAssert(glClearColor(0.60, 0.65, 0.75, 1.0));
|
||||||
glAssert(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
glAssert(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
|
||||||
for(ModuleNode &m : modules)
|
for(ModuleNode &m : modules)
|
||||||
{
|
{
|
||||||
if(m.isEnabled)
|
if(m.isEnabled)
|
||||||
m.module->render(getCamera());
|
m.module->renderGL(getCamera());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ public:
|
|||||||
// main methods
|
// main methods
|
||||||
void initGL(int width, int height);
|
void initGL(int width, int height);
|
||||||
void destroyGL();
|
void destroyGL();
|
||||||
void resize(int width, int height);
|
void resizeGL(int width, int height);
|
||||||
void render();
|
void renderGL();
|
||||||
|
|
||||||
// modules methods
|
// modules methods
|
||||||
void addModule(Module* myModule, std::string name);
|
void addModule(Module* myModule, std::string name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user