您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
59 行
2.1 KiB
59 行
2.1 KiB
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering;
|
|
|
|
namespace UnityEngine.Experimental.Rendering.HDPipeline
|
|
{
|
|
// This enum is just here to centralize UniqueID values for skies provided with HDRP
|
|
public enum SkyType
|
|
{
|
|
HDRISky = 1,
|
|
ProceduralSky = 2
|
|
}
|
|
|
|
// Keep this class first in the file. Otherwise it seems that the script type is not registered properly.
|
|
[Serializable]
|
|
public sealed class VisualEnvironment : VolumeComponent
|
|
{
|
|
public IntParameter skyType = new IntParameter(0);
|
|
public FogTypeParameter fogType = new FogTypeParameter(FogType.None);
|
|
|
|
public void PushFogShaderParameters(HDCamera hdCamera, CommandBuffer cmd)
|
|
{
|
|
if (!hdCamera.frameSettings.enableAtmosphericScattering)
|
|
{
|
|
AtmosphericScattering.PushNeutralShaderParameters(cmd);
|
|
return;
|
|
}
|
|
|
|
switch (fogType.value)
|
|
{
|
|
case FogType.None:
|
|
{
|
|
AtmosphericScattering.PushNeutralShaderParameters(cmd);
|
|
break;
|
|
}
|
|
case FogType.Linear:
|
|
{
|
|
var fogSettings = VolumeManager.instance.stack.GetComponent<LinearFog>();
|
|
fogSettings.PushShaderParameters(hdCamera, cmd);
|
|
break;
|
|
}
|
|
case FogType.Exponential:
|
|
{
|
|
var fogSettings = VolumeManager.instance.stack.GetComponent<ExponentialFog>();
|
|
fogSettings.PushShaderParameters(hdCamera, cmd);
|
|
break;
|
|
}
|
|
case FogType.Volumetric:
|
|
{
|
|
var fogSettings = VolumeManager.instance.stack.GetComponent<VolumetricFog>();
|
|
fogSettings.PushShaderParameters(hdCamera, cmd);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|