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


C# CommandBuffer.SetGlobalColor方法代码示例

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


在下文中一共展示了CommandBuffer.SetGlobalColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CloneToBuffer

        private void CloneToBuffer(Material mat, CommandBuffer buf)
        {
            foreach (KeyValuePair<object, object> field in cache)
            {
                object obj = field.Value;
                //float
                int id = (int)field.Key;
                if (obj.GetType() == typeof(float))
                {
                    float value = mat.GetFloat(id);
                    buf.SetGlobalFloat(id, value);
                }
                //Color
                else if (obj.GetType() == typeof(Color))
                {
                    Color value = mat.GetColor(id);
                    buf.SetGlobalColor(id, value);
                }
                //Color32
                else if (obj.GetType() == typeof(Color32))
                {
                    Color value = mat.GetColor(id);
                    buf.SetGlobalColor(id, value);
                }//Vector2
                else if (obj.GetType() == typeof(Vector2))
                {
                    Vector4 value = mat.GetVector(id);
                    buf.SetGlobalVector(id, value);
                }
                //Vector3
                else if (obj.GetType() == typeof(Vector3))
                {
                    Vector4 value = mat.GetVector(id);
                    buf.SetGlobalVector(id, value);
                }
                //Vector4
                else if (obj.GetType() == typeof(Vector4))
                {
                    Vector4 value = mat.GetVector(id);
                    buf.SetGlobalVector(id, value);
                }
                //Matrix
                else if (obj.GetType() == typeof(Matrix4x4))
                {
                    Matrix4x4 value = mat.GetMatrix(id);
                    buf.SetGlobalMatrix(id, value);
                }

            }
        }
开发者ID:Kerbas-ad-astra,项目名称:EnvironmentalVisualEnhancements,代码行数:50,代码来源:MaterialManager.cs

示例2: CreateCommandBuffers

    private void CreateCommandBuffers()
    {
        m_renderCmdBuffer = new CommandBuffer();
        m_renderCmdBuffer.name = "Highlights: Drawing Objects";

        // Drawing objects to the buffer
        m_renderCmdBuffer.SetRenderTarget(m_colorRT, BuiltinRenderTextureType.CameraTarget);
        m_renderCmdBuffer.ClearRenderTarget(false, true, Color.clear);

        var pass = m_selectionType == HighlightType.Glow ? HighlightPass.MarkStencilArea : HighlightPass.DrawSolid;
        foreach(var hObject in m_renderers)
        {
            m_renderCmdBuffer.SetGlobalColor("_Color", hObject.Value);
            m_renderCmdBuffer.SetGlobalFloat("_Cutoff",  m_cutoffValue * 0.5f);
            m_renderCmdBuffer.DrawRenderer(hObject.Key, m_highlightMaterial, 0, (int) pass);
        }
            
        foreach(var hObject in m_renderers)
        {
            m_renderCmdBuffer.SetGlobalColor("_Color", hObject.Value);
            m_renderCmdBuffer.DrawRenderer(hObject.Key, m_highlightMaterial, 0, (int) HighlightPass.ExtrudeOutline);
        }

        var drawEvent = GetCameraDrawEvent();
        m_camera.AddCommandBuffer(drawEvent, m_renderCmdBuffer);
    }
开发者ID:BubbleRap,项目名称:ExploreTheDarkness,代码行数:26,代码来源:HighlightsImageEffect.cs


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