您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
59 行
1.6 KiB
59 行
1.6 KiB
namespace UnityEngine.Experimental.Rendering.HDPipeline
|
|
{
|
|
[ExecuteInEditMode]
|
|
[AddComponentMenu("Rendering/Homogeneous Density Volume", 1100)]
|
|
public class HomogeneousDensityVolume : MonoBehaviour
|
|
{
|
|
public DensityVolumeParameters parameters = new DensityVolumeParameters();
|
|
|
|
private void Awake()
|
|
{
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
}
|
|
|
|
private void OnValidate()
|
|
{
|
|
parameters.Constrain();
|
|
}
|
|
|
|
void OnDrawGizmos()
|
|
{
|
|
if (parameters.IsLocalVolume())
|
|
{
|
|
Gizmos.color = parameters.albedo;
|
|
Gizmos.matrix = transform.localToWorldMatrix;
|
|
Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
|
|
}
|
|
}
|
|
|
|
// Returns NULL if a global fog component does not exist, or is not enabled.
|
|
public static HomogeneousDensityVolume GetGlobalHomogeneousDensityVolume()
|
|
{
|
|
HomogeneousDensityVolume globalVolume = null;
|
|
|
|
HomogeneousDensityVolume[] volumes = FindObjectsOfType(typeof(HomogeneousDensityVolume)) as HomogeneousDensityVolume[];
|
|
|
|
foreach (HomogeneousDensityVolume volume in volumes)
|
|
{
|
|
if (volume.enabled && !volume.parameters.IsLocalVolume())
|
|
{
|
|
globalVolume = volume;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return globalVolume;
|
|
}
|
|
}
|
|
} // UnityEngine.Experimental.Rendering.HDPipeline
|