本文整理汇总了C#中UnityEngine.Light.RemoveAllCommandBuffers方法的典型用法代码示例。如果您正苦于以下问题:C# Light.RemoveAllCommandBuffers方法的具体用法?C# Light.RemoveAllCommandBuffers怎么用?C# Light.RemoveAllCommandBuffers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Light
的用法示例。
在下文中一共展示了Light.RemoveAllCommandBuffers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureHookedLightSource
void EnsureHookedLightSource(Light light) {
if(!light)
return;
if(light.commandBufferCount == 2)
return;
//Debug.Log("Hooking scattering command buffers on light source: " + light.name);
// NOTE: This doesn't really play nicely with other users of light events.
// Currently not an issue since this code was written pre-5.1 (and light events
// are a new feature in 5.1), but might need a proper solution in the future.
light.RemoveAllCommandBuffers();
if(m_occlusionCmdAfterShadows != null)
m_occlusionCmdAfterShadows.Dispose();
if(m_occlusionCmdBeforeScreen != null)
m_occlusionCmdBeforeScreen.Dispose();
m_occlusionCmdAfterShadows = new UnityEngine.Rendering.CommandBuffer();
m_occlusionCmdAfterShadows.name = "Scatter Occlusion Pass 1";
m_occlusionCmdAfterShadows.SetGlobalTexture("u_CascadedShadowMap", new UnityEngine.Rendering.RenderTargetIdentifier(UnityEngine.Rendering.BuiltinRenderTextureType.CurrentActive));
m_occlusionCmdBeforeScreen = new UnityEngine.Rendering.CommandBuffer();
m_occlusionCmdBeforeScreen.name = "Scatter Occlusion Pass 2";
light.AddCommandBuffer(UnityEngine.Rendering.LightEvent.AfterShadowMap, m_occlusionCmdAfterShadows);
light.AddCommandBuffer(UnityEngine.Rendering.LightEvent.BeforeScreenspaceMask, m_occlusionCmdBeforeScreen);
}
示例2: Start
/// <summary>
///
/// </summary>
void Start()
{
_commandBuffer = new CommandBuffer();
_commandBuffer.name = "Light Command Buffer";
_cascadeShadowCommandBuffer = new CommandBuffer();
_cascadeShadowCommandBuffer.name = "Dir Light Command Buffer";
_cascadeShadowCommandBuffer.SetGlobalTexture("_CascadeShadowMapTexture", new UnityEngine.Rendering.RenderTargetIdentifier(UnityEngine.Rendering.BuiltinRenderTextureType.CurrentActive));
_light = GetComponent<Light>();
_light.RemoveAllCommandBuffers();
if(_light.type == LightType.Directional)
{
_light.AddCommandBuffer(LightEvent.BeforeScreenspaceMask, _commandBuffer);
_light.AddCommandBuffer(LightEvent.AfterShadowMap, _cascadeShadowCommandBuffer);
}
else
_light.AddCommandBuffer(LightEvent.AfterShadowMap, _commandBuffer);
_material = new Material(Shader.Find("Sandbox/VolumetricLight")); // new Material(VolumetricLightRenderer.GetLightMaterial());
}