SetGlobalColor() public method

public SetGlobalColor ( int nameID, System.Color value ) : void
nameID int
value System.Color
return void
コード例 #1
0
 static public int SetGlobalColor(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2, typeof(int), typeof(UnityEngine.Color)))
         {
             UnityEngine.Rendering.CommandBuffer self = (UnityEngine.Rendering.CommandBuffer)checkSelf(l);
             System.Int32 a1;
             checkType(l, 2, out a1);
             UnityEngine.Color a2;
             checkType(l, 3, out a2);
             self.SetGlobalColor(a1, a2);
             return(0);
         }
         else if (matchType(l, argc, 2, typeof(string), typeof(UnityEngine.Color)))
         {
             UnityEngine.Rendering.CommandBuffer self = (UnityEngine.Rendering.CommandBuffer)checkSelf(l);
             System.String a1;
             checkType(l, 2, out a1);
             UnityEngine.Color a2;
             checkType(l, 3, out a2);
             self.SetGlobalColor(a1, a2);
             return(0);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
        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);
                }

            }
        }
コード例 #3
0
    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);
    }