您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
57 行
1.5 KiB
57 行
1.5 KiB
namespace UnityEngine.Experimental.Rendering.HDPipeline
|
|
{
|
|
[ExecuteInEditMode]
|
|
[AddComponentMenu("RenderPipeline/High Definition/Homogenous Fog", -1)]
|
|
public class HomogeneousFog : MonoBehaviour
|
|
{
|
|
public VolumeParameters volumeParameters = new VolumeParameters();
|
|
|
|
private void Awake()
|
|
{
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
}
|
|
|
|
private void OnValidate()
|
|
{
|
|
volumeParameters.Constrain();
|
|
}
|
|
|
|
void OnDrawGizmos()
|
|
{
|
|
if (volumeParameters != null && !volumeParameters.IsVolumeUnbounded())
|
|
{
|
|
Gizmos.DrawWireCube(volumeParameters.bounds.center, volumeParameters.bounds.size);
|
|
}
|
|
}
|
|
|
|
// Returns NULL if a global fog component does not exist, or is not enabled.
|
|
public static HomogeneousFog GetGlobalFogComponent()
|
|
{
|
|
HomogeneousFog globalFogComponent = null;
|
|
|
|
HomogeneousFog[] fogComponents = FindObjectsOfType(typeof(HomogeneousFog)) as HomogeneousFog[];
|
|
|
|
foreach (HomogeneousFog fogComponent in fogComponents)
|
|
{
|
|
if (fogComponent.enabled && fogComponent.volumeParameters.IsVolumeUnbounded())
|
|
{
|
|
globalFogComponent = fogComponent;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return globalFogComponent;
|
|
}
|
|
}
|
|
} // UnityEngine.Experimental.Rendering.HDPipeline
|