Example #1
0
        public static CommandBufferCanvas.RenderDraw fill0(CommandBufferCanvas.RenderLayer layer, MeshMesh mesh)
        {
            Vector4 viewport = layer.viewport;
            var     mat      = _fill0Mat.getMaterial(layer.ignoreClip);

            var pass  = 0;
            var props = new MaterialPropertyBlock();

            props.SetVector("_viewport", viewport);

            return(new CommandBufferCanvas.RenderDraw {
                mesh = mesh,
                pass = pass,
                material = mat,
                properties = props,
            });
        }
Example #2
0
        public static CommandBufferCanvas.RenderDraw convexFill(CommandBufferCanvas.RenderLayer layer, Paint paint,
                                                                MeshMesh mesh)
        {
            Vector4 viewport = layer.viewport;
            Matrix3 ctm      = layer.states[layer.states.Count - 1].matrix;

            var mat = _convexFillMat.getMaterial(paint.blendMode, layer.ignoreClip);

            _getShaderPassAndProps(viewport, ctm, paint, 1.0f, out var pass, out var props);

            return(new CommandBufferCanvas.RenderDraw {
                mesh = mesh,
                pass = pass,
                material = mat,
                properties = props,
            });
        }
Example #3
0
        public static CommandBufferCanvas.RenderDraw stencilClear(
            CommandBufferCanvas.RenderLayer layer, MeshMesh mesh)
        {
            Vector4 viewport = layer.viewport;
            var     mat      = _stencilMat;

            var pass  = 0;
            var props = new MaterialPropertyBlock();

            props.SetVector("_viewport", viewport);

            return(new CommandBufferCanvas.RenderDraw {
                mesh = mesh,
                pass = pass,
                material = mat,
                properties = props,
            });
        }
Example #4
0
        public static CommandBufferCanvas.RenderDraw texAlpha(CommandBufferCanvas.RenderLayer layer, Paint paint,
                                                              MeshMesh mesh, Texture tex)
        {
            Vector4 viewport = layer.viewport;
            Matrix3 ctm      = layer.states[layer.states.Count - 1].matrix;

            var mat = _texMat.getMaterial(paint.blendMode, layer.ignoreClip);

            _getShaderPassAndProps(viewport, ctm, paint, 1.0f, out var pass, out var props);
            props.SetTexture("_tex", tex);
            props.SetInt("_texMode", 2); // alpha only

            return(new CommandBufferCanvas.RenderDraw {
                mesh = mesh,
                pass = pass,
                material = mat,
                properties = props,
            });
        }
Example #5
0
        public static CommandBufferCanvas.RenderDraw tex(CommandBufferCanvas.RenderLayer layer, Paint paint,
                                                         MeshMesh mesh, Image image)
        {
            Vector4 viewport = layer.viewport;
            Matrix3 ctm      = layer.states[layer.states.Count - 1].matrix;

            var mat = _texMat.getMaterial(paint.blendMode, layer.ignoreClip);

            _getShaderPassAndProps(viewport, ctm, paint, 1.0f, out var pass, out var props);
            props.SetTexture("_tex", image.texture);
            props.SetInt("_texMode", image.texture is RenderTexture ? 1 : 0); // pre alpha if RT else post alpha

            return(new CommandBufferCanvas.RenderDraw {
                mesh = mesh,
                pass = pass,
                material = mat,
                properties = props,
                image = image, // keep a reference to avoid GC.
            });
        }
Example #6
0
        public static CommandBufferCanvas.RenderDraw maskFilter(CommandBufferCanvas.RenderLayer layer, MeshMesh mesh,
                                                                CommandBufferCanvas.RenderLayer renderLayer, float radius, Vector2 imgInc, float[] kernel)
        {
            Vector4 viewport = layer.viewport;
            var     mat      = _filterMat;

            var pass  = 0;
            var props = new MaterialPropertyBlock();

            props.SetVector("_viewport", viewport);

            props.SetFloat("_mf_radius", radius);
            props.SetVector("_mf_imgInc", imgInc);
            props.SetFloatArray("_mf_kernel", kernel);

            return(new CommandBufferCanvas.RenderDraw {
                mesh = mesh,
                pass = pass,
                material = mat,
                properties = props,
                layer = renderLayer,
            });
        }