public void LookAt(Vector3 direction, Vector3 lookAt) { Camera.LookAt(lookAt - ClipDistance * Vector3.Normalize(direction), lookAt, direction.X == 0f && direction.Z == 0f ? Vector3.UnitX : Vector3.UnitY); Camera.UpdateViewMatrix(); ShadowTransform = Camera.ViewProj * new Matrix { M11 = 0.5f, M22 = -0.5f, M33 = 1.0f, M41 = 0.5f, M42 = 0.5f, M44 = 1.0f }; }
public bool LookAt(Vector3 direction, Vector3 lookAt) { Camera.LookAt(lookAt - ClipDistance * Vector3.Normalize(direction), lookAt, direction.X == 0f && direction.Z == 0f ? Vector3.UnitX : Vector3.UnitY); Camera.UpdateViewMatrix(); var shadowTransform = Camera.ViewProj * new Matrix { M11 = 0.5f, M22 = -0.5f, M33 = 1.0f, M41 = 0.5f, M42 = 0.5f, M44 = 1.0f }; if (ShadowTransform != shadowTransform) { ShadowTransform = shadowTransform; return(true); } return(false); }