コード例 #1
0
        public override void Compute(bool selfcompute = false)
        {
            NodeBase n = null;

            if (inPoint.connections.Count != 0)
            {
                n = inPoint.connections[0].outPoint.node;
            }

            if (n != null)
            {
                if (n.GetTexture() != null)
                {
                    source = n.GetTexture();
                    if (n.ressolution != this.ressolution)
                    {
                        ChangeRessolution(n.ressolution.x);
                    }
                }
            }
            if (selfcompute)
            {
                if (source != null && texture != null)
                {
                    if (shader != null)
                    {
                        if (ressolution.x / 8 > 0)
                        {
                            shader.SetTexture(kernel, "Result", texture);
                            shader.SetTexture(kernel, "source", source);
                            shader.SetFloat("ressolution", ressolution.x);
                            shader.SetFloats("tilling", tilling.x, tilling.y);
                            shader.SetFloat("offsetX", offsetX);
                            shader.SetFloat("offsetY", offsetY);
                            shader.SetFloat("scale", scale);
                            shader.SetFloat("angle", angle);
                            shader.SetFloat("globalangle", globalAngle);

                            shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                        }
                    }
                }
            }

            if (outPoint.connections != null)
            {
                for (int i = 0; i < outPoint.connections.Count; i++)
                {
                    outPoint.connections[i].inPoint.node.Compute(true);
                }
            }
        }
コード例 #2
0
        public override void Compute(bool selfcompute = false)
        {
            NodeBase n = null;

            if (inPoint.connections.Count != 0)
            {
                n = inPoint.connections[0].outPoint.node;
            }

            if (n != null)
            {
                if (n.GetTexture() != null)
                {
                    source = n.GetTexture();
                    if (n.ressolution != this.ressolution)
                    {
                        ChangeRessolution(n.ressolution.x);
                    }
                }
            }
            if (selfcompute)
            {
                if (source != null && texture != null)
                {
                    if (shader != null)
                    {
                        if (ressolution.x / 8 > 0)
                        {
                            shader.SetTexture(kernel, "Result", texture);
                            shader.SetTexture(kernel, "source", source);
                            shader.SetFloat("ressolution", ressolution.x);
                            shader.SetFloat("Samples", 16f);
                            shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                        }
                    }
                }
            }

            if (outPoint.connections != null)
            {
                for (int i = 0; i < outPoint.connections.Count; i++)
                {
                    outPoint.connections[i].inPoint.node.Compute(true);
                }
            }
        }
コード例 #3
0
        public override void Compute(bool selfcompute = false)
        {
            if (selfcompute)
            {
                NodeBase n = null;
                if (inRed.connections.Count != 0)
                {
                    n = inRed.connections[0].outPoint.node;
                    R = n.GetTexture();
                }
                if (inGreen.connections.Count != 0)
                {
                    n = inGreen.connections[0].outPoint.node;
                    G = n.GetTexture();
                }
                if (inBlue.connections.Count != 0)
                {
                    n = inBlue.connections[0].outPoint.node;
                    B = n.GetTexture();
                }
                if (inAlpha.connections.Count != 0)
                {
                    n = inAlpha.connections[0].outPoint.node;
                    A = n.GetTexture();
                }

                if (R != null && G != null && B != null && A != null && texture != null)
                {
                    shader.SetTexture(kernel, "Result", texture);
                    shader.SetTexture(kernel, "R", R);
                    shader.SetTexture(kernel, "G", G);
                    shader.SetTexture(kernel, "B", B);
                    shader.SetTexture(kernel, "A", A);
                    shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                }
            }

            if (outPoint.connections != null)
            {
                for (int i = 0; i < outPoint.connections.Count; i++)
                {
                    outPoint.connections[i].inPoint.node.Compute(true);
                }
            }
        }
コード例 #4
0
        public override void Compute(bool selfcompute = false)
        {
            if (selfcompute)
            {
                NodeBase s = null;
                NodeBase w = null;

                if (inSource.connections.Count != 0 && inWarper.connections.Count != 0)
                {
                    s = inSource.connections[0].outPoint.node;
                    w = inWarper.connections[0].outPoint.node;

                    source = s.GetTexture();
                    warper = w.GetTexture();

                    if (s.ressolution == w.ressolution)
                    {
                        if (s.ressolution != ressolution)
                        {
                            ChangeRessolution(s.ressolution.x);
                        }
                        if (ressolution.x / 8 > 0)
                        {
                            if (shader != null)
                            {
                                shader.SetTexture(kernel, "Result", texture);
                                shader.SetTexture(kernel, "source", source);
                                shader.SetTexture(kernel, "warper", warper);
                                shader.SetFloat("ressolution", (float)ressolution.x);
                                shader.SetFloat("strength", strength);
                                shader.SetFloat("angle", angle);
                                shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                            }
                        }
                    }
                }
            }

            if (outPoint.connections != null)
            {
                for (int i = 0; i < outPoint.connections.Count; i++)
                {
                    outPoint.connections[i].inPoint.node.Compute(true);
                }
            }
        }
コード例 #5
0
        public override void Compute(bool selfcompute = false)
        {
            NodeBase n  = null;
            NodeBase n2 = null;

            if (Apoint.connections.Count != 0 && Bpoint.connections.Count != 0)
            {
                n  = Apoint.connections[0].outPoint.node;
                n2 = Bpoint.connections[0].outPoint.node;

                A = n.GetTexture();
                B = n2.GetTexture();
            }

            if (maskPoint.connections.Count != 0)
            {
                NodeBase mask = maskPoint.connections[0].outPoint.node;
                Mask = mask.GetTexture();
            }

            if (selfcompute)
            {
                if (A != null && B != null && texture != null)
                {
                    if (n != null && n2 != null)
                    {
                        if (n.ressolution == n2.ressolution)
                        {
                            if (n.ressolution != ressolution)
                            {
                                ChangeRessolution(n.ressolution.x);
                            }

                            if (ressolution.x / 8 > 0)
                            {
                                switch (mode)
                                {
                                case BlendMode.Multiply:
                                    if (shader != null)
                                    {
                                        kernel = shader.FindKernel("BlendMultiply");
                                        shader.SetTexture(kernel, "Result", texture);
                                        shader.SetTexture(kernel, "A", A);
                                        shader.SetTexture(kernel, "B", B);
                                        shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                                    }
                                    break;

                                case BlendMode.Addition:
                                    kernel = shader.FindKernel("BlendAddition");
                                    shader.SetTexture(kernel, "Result", texture);
                                    shader.SetTexture(kernel, "A", A);
                                    shader.SetTexture(kernel, "B", B);
                                    shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                                    break;

                                case BlendMode.Substraction:
                                    kernel = shader.FindKernel("BlendSubstraction");
                                    shader.SetTexture(kernel, "Result", texture);
                                    shader.SetTexture(kernel, "A", A);
                                    shader.SetTexture(kernel, "B", B);
                                    shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                                    break;

                                case BlendMode.Mask:
                                    if (Mask != null)
                                    {
                                        kernel = shader.FindKernel("BlendMask");
                                        shader.SetTexture(kernel, "Result", texture);
                                        shader.SetTexture(kernel, "A", A);
                                        shader.SetTexture(kernel, "B", B);
                                        shader.SetTexture(kernel, "Mask", Mask);
                                        shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                                    }
                                    break;

                                case BlendMode.Screen:
                                    kernel = shader.FindKernel("BlendScreen");
                                    shader.SetTexture(kernel, "Result", texture);
                                    shader.SetTexture(kernel, "A", A);
                                    shader.SetTexture(kernel, "B", B);
                                    shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                                    break;

                                case BlendMode.Overlay:
                                    kernel = shader.FindKernel("BlendOverlay");
                                    shader.SetTexture(kernel, "Result", texture);
                                    shader.SetTexture(kernel, "A", A);
                                    shader.SetTexture(kernel, "B", B);
                                    shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                                    break;

                                case BlendMode.Max:
                                    kernel = shader.FindKernel("BlendMax");
                                    shader.SetTexture(kernel, "Result", texture);
                                    shader.SetTexture(kernel, "A", A);
                                    shader.SetTexture(kernel, "B", B);
                                    shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                                    break;

                                case BlendMode.Min:
                                    kernel = shader.FindKernel("BlendMin");
                                    shader.SetTexture(kernel, "Result", texture);
                                    shader.SetTexture(kernel, "A", A);
                                    shader.SetTexture(kernel, "B", B);
                                    shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                                    break;

                                case BlendMode.Divide:
                                    kernel = shader.FindKernel("BlendDivide");
                                    shader.SetTexture(kernel, "Result", texture);
                                    shader.SetTexture(kernel, "A", A);
                                    shader.SetTexture(kernel, "B", B);
                                    shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                                    break;

                                case BlendMode.AddSub:
                                    kernel = shader.FindKernel("BlendAddSub");
                                    shader.SetTexture(kernel, "Result", texture);
                                    shader.SetTexture(kernel, "A", A);
                                    shader.SetTexture(kernel, "B", B);
                                    shader.Dispatch(kernel, ressolution.x / 8, ressolution.y / 8, 1);
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            if (outPoint.connections != null)
            {
                for (int i = 0; i < outPoint.connections.Count; i++)
                {
                    outPoint.connections[i].inPoint.node.Compute(true);
                }
            }
        }