| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | namespace DCL.Rendering |
| | 4 | | { |
| | 5 | | /// <summary> |
| | 6 | | /// Group of arguments for configuring the rules of a group of renderers of skinned renderers. |
| | 7 | | /// Used by CullingControllerSettings. |
| | 8 | | /// </summary> |
| | 9 | | [System.Serializable] |
| | 10 | | public class CullingControllerProfile |
| | 11 | | { |
| | 12 | | /// <summary> |
| | 13 | | /// Less than this distance from camera: should be always visible, regardless other checks |
| | 14 | | /// </summary> |
| | 15 | | public float visibleDistanceThreshold; |
| | 16 | |
|
| | 17 | | /// <summary> |
| | 18 | | /// Less than this distance from camera: should always have shadow, regardless other checks |
| | 19 | | /// </summary> |
| | 20 | | public float shadowDistanceThreshold; |
| | 21 | |
|
| | 22 | | /// <summary> |
| | 23 | | /// Avatars with more than this distance from camera: should never have shadow, regardless other checks |
| | 24 | | /// </summary> |
| | 25 | | public float maxShadowDistanceForAvatars; |
| | 26 | |
|
| | 27 | | /// <summary> |
| | 28 | | /// Emissive and bigger than this, should be visible |
| | 29 | | /// </summary> |
| | 30 | | public float emissiveSizeThreshold; |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Opaque and bigger than this, should be visible |
| | 34 | | /// </summary> |
| | 35 | | public float opaqueSizeThreshold; |
| | 36 | |
|
| | 37 | | /// <summary> |
| | 38 | | /// Bigger than this size: has shadow |
| | 39 | | /// </summary> |
| | 40 | | public float shadowRendererSizeThreshold; |
| | 41 | |
|
| | 42 | | /// <summary> |
| | 43 | | /// Bigger than this size: has shadow |
| | 44 | | /// </summary> |
| | 45 | | public float shadowMapProjectionSizeThreshold; // |
| | 46 | |
|
| | 47 | | /// <summary> |
| | 48 | | /// Performs a linear interpolation between the values of two CullingControllerProfiles. |
| | 49 | | /// Used for controlling the settings panel slider. |
| | 50 | | /// </summary> |
| | 51 | | /// <param name="p1">Starting profile</param> |
| | 52 | | /// <param name="p2">Ending profile</param> |
| | 53 | | /// <param name="t">Time value for the linear interpolation.</param> |
| | 54 | | /// <returns>A new CullingControllerProfile with the interpolated values.</returns> |
| | 55 | | public static CullingControllerProfile Lerp(CullingControllerProfile p1, CullingControllerProfile p2, float t) |
| | 56 | | { |
| 0 | 57 | | return new CullingControllerProfile |
| | 58 | | { |
| | 59 | | visibleDistanceThreshold = Mathf.Lerp(p1.visibleDistanceThreshold, p2.visibleDistanceThreshold, t), |
| | 60 | | shadowDistanceThreshold = Mathf.Lerp(p1.shadowDistanceThreshold, p2.shadowDistanceThreshold, t), |
| | 61 | | emissiveSizeThreshold = Mathf.Lerp(p1.emissiveSizeThreshold, p2.emissiveSizeThreshold, t), |
| | 62 | | opaqueSizeThreshold = Mathf.Lerp(p1.opaqueSizeThreshold, p2.opaqueSizeThreshold, t), |
| | 63 | | shadowRendererSizeThreshold = Mathf.Lerp(p1.shadowRendererSizeThreshold, p2.shadowRendererSizeThreshold, |
| | 64 | | shadowMapProjectionSizeThreshold = Mathf.Lerp(p1.shadowMapProjectionSizeThreshold, p2.shadowMapProjectio |
| | 65 | | maxShadowDistanceForAvatars = Mathf.Lerp(p1.maxShadowDistanceForAvatars, p2.maxShadowDistanceForAvatars, |
| | 66 | | }; |
| | 67 | | } |
| | 68 | |
|
| | 69 | | /// <summary> |
| | 70 | | /// Returns a clone of this object. |
| | 71 | | /// </summary> |
| | 72 | | /// <returns>The clone.</returns> |
| 14 | 73 | | public CullingControllerProfile Clone() { return this.MemberwiseClone() as CullingControllerProfile; } |
| | 74 | | } |
| | 75 | | } |