Exemple #1
0
        public static bool edit(ref LinearColor col)
        {
            var c = col.ToGamma();

            if (edit(ref c))
            {
                col.From(c);
                return(true);
            }
            return(false);
        }
Exemple #2
0
        public void SetShadowAll(LinearColor col)
        {
            BrushMask bm = Cfg.brushConfig.mask;//glob.getBrush().brushMask;
            Color     c  = col.ToGamma();

            foreach (MeshPoint v in meshPoints)
            {
                bm.Transfer(ref v.shadowBake, c);
            }

            Dirty = true;
        }
Exemple #3
0
        public void PaintAll(LinearColor col)
        {
            BrushMask bm = Cfg.brushConfig.mask;//glob.getBrush().brushMask;
            Color     c  = col.ToGamma();

            foreach (MeshPoint v in meshPoints)
            {
                foreach (Vertex uv in v.uvpoints)
                {
                    bm.Transfer(ref uv._color, c);
                }
            }
            //Debug.Log("Dirty");
            Dirty = true;
        }
Exemple #4
0
        public bool ColorSliders_PEGI()
        {
            if (InspectedPainter != null)
            {
                return(ColorSliders());
            }

            bool changed = false;

            Color col = colorLinear.ToGamma();

            if (pegi.edit(ref col).nl())
            {
                colorLinear.From(col);
                changed = true;
            }

            changed |= ChannelSlider(BrushMask.R, ref colorLinear.r, null, true);
            changed |= ChannelSlider(BrushMask.G, ref colorLinear.g, null, true);
            changed |= ChannelSlider(BrushMask.B, ref colorLinear.b, null, true);
            changed |= ChannelSlider(BrushMask.A, ref colorLinear.a, null, true);

            return(changed);
        }
        public void SmoothBorders(Texture2D atlas, int miplevel)
        {
            Color[] col = atlas.GetPixels(miplevel);

            int aSize = AtlasSize;
            int tSize = textureSize;

            for (int i = 0; i < miplevel; i++)
            {
                aSize /= 2;
                tSize /= 2;
            }

            if (tSize == 0)
            {
                return;
            }

            int cnt = aSize / tSize;

            LinearColor tmp = new LinearColor();


            for (int ty = 0; ty < cnt; ty++)
            {
                int startY = ty * tSize * aSize;
                int lastY  = (ty * tSize + tSize - 1) * aSize;
                for (int tx = 0; tx < cnt; tx++)
                {
                    int startX = tx * tSize;
                    int lastX  = startX + tSize - 1;


                    tmp.Zero();
                    tmp.Add(col[startY + startX]);
                    tmp.Add(col[startY + lastX]);
                    tmp.Add(col[lastY + startX]);
                    tmp.Add(col[lastY + lastX]);

                    tmp.MultiplyBy(0.25f);

                    Color tmpC = tmp.ToGamma();


                    col[startY + startX] = tmpC;
                    col[startY + lastX]  = tmpC;
                    col[lastY + startX]  = tmpC;
                    col[lastY + lastX]   = tmpC;


                    for (int x = startX + 1; x < lastX; x++)
                    {
                        tmp.Zero();
                        tmp.Add(col[startY + x]);
                        tmp.Add(col[lastY + x]);
                        tmp.MultiplyBy(0.5f);
                        tmpC            = tmp.ToGamma();
                        col[startY + x] = tmpC;
                        col[lastY + x]  = tmpC;
                    }

                    for (int y = startY + aSize; y < lastY; y += aSize)
                    {
                        tmp.Zero();
                        tmp.Add(col[y + startX]);
                        tmp.Add(col[y + lastX]);
                        tmp.MultiplyBy(0.5f);
                        tmpC            = tmp.ToGamma();
                        col[y + startX] = tmpC;
                        col[y + lastX]  = tmpC;
                    }
                }
            }

            atlas.SetPixels(col, miplevel);
        }