Skip to content

Instantly share code, notes, and snippets.

@y-yu
Created December 2, 2013 15:16
Show Gist options
  • Save y-yu/7751010 to your computer and use it in GitHub Desktop.
Save y-yu/7751010 to your computer and use it in GitHub Desktop.
unko
void CalcLambertModel(float outColor[3], const float ViewDir[3], const float Normal[3])
{
float cos = Vec3Dot(g_LightDir, Normal) / ( Vec3Norm(g_LightDir) * Vec3Norm(Normal) );
Vec3Set(outColor,
g_AmbientColor[0] + g_LightColor[0] * g_DiffuseColor[0] * cos,
g_AmbientColor[1] + g_LightColor[1] * g_DiffuseColor[1] * cos,
g_AmbientColor[2] + g_LightColor[2] * g_DiffuseColor[2] * cos);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment