当前位置: 首页>>代码示例>>C#>>正文


C# Light.AddCommandBuffer方法代码示例

本文整理汇总了C#中UnityEngine.Light.AddCommandBuffer方法的典型用法代码示例。如果您正苦于以下问题:C# Light.AddCommandBuffer方法的具体用法?C# Light.AddCommandBuffer怎么用?C# Light.AddCommandBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Light的用法示例。


在下文中一共展示了Light.AddCommandBuffer方法的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);
	}
开发者ID:markdion,项目名称:Unity-Projects,代码行数:28,代码来源:AtmosphericScattering.cs

示例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());
    }
开发者ID:FranciscoAlonso,项目名称:VolumetricLights,代码行数:25,代码来源:VolumetricLight.cs


注:本文中的UnityEngine.Light.AddCommandBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。