Julien Ignace
8 年前
当前提交
eaf661ba
共有 6 个文件被更改,包括 144 次插入 和 131 次删除
-
17Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
-
28Assets/ScriptableRenderLoop/HDRenderLoop/Sky/HDRISky/HDRISkyRenderer.cs
-
35Assets/ScriptableRenderLoop/HDRenderLoop/Sky/ProceduralSky/ProceduralSkyRenderer.cs
-
68Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyManager.cs
-
104Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyParameters.cs
-
23Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyRenderer.cs
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.ScriptableRenderLoop; |
|||
|
|||
[ExecuteInEditMode] |
|||
public class SkyParameters : MonoBehaviour |
|||
namespace UnityEngine.Experimental.ScriptableRenderLoop |
|||
public float rotation = 0.0f; |
|||
public float exposure = 0.0f; |
|||
public float multiplier = 1.0f; |
|||
public SkyResolution resolution = SkyResolution.SkyResolution256; |
|||
[ExecuteInEditMode] |
|||
public class SkyParameters : MonoBehaviour |
|||
{ |
|||
public float rotation = 0.0f; |
|||
public float exposure = 0.0f; |
|||
public float multiplier = 1.0f; |
|||
public SkyResolution resolution = SkyResolution.SkyResolution256; |
|||
private FieldInfo[] m_Properties; |
|||
private FieldInfo[] m_Properties; |
|||
HDRenderLoop GetHDRenderLoop() |
|||
{ |
|||
HDRenderLoop renderLoop = UnityEngine.Rendering.GraphicsSettings.GetRenderPipeline() as HDRenderLoop; |
|||
if (renderLoop == null) |
|||
HDRenderLoop GetHDRenderLoop() |
|||
Debug.LogWarning("SkyParameters component can only be used with HDRenderLoop custom RenderPipeline."); |
|||
return null; |
|||
} |
|||
HDRenderLoop renderLoop = UnityEngine.Rendering.GraphicsSettings.GetRenderPipeline() as HDRenderLoop; |
|||
if (renderLoop == null) |
|||
{ |
|||
Debug.LogWarning("SkyParameters component can only be used with HDRenderLoop custom RenderPipeline."); |
|||
return null; |
|||
} |
|||
return renderLoop; |
|||
} |
|||
return renderLoop; |
|||
} |
|||
protected void OnEnable() |
|||
{ |
|||
HDRenderLoop renderLoop = GetHDRenderLoop(); |
|||
if(renderLoop == null) |
|||
protected void OnEnable() |
|||
return; |
|||
} |
|||
HDRenderLoop renderLoop = GetHDRenderLoop(); |
|||
if (renderLoop == null) |
|||
{ |
|||
return; |
|||
} |
|||
// Enumerate properties in order to compute the hash more quickly later on.
|
|||
m_Properties = GetType() |
|||
.GetFields(BindingFlags.Public | BindingFlags.Instance) |
|||
.ToArray(); |
|||
// Enumerate properties in order to compute the hash more quickly later on.
|
|||
m_Properties = GetType() |
|||
.GetFields(BindingFlags.Public | BindingFlags.Instance) |
|||
.ToArray(); |
|||
if (renderLoop.skyParameters == null) |
|||
renderLoop.skyParameters = this; |
|||
else if(renderLoop.skyParameters != this) |
|||
Debug.LogWarning("Tried to setup another SkyParameters component although there is already one enabled."); |
|||
} |
|||
if (renderLoop.skyParameters == null) |
|||
renderLoop.skyParameters = this; |
|||
else if (renderLoop.skyParameters != this) |
|||
Debug.LogWarning("Tried to setup another SkyParameters component although there is already one enabled."); |
|||
} |
|||
protected void OnDisable() |
|||
{ |
|||
HDRenderLoop renderLoop = GetHDRenderLoop(); |
|||
if (renderLoop == null) |
|||
protected void OnDisable() |
|||
return; |
|||
} |
|||
HDRenderLoop renderLoop = GetHDRenderLoop(); |
|||
if (renderLoop == null) |
|||
{ |
|||
return; |
|||
} |
|||
if (renderLoop.skyParameters == this) |
|||
renderLoop.skyParameters = null; |
|||
} |
|||
// Reset the current sky parameter on the render loop
|
|||
if (renderLoop.skyParameters == this) |
|||
renderLoop.skyParameters = null; |
|||
} |
|||
public int GetHash() |
|||
{ |
|||
unchecked |
|||
public int GetHash() |
|||
int hash = 13; |
|||
foreach (var p in m_Properties) |
|||
unchecked |
|||
System.Object obj = p.GetValue(this); |
|||
if(obj != null) // Sometimes it can be a null reference.
|
|||
hash = hash * 23 + obj.GetHashCode(); |
|||
int hash = 13; |
|||
foreach (var p in m_Properties) |
|||
{ |
|||
System.Object obj = p.GetValue(this); |
|||
if (obj != null) // Sometimes it can be a null reference.
|
|||
hash = hash * 23 + obj.GetHashCode(); |
|||
} |
|||
return hash; |
|||
return hash; |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue