|
|
|
|
|
|
prevViewProjMatrix *= cameraDisplacement; // Now prevViewProjMatrix correctly transforms this frame's camera-relative positionWS
|
|
|
|
} |
|
|
|
|
|
|
|
// Warning: near and far planes appear to be broken.
|
|
|
|
// Warning: near and far planes appear to be broken (or rather far plane seems broken)
|
|
|
|
GeometryUtility.CalculateFrustumPlanes(viewProjMatrix, frustumPlanes); |
|
|
|
|
|
|
|
for (int i = 0; i < 4; i++) |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Near, far.
|
|
|
|
Vector4 forward = (camera.cameraType == CameraType.Reflection) ? camera.worldToCameraMatrix.GetRow(2) : new Vector4(camera.transform.forward.x, camera.transform.forward.y, camera.transform.forward.z, 0.0f); |
|
|
|
Vector3 forward = viewParam.x < 0.0f ? camera.transform.forward : -camera.transform.forward; |
|
|
|
forward = viewParam.x < 0.0f ? forward : -forward; |
|
|
|
frustumPlaneEquations[4] = new Vector4( forward.x, forward.y, forward.z, -Vector3.Dot(forward, relPos) - camera.nearClipPlane); |
|
|
|
frustumPlaneEquations[5] = new Vector4(-forward.x, -forward.y, -forward.z, Vector3.Dot(forward, relPos) + camera.farClipPlane); |
|
|
|
|
|
|
|