Code: Alles auswählen
public mat4 GenerateLightSpaceMatrix()
{
//new vec3(-2f, 4.0f, -1.0f)
float near_plane = 1.0f, far_plane = 7.5f;
float left = _camX - 10f;
float right = _camX + 10f;
float top = _camY + 10f;
float bottom = _camY - 10f;
// Könnte auch funktionieren
//float top = _camZ + 10f;
//float bottom = _camZ - 10f;
mat4 lightProjection = mat4.Ortho(left, right, bottom, top, near_plane, far_plane);
mat4 lightView = mat4.LookAt(lightPos, new vec3(0.0f, 0.0f, 0.0f), new vec3(0.0f, 1.0f, 0.0f));
return lightProjection * lightView;
}