fixed diffuse texture bug, added possibility to disable modules
This commit is contained in:
parent
144daa8c3c
commit
89adbf2fc5
@ -67,9 +67,9 @@ void main(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DIFFUSE_TEXTURE
|
#ifdef DIFFUSE_TEXTURE
|
||||||
vec3 diffuse = texture(diffuseTexture, varTexCoord).rgb;
|
vec3 diffuse = texture(diffuseTexture, varTexCoord).rgb;
|
||||||
#else
|
#else
|
||||||
vec3 diffuse = materialKd;
|
vec3 diffuse = materialKd;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SPECULAR_TEXTURE
|
#ifdef SPECULAR_TEXTURE
|
||||||
@ -79,9 +79,9 @@ void main(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef AMBIENT_LIGHT
|
#ifdef AMBIENT_LIGHT
|
||||||
outColor = vec4(diffuse, 1);
|
outColor = vec4(0, 0, 0, 1);
|
||||||
#else
|
#else
|
||||||
vec3 light = phongLighting(diffuse, specular, materialNs, lightColor, normal, lightDirInView, halfVecInView);
|
vec3 light = phongLighting(diffuse, specular, materialNs, lightColor, normal, lightDirInView, halfVecInView);
|
||||||
outColor = vec4(light, 1);
|
outColor = vec4(light, 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -49,11 +49,11 @@ void main(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NORMAL_MAP
|
#ifdef NORMAL_MAP
|
||||||
tangentSpace = transpose(mat3(normalize(normalMatrix*inTangent),
|
tangentSpace = transpose(mat3(normalize(normalMatrix*inTangent),
|
||||||
normalize(normalMatrix*inBinormal),
|
normalize(normalMatrix*inBinormal),
|
||||||
normalize(normalMatrix*inNormal)));
|
normalize(normalMatrix*inNormal)));
|
||||||
#else
|
#else
|
||||||
varNormal = normalize(normalMatrix*inNormal);
|
varNormal = normalize(normalMatrix*inNormal);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
varTexCoord = inTexCoord.xy;
|
varTexCoord = inTexCoord.xy;
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
const char* const ForwardModule::flagStr[] =
|
const char* const ForwardModule::flagStr[] =
|
||||||
{
|
{
|
||||||
"NORMAL_MAP",
|
|
||||||
"AMBIENT_TEXTURE",
|
|
||||||
"DIFFUSE_TEXTURE",
|
"DIFFUSE_TEXTURE",
|
||||||
|
"AMBIENT_TEXTURE",
|
||||||
"SPECULAR_TEXTURE",
|
"SPECULAR_TEXTURE",
|
||||||
|
"NORMAL_MAP",
|
||||||
"ALPHA_MASK"
|
"ALPHA_MASK"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@ enum {
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
// Geometry Flags
|
// Geometry Flags
|
||||||
NORMAL_MAP_FLAG = 1 << NORMAL_MAP,
|
|
||||||
AMBIENT_TEXTURE_FLAG = 1 << AMBIENT_TEXTURE,
|
|
||||||
DIFFUSE_TEXTURE_FLAG = 1 << DIFFUSE_TEXTURE,
|
DIFFUSE_TEXTURE_FLAG = 1 << DIFFUSE_TEXTURE,
|
||||||
|
AMBIENT_TEXTURE_FLAG = 1 << AMBIENT_TEXTURE,
|
||||||
SPECULAR_TEXTURE_FLAG = 1 << SPECULAR_TEXTURE,
|
SPECULAR_TEXTURE_FLAG = 1 << SPECULAR_TEXTURE,
|
||||||
|
NORMAL_MAP_FLAG = 1 << NORMAL_MAP,
|
||||||
ALPHA_MASK_FLAG = 1 << ALPHA_MASK,
|
ALPHA_MASK_FLAG = 1 << ALPHA_MASK,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,10 +34,10 @@ void SparrowRenderer::initGL(int width, int height, bool forceCrappy)
|
|||||||
fprintf(stderr, "Warning: modern OpenGL not supported!\nEnabling fallback crappy rendering mode\n");
|
fprintf(stderr, "Warning: modern OpenGL not supported!\nEnabling fallback crappy rendering mode\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "OpenGL version " << glGetString(GL_VERSION) << std::endl;
|
std::cout << "OpenGL " << glGetString(GL_VERSION) << std::endl;
|
||||||
std::cout << "GLSL version " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
std::cout << "GLSL " << glGetString(GL_SHADING_LANGUAGE_VERSION) << std::endl;
|
||||||
std::cout << "gl renderer " << glGetString(GL_RENDERER) << std::endl;
|
std::cout << "Renderer " << glGetString(GL_RENDERER) << std::endl;
|
||||||
std::cout << "gl vendor " << glGetString(GL_VENDOR) << std::endl;
|
std::cout << "Vendor " << glGetString(GL_VENDOR) << std::endl;
|
||||||
|
|
||||||
glAssert(glEnable(GL_DEPTH_TEST));
|
glAssert(glEnable(GL_DEPTH_TEST));
|
||||||
glAssert(glEnable(GL_CULL_FACE));
|
glAssert(glEnable(GL_CULL_FACE));
|
||||||
@ -110,6 +110,15 @@ int SparrowRenderer::getNbModules()
|
|||||||
return modules.size();
|
return modules.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SparrowRenderer::setModuleEnabled(std::string module, bool isEnabled)
|
||||||
|
{
|
||||||
|
for(ModuleNode &node : modules)
|
||||||
|
{
|
||||||
|
if(node.name.compare(module) == 0)
|
||||||
|
node.isEnabled = isEnabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// camera methods
|
// camera methods
|
||||||
|
|
||||||
void SparrowRenderer::setCamera(Camera* myCamera)
|
void SparrowRenderer::setCamera(Camera* myCamera)
|
||||||
|
@ -34,6 +34,8 @@ public:
|
|||||||
void addModule(Module* myModule, std::string name);
|
void addModule(Module* myModule, std::string name);
|
||||||
int getNbModules();
|
int getNbModules();
|
||||||
|
|
||||||
|
void setModuleEnabled(std::string module, bool isEnabled);
|
||||||
|
|
||||||
// camera methods
|
// camera methods
|
||||||
void setCamera(Camera* myCamera);
|
void setCamera(Camera* myCamera);
|
||||||
Camera* getCamera();
|
Camera* getCamera();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user