fixed tangent space, added shader source displayed when compilation error occurs
This commit is contained in:
parent
84662d2c9f
commit
87a2c2c906
@ -80,7 +80,7 @@ void main(void) {
|
||||
#endif
|
||||
|
||||
#ifdef AMBIENT_LIGHT
|
||||
outColor = vec4(ambient + lightColor*diffuse, 1);
|
||||
outColor = vec4(lightColor*ambient, 1);
|
||||
#else
|
||||
vec3 light = phongLighting(diffuse, specular, materialNs, lightColor, normal, lightDirInView, halfVecInView);
|
||||
outColor = vec4(light, 1);
|
||||
|
11
forward.vert
11
forward.vert
@ -43,14 +43,15 @@ void main(void) {
|
||||
#endif
|
||||
|
||||
#ifdef POINT_LIGHT
|
||||
lightDirInView = normalize(viewMatrix*pointLight - posInView);
|
||||
halfVecInView = normalize(lightDirInView - posInView);
|
||||
vec4 lightPosInView = viewMatrix*vec4(pointLight, 1);
|
||||
lightDirInView = normalize(lightPosInView.xyz - posInView);
|
||||
halfVecInView = normalize(lightDirInView - normalize(posInView));
|
||||
#endif
|
||||
|
||||
#ifdef NORMAL_MAP
|
||||
tangentSpace = mat3(normalize(normalMatrix*inNormal),
|
||||
normalize(normalMatrix*inTangent),
|
||||
normalize(normalMatrix*inBinormal));
|
||||
tangentSpace = transpose(mat3(normalize(normalMatrix*inTangent),
|
||||
normalize(normalMatrix*inBinormal),
|
||||
normalize(normalMatrix*inNormal)));
|
||||
#else
|
||||
varNormal = normalize(normalMatrix*inNormal);
|
||||
#endif
|
||||
|
@ -104,6 +104,7 @@ GLuint Shader::createShader(const std::string &source, GLenum shaderType)
|
||||
break;
|
||||
}
|
||||
std::cerr << type_str << " shader not compiled : " << std::endl;
|
||||
std::cout << "Shader source :" << std::endl << source << std::endl;
|
||||
printShaderInfoLog(shaderId);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user