// Token: 0x060008B0 RID: 2224 RVA: 0x000382F0 File Offset: 0x000364F0 private static Matrix4x4 CalculateObliqueMatrix(Matrix4x4 projection, Vector4 clipPlane) { Vector4 b = projection.inverse * new Vector4(ReflectionFx.sgn(clipPlane.x), ReflectionFx.sgn(clipPlane.y), 1f, 1f); Vector4 vector = clipPlane * (2f / Vector4.Dot(clipPlane, b)); projection[2] = vector.x - projection[3]; projection[6] = vector.y - projection[7]; projection[10] = vector.z - projection[11]; projection[14] = vector.w - projection[15]; return(projection); }
// Token: 0x060008AB RID: 2219 RVA: 0x00038018 File Offset: 0x00036218 private void RenderReflectionFor(Camera cam, Camera reflectCamera) { if (reflectCamera == null) { return; } this.SaneCameraSettings(reflectCamera); reflectCamera.backgroundColor = this.clearColor; reflectCamera.enabled = true; GL.SetRevertBackfacing(true); Transform transform = this.reflectiveSurfaceHeight; Vector3 eulerAngles = cam.transform.eulerAngles; reflectCamera.transform.eulerAngles = new Vector3(-eulerAngles.x, eulerAngles.y, eulerAngles.z); reflectCamera.transform.position = cam.transform.position; Vector3 position = transform.transform.position; position.y = transform.position.y; Vector3 up = transform.transform.up; float w = -Vector3.Dot(up, position) - this.clipPlaneOffset; Vector4 plane = new Vector4(up.x, up.y, up.z, w); Matrix4x4 matrix4x = Matrix4x4.zero; matrix4x = ReflectionFx.CalculateReflectionMatrix(matrix4x, plane); this.oldpos = cam.transform.position; Vector3 position2 = matrix4x.MultiplyPoint(this.oldpos); reflectCamera.worldToCameraMatrix = cam.worldToCameraMatrix * matrix4x; Vector4 clipPlane = this.CameraSpacePlane(reflectCamera, position, up, 1f); Matrix4x4 matrix4x2 = cam.projectionMatrix; matrix4x2 = ReflectionFx.CalculateObliqueMatrix(matrix4x2, clipPlane); reflectCamera.projectionMatrix = matrix4x2; reflectCamera.transform.position = position2; Vector3 eulerAngles2 = cam.transform.eulerAngles; reflectCamera.transform.eulerAngles = new Vector3(-eulerAngles2.x, eulerAngles2.y, eulerAngles2.z); reflectCamera.RenderWithShader(this.replacementShader, "Reflection"); GL.SetRevertBackfacing(false); }