|
|
|
|
|
|
|
|
|
|
static void DrawGizmos_CaptureFrustrum(PlanarReflectionProbeUI s, PlanarReflectionProbe d) |
|
|
|
{ |
|
|
|
var farClipPlane = d.captureFarPlane; |
|
|
|
var nearClipPlane = d.captureNearPlane; |
|
|
|
var mat = Matrix4x4.TRS(d.capturePosition, d.captureRotation, Vector3.one); |
|
|
|
var clipToWorld = CameraEditorUtils.GetCameraClipToWorld( |
|
|
|
d.capturePosition, d.captureRotation, |
|
|
|
d.captureNearPlane, d.captureFarPlane, |
|
|
|
90, 1); |
|
|
|
far[0] = new Vector3(0, 0, farClipPlane); // leftBottomFar
|
|
|
|
far[1] = new Vector3(0, 1, farClipPlane); // leftTopFar
|
|
|
|
far[2] = new Vector3(1, 1, farClipPlane); // rightTopFar
|
|
|
|
far[3] = new Vector3(1, 0, farClipPlane); // rightBottomFar
|
|
|
|
for (var i = 0; i < 4; ++i) |
|
|
|
far[i] = mat.MultiplyPoint(far[i]); |
|
|
|
near[0] = new Vector3(0, 0, nearClipPlane); // leftBottomNear
|
|
|
|
near[1] = new Vector3(0, 1, nearClipPlane); // leftTopNear
|
|
|
|
near[2] = new Vector3(1, 1, nearClipPlane); // rightTopNear
|
|
|
|
near[3] = new Vector3(1, 0, nearClipPlane); // rightBottomNear
|
|
|
|
for (var i = 0; i < 4; ++i) |
|
|
|
near[i] = mat.MultiplyPoint(near[i]); |
|
|
|
CameraEditorUtils.GetFrustrumPlaneAt(clipToWorld, d.capturePosition, d.captureFarPlane, far); |
|
|
|
CameraEditorUtils.GetFrustrumPlaneAt(clipToWorld, d.capturePosition, d.captureNearPlane, near); |
|
|
|
|
|
|
|
var c = Gizmos.color; |
|
|
|
Gizmos.color = k_GizmoCamera; |
|
|
|
|
|
|
Gizmos.DrawLine(far[i], far[(i + 1) % 4]); |
|
|
|
Gizmos.DrawLine(near[i], far[i]); |
|
|
|
} |
|
|
|
|
|
|
|
Gizmos.DrawSphere(d.capturePosition, HandleUtility.GetHandleSize(d.capturePosition) * 0.2f); |
|
|
|
Gizmos.color = c; |
|
|
|
} |
|
|
|
} |