mirror of
https://github.com/overte-org/overte.git
synced 2025-06-19 20:00:19 +02:00
playing with the ambient lighting
This commit is contained in:
parent
4ffb3e4e7e
commit
e639c5a549
3 changed files with 18 additions and 2 deletions
|
@ -2658,7 +2658,8 @@ void Application::updateShadowMap() {
|
|||
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||
}
|
||||
|
||||
const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f };
|
||||
//const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f };
|
||||
const GLfloat WORLD_AMBIENT_COLOR[] = { 0.2f, 0.2f, 0.3f };
|
||||
const GLfloat WORLD_DIFFUSE_COLOR[] = { 0.6f, 0.525f, 0.525f };
|
||||
const GLfloat WORLD_SPECULAR_COLOR[] = { 0.94f, 0.94f, 0.737f, 1.0f };
|
||||
|
||||
|
|
|
@ -753,6 +753,7 @@ public:
|
|||
float shininess;
|
||||
float opacity;
|
||||
QString id;
|
||||
model::MaterialPointer _material;
|
||||
};
|
||||
|
||||
class Cluster {
|
||||
|
@ -1715,6 +1716,14 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
|
|||
#endif
|
||||
}
|
||||
material.id = getID(object.properties);
|
||||
|
||||
material._material = model::MaterialPointer(new model::Material());
|
||||
material._material->setEmissive(material.emissive);
|
||||
material._material->setDiffuse(material.diffuse);
|
||||
material._material->setSpecular(material.specular);
|
||||
material._material->setShininess(material.shininess);
|
||||
material._material->setOpacity(material.opacity);
|
||||
|
||||
materials.insert(material.id, material);
|
||||
|
||||
} else if (object.name == "NodeAttribute") {
|
||||
|
@ -2138,6 +2147,8 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
|
|||
for (int j = 0; j < extracted.partMaterialTextures.size(); j++) {
|
||||
if (extracted.partMaterialTextures.at(j).first == materialIndex) {
|
||||
FBXMeshPart& part = extracted.mesh.parts[j];
|
||||
|
||||
part._material = material._material;
|
||||
part.diffuseColor = material.diffuse;
|
||||
part.specularColor = material.specular;
|
||||
part.emissiveColor = material.emissive;
|
||||
|
|
|
@ -83,7 +83,7 @@ void main(void) {
|
|||
float facingLight = step(0.0, diffuse) * shadowAttenuation;
|
||||
|
||||
// compute the base color based on OpenGL lighting model
|
||||
vec3 baseColor = diffuseVal.rgb * (gl_FrontLightModelProduct.sceneColor.rgb +
|
||||
vec3 baseColor = diffuseVal.rgb * (/*gl_FrontLightModelProduct.sceneColor.rgb + */
|
||||
gl_FrontLightProduct[0].ambient.rgb + gl_FrontLightProduct[0].diffuse.rgb * (diffuse * facingLight));
|
||||
|
||||
// compute the specular multiplier (sans exponent)
|
||||
|
@ -93,5 +93,9 @@ void main(void) {
|
|||
// add specular contribution
|
||||
vec4 specularColor = specularVal;
|
||||
gl_FragColor = vec4(baseColor.rgb + pow(specular, specularColor.a * 128.0) * specularColor.rgb, normalVal.a);
|
||||
|
||||
if (gl_FragCoord.x > 1024) {
|
||||
gl_FragColor = vec4( (gl_FrontLightProduct[0].ambient.rgb + gl_FrontLightProduct[0].diffuse.rgb * (diffuse * facingLight)), normalVal.a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue