浏览代码

Allows overriding lerping behavior on volume components

/main
Thomas 7 年前
当前提交
f1e342f8
共有 2 个文件被更改,包括 23 次插入14 次删除
  1. 21
      ScriptableRenderPipeline/Core/CoreRP/Volume/VolumeComponent.cs
  2. 16
      ScriptableRenderPipeline/Core/CoreRP/Volume/VolumeManager.cs

21
ScriptableRenderPipeline/Core/CoreRP/Volume/VolumeComponent.cs


parameter.OnDisable();
}
// You can override this to do your own blending. Either loop through the `parameters` list
// or reference direct fields (you'll need to cast `state` to your custom type and don't
// forget to use `SetValue` on parameters, do not assign directly to the state object - and
// of course you'll need to check for the `overrideState` manually).
protected internal virtual void Override(VolumeComponent state, float interpFactor)
{
int count = parameters.Count;
for (int i = 0; i < count; i++)
{
var stateParam = state.parameters[i];
var toParam = parameters[i];
// Keep track of the override state for debugging purpose
stateParam.overrideState = toParam.overrideState;
if (toParam.overrideState)
stateParam.Interp(stateParam, toParam, interpFactor);
}
}
public void SetAllOverridesTo(bool state)
{
SetAllOverridesTo(parameters, state);

16
ScriptableRenderPipeline/Core/CoreRP/Volume/VolumeManager.cs


if (!component.active)
continue;
var target = stack.GetComponent(component.GetType());
int count = component.parameters.Count;
for (int i = 0; i < count; i++)
{
var fromParam = target.parameters[i];
var toParam = component.parameters[i];
// Keep track of the override state for debugging purpose
fromParam.overrideState = toParam.overrideState;
if (toParam.overrideState)
fromParam.Interp(fromParam, toParam, interpFactor);
}
var state = stack.GetComponent(component.GetType());
component.Override(state, interpFactor);
}
}

正在加载...
取消
保存