Updated TinyRenderer intensity paramater.

Switched from ranging from 0 to 1 - ambient to -1 * (1-ambient) to (1-ambient).
This commit is contained in:
Ian Wilkes
2016-09-02 09:52:45 -07:00
parent 21c60c66ec
commit ba583feb7f

View File

@@ -70,12 +70,9 @@ struct Shader : public IShader {
Vec3f bn = (varying_nrm*bar).normalize();
Vec2f uv = varying_uv*bar;
//float diff = 1;//full-bright
float ambient = 0.7;
//float diff = ambient+b3Min(b3Max(0.f, bn*light_dir_world),(1-ambient));
float diff = ambient+b3Min(b3Max(0.f, bn*m_light_dir_local),(1-ambient));
//float diff = b3Max(0.f, n*m_light_dir_local);
color = m_model->diffuse(uv)*diff;
float intensity = ambient + (1-ambient)*b3Min(b3Max(bn*m_light_dir_local, -1.f), 1.f);
color = m_model->diffuse(uv)*intensity;
//warning: bgra color is swapped to rgba to upload texture
color.bgra[0] *= m_colorRGBA[0];
@@ -292,5 +289,3 @@ void TinyRenderer::renderObject(TinyRenderObjectData& renderData)
}
}