Beispiel #1
0
 public void UpdateBlendConstants(MgColor4f blendConstants)
 {
     if (!mPastBlendConstants.Equals(blendConstants))
     {
         mBlend.SetBlendConstants(blendConstants);
         mPastBlendConstants = blendConstants;
     }
 }
Beispiel #2
0
        public void CmdSetBlendConstants(MgColor4f blendConstants)
        {
            var color = new float[4];

            color[0] = blendConstants.R;
            color[1] = blendConstants.G;
            color[2] = blendConstants.B;
            color[3] = blendConstants.A;

            // TODO : figure a way to directly pass in
            Interops.vkCmdSetBlendConstants(this.Handle, color);
        }
Beispiel #3
0
        void PopulateColorBlend(MgPipelineColorBlendStateCreateInfo colorBlend)
        {
            ColorBlendEnums = new GLGraphicsPipelineBlendColorState();
            if (colorBlend != null)
            {
                BlendConstants = colorBlend.BlendConstants;

                ColorBlendEnums.LogicOpEnable = colorBlend.LogicOpEnable;
                ColorBlendEnums.LogicOp       = colorBlend.LogicOp;

                if (colorBlend.Attachments != null)
                {
                    var colorAttachments = new GLGraphicsPipelineBlendColorAttachmentState[colorBlend.Attachments.Length];
                    for (uint i = 0; i < colorBlend.Attachments.Length; ++i)
                    {
                        var attachment = colorBlend.Attachments[i];

                        colorAttachments[i] = new GLGraphicsPipelineBlendColorAttachmentState {
                            BlendEnable         = attachment.BlendEnable,
                            SrcColorBlendFactor = attachment.SrcColorBlendFactor,
                            DstColorBlendFactor = attachment.DstColorBlendFactor,
                            ColorBlendOp        = attachment.ColorBlendOp,
                            SrcAlphaBlendFactor = attachment.SrcAlphaBlendFactor,
                            DstAlphaBlendFactor = attachment.DstAlphaBlendFactor,
                            AlphaBlendOp        = attachment.AlphaBlendOp,
                            ColorWriteMask      = attachment.ColorWriteMask,
                        };
                    }
                    ColorBlendEnums.Attachments = colorAttachments;
                }
                else
                {
                    ColorBlendEnums.Attachments = new GLGraphicsPipelineBlendColorAttachmentState[] { };
                }
            }
            else
            {
                BlendConstants = new MgColor4f(0f, 0f, 0f, 0f);
                ColorBlendEnums.Attachments = new GLGraphicsPipelineBlendColorAttachmentState[] { };

                ColorBlendEnums.LogicOpEnable = false;
                ColorBlendEnums.LogicOp       = MgLogicOp.COPY;
            }
        }
Beispiel #4
0
        void InitializeColorBlending(MgPipelineColorBlendStateCreateInfo colorBlend)
        {
            if (colorBlend != null)
            {
                BlendConstants = colorBlend.BlendConstants;

                if (colorBlend.Attachments != null)
                {
                    int arrayLength      = colorBlend.Attachments.Length;
                    var colorAttachments = new AmtBlendColorAttachmentRecord[arrayLength];
                    for (uint i = 0; i < arrayLength; ++i)
                    {
                        var attachment = colorBlend.Attachments[i];

                        colorAttachments[i] = new AmtBlendColorAttachmentRecord
                        {
                            IsBlendingEnabled           = attachment.BlendEnable,
                            SourceRgbBlendFactor        = TranslateBlendFactor(attachment.SrcColorBlendFactor),
                            DestinationRgbBlendFactor   = TranslateBlendFactor(attachment.DstColorBlendFactor),
                            RgbBlendOperation           = TranslateBlendOperation(attachment.ColorBlendOp),
                            SourceAlphaBlendFactor      = TranslateBlendFactor(attachment.SrcAlphaBlendFactor),
                            DestinationAlphaBlendFactor = TranslateBlendFactor(attachment.DstAlphaBlendFactor),
                            AlphaBlendOperation         = TranslateBlendOperation(attachment.AlphaBlendOp),
                            ColorWriteMask = TranslateColorWriteMask(attachment.ColorWriteMask),
                        };
                    }
                    Attachments = colorAttachments;
                }
                else
                {
                    Attachments = new AmtBlendColorAttachmentRecord[] { };
                }
            }
            else
            {
                BlendConstants = new MgColor4f(0f, 0f, 0f, 0f);
                Attachments    = new AmtBlendColorAttachmentRecord[] { };
            }
        }
Beispiel #5
0
 public void SetBlendConstants(MgColor4f blendConstants)
 {
     GL.BlendColor(blendConstants.R, blendConstants.G, blendConstants.B, blendConstants.A);
 }
Beispiel #6
0
 public void SetClearColor(MgColor4f clearValue)
 {
     throw new NotImplementedException();
 }
Beispiel #7
0
 public void SetBlendConstants(MgColor4f blendConstants)
 {
 }
Beispiel #8
0
 public void CmdSetBlendConstants(MgColor4f blendConstants)
 {
     throw new NotImplementedException();
 }
Beispiel #9
0
 public void CmdSetBlendConstants(MgColor4f blendConstants)
 {
     mCommandEncoder.Graphics.SetBlendConstants(blendConstants);
 }
Beispiel #10
0
 public void SetClearColor(MgColor4f clearValue)
 {
     GL.ClearColor(clearValue.R, clearValue.G, clearValue.B, clearValue.A);
 }