private void EnqueueAllRenderSteps() { ProbeRenderSteps allRenderSteps = ProbeRenderStepsExt.FromProbeType(type); if (m_RemainingRenderSteps != allRenderSteps) { m_HasPendingRenderRequest = true; } }
/// <summary> /// Generate the camera render settings and camera position to use to render a probe. /// </summary> /// <param name="settings">The probe settings to use.</param> /// <param name="position">The probe position to use.</param> /// <param name="cameras">Will receives the camera settings.</param> /// <param name="cameraPositions">Will receives the camera position settings.</param> /// <param name="cameraCubeFaces">Will receive the camera cube face settings.</param> /// <param name="overrideSceneCullingMask">Override of the scene culling mask.</param> /// <param name="renderSteps">The rendering steps to perform for this probe.</param> /// <param name="forceFlipY">Whether to force the Y axis flipping.</param> /// <param name="referenceFieldOfView">The reference field of view.</param> /// <param name="referenceAspect">The reference aspect ratio.</param> public static void GenerateRenderingSettingsFor( ProbeSettings settings, ProbeCapturePositionSettings position, List <CameraSettings> cameras, List <CameraPositionSettings> cameraPositions, List <CubemapFace> cameraCubeFaces, ulong overrideSceneCullingMask, ProbeRenderSteps renderSteps, bool forceFlipY = false, float referenceFieldOfView = 90, float referenceAspect = 1 ) { // Copy settings ComputeCameraSettingsFromProbeSettings( settings, position, out var cameraSettings, out var cameraPositionSettings, overrideSceneCullingMask, referenceFieldOfView, referenceAspect ); if (forceFlipY) { cameraSettings.flipYMode = HDAdditionalCameraData.FlipYMode.ForceFlipY; } switch (settings.type) { case ProbeSettings.ProbeType.PlanarProbe: { cameras.Add(cameraSettings); cameraPositions.Add(cameraPositionSettings); cameraCubeFaces.Add(CubemapFace.Unknown); break; } case ProbeSettings.ProbeType.ReflectionProbe: { for (int i = 0; i < 6; ++i) { CubemapFace face = (CubemapFace)i; if (!renderSteps.HasCubeFace(face)) { continue; } var cameraPositionCopy = cameraPositionSettings; cameraPositionCopy.rotation = cameraPositionCopy.rotation * Quaternion.Euler( s_GenerateRenderingSettingsFor_Rotations[i] ); cameras.Add(cameraSettings); cameraPositions.Add(cameraPositionCopy); cameraCubeFaces.Add(face); } break; } } }
internal ProbeRenderSteps NextRenderSteps() { if (m_RemainingRenderSteps.IsNone() && m_HasPendingRenderRequest) { m_RemainingRenderSteps = ProbeRenderStepsExt.FromProbeType(type); m_HasPendingRenderRequest = false; } if (type == ProbeSettings.ProbeType.ReflectionProbe) { // pick one bit or all remaining bits ProbeRenderSteps nextSteps = timeSlicing ? m_RemainingRenderSteps.LowestSetBit() : m_RemainingRenderSteps; m_RemainingRenderSteps &= ~nextSteps; return(nextSteps); } else { // always render the full planar reflection m_RemainingRenderSteps = ProbeRenderSteps.None; return(ProbeRenderSteps.PlanarProbeMask); } }
/// <summary> /// Test if the bit for the given cubemap face is set. /// </summary> /// <param name="steps">The probe rendering steps.</param> /// <param name="face">The cubemap face.</param> /// <returns>True if the cubemap face bit is set, false otherwise.</returns> public static bool HasCubeFace(this ProbeRenderSteps steps, CubemapFace face) { return(steps.HasFlag(ProbeRenderStepsExt.FromCubeFace(face))); }
/// <summary> /// Test if any bits are set. /// </summary> /// <param name="steps">The probe rendering steps.</param> /// <returns>True if any bits are set, false otherwise.</returns> public static bool IsNone(this ProbeRenderSteps steps) { return(steps == ProbeRenderSteps.None); }
internal void RepeatRenderSteps(ProbeRenderSteps renderSteps) { m_RemainingRenderSteps |= renderSteps; }
/// <summary> /// Extract the lowest set bit. /// </summary> /// <param name="steps">The probe rendering steps.</param> /// <returns>The lowest set bit, or None.</returns> public static ProbeRenderSteps LowestSetBit(this ProbeRenderSteps steps) { int bits = (int)steps; return((ProbeRenderSteps)(bits & -bits)); }