Ejemplo n.º 1
0
        public override void PrePaint(PlaytimePainter pntr, BrushConfig br, StrokeVector st)
        {
            var v4 = new Vector4(st.unRepeatedUV.x, st.unRepeatedUV.y, Mathf.Floor(st.unRepeatedUV.x), Mathf.Floor(st.unRepeatedUV.y));

            Shader.SetGlobalVector("_brushPointedUV_Untiled", v4);

            if (st.firstStroke)
            {
                if (method == (ColorSetMethod.MDownColor))
                {
                    if (pntr)
                    {
                        pntr.SampleTexture(st.uvTo);
                        FromColor(br, st.unRepeatedUV);
                    }
                }
                else
                if (method == (ColorSetMethod.MDownPosition))
                {
                    FromUV(st.uvTo);
                }

                Shader.SetGlobalVector(PainterDataAndConfig.BRUSH_SAMPLING_DISPLACEMENT, new Vector4(
                                           ((float)currentPixel.x + 0.5f) / ((float)Cfg.samplingMaskSize.x),

                                           ((float)currentPixel.y + 0.5f) / ((float)Cfg.samplingMaskSize.y),

                                           Cfg.samplingMaskSize.x, Cfg.samplingMaskSize.y));
            }
        }