Exemplo n.º 1
0
        void Process()
        {
            GLTextuer2D i1 = (GLTextuer2D)first.Input.Data;
            GLTextuer2D i2 = (GLTextuer2D)second.Input.Data;
            GLTextuer2D i3 = null;

            if (mask.HasInput)
            {
                i3 = (GLTextuer2D)mask.Input.Data;
            }

            if (i1 == null || i2 == null)
            {
                return;
            }
            if (i1.Id == 0)
            {
                return;
            }
            if (i2.Id == 0)
            {
                return;
            }

            CreateBufferIfNeeded();

            int   pmode  = (int)mode;
            float palpha = alpha;

            if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Mode"))
            {
                pmode = Convert.ToInt32(ParentGraph.GetParameterValue(Id, "Mode"));
            }
            if (ParentGraph != null && ParentGraph.HasParameterValue(Id, "Alpha"))
            {
                palpha = Convert.ToSingle(ParentGraph.GetParameterValue(Id, "Alpha"));
            }

            processor.TileX     = tileX;
            processor.TileY     = tileY;
            processor.Alpha     = palpha;
            processor.BlendMode = pmode;
            processor.Process(width, height, i1, i2, i3, buffer);
            processor.Complete();

            Updated();
            Output.Data = buffer;
            Output.Changed();
        }
Exemplo n.º 2
0
        void Process()
        {
            if (!first.HasInput || !second.HasInput)
            {
                return;
            }

            GLTextuer2D i1 = (GLTextuer2D)first.Reference.Data;
            GLTextuer2D i2 = (GLTextuer2D)second.Reference.Data;
            GLTextuer2D i3 = null;

            if (mask.HasInput)
            {
                i3 = (GLTextuer2D)mask.Reference.Data;
            }

            if (i1 == null || i2 == null)
            {
                return;
            }
            if (i1.Id == 0)
            {
                return;
            }
            if (i2.Id == 0)
            {
                return;
            }

            CreateBufferIfNeeded();

            processor.TileX     = tileX;
            processor.TileY     = tileY;
            processor.Alpha     = palpha;
            processor.BlendMode = pmode;
            processor.AlphaMode = amode;
            processor.Process(width, height, i1, i2, i3, buffer);
            processor.Complete();

            Output.Data = buffer;
            TriggerTextureChange();
        }
Exemplo n.º 3
0
        protected static bool CombineOutputTypes(OutputType type, float opacity, BlendType blending, Graph previous, Dictionary <OutputType, Node> render, Node mask, BlendProcessor processor)
        {
            if (previous == null || render == null || processor == null)
            {
                return(false);
            }

            Node node = null;

            foreach (string k in previous.OutputNodes)
            {
                Node n = null;
                if (previous.NodeLookup.TryGetValue(k, out n))
                {
                    OutputNode output = n as OutputNode;
                    if (output != null && output.OutType == type)
                    {
                        node = n;
                        break;
                    }
                }
            }

            Node renderLayer = null;

            render.TryGetValue(type, out renderLayer);

            if (node != null && renderLayer != null && renderLayer.GetActiveBuffer() != null && renderLayer.GetActiveBuffer().Id != 0 && node.GetActiveBuffer() != null && node.GetActiveBuffer().Id != 0)
            {
                processor.Alpha      = opacity;
                processor.AlphaMode  = (int)AlphaModeType.Add;
                processor.BlendMode  = (int)blending;
                processor.Luminosity = 1.0f;
                processor.Process(node.Width, node.Height, node.GetActiveBuffer(), renderLayer.GetActiveBuffer(), mask?.GetActiveBuffer(), renderLayer.GetActiveBuffer());
                processor.Complete();
                return(true);
            }

            return(false);
        }