Ejemplo n.º 1
0
        public static void textureAsyncFunc(Params par)
        {
            float         g   = 0f;
            TextureParams pa  = (TextureParams)par;
            TTexture      t   = pa.par.texMeta;
            Texture2D     tex = pa.par.tex;

            switch (t.Type)
            {
            case TextureTypes.Cellular:
                g = CellularTemplate.gen(pa.p);
                break;

            case TextureTypes.Solid:
                g = SolidTemplate.gen(pa.p);
                // @todo: fix to be more flexible
                break;
            }

            pa.colors [pa.count] = createColorDefault(g);

            int tileSize = tex.width * tex.height;

            if (pa.count == tileSize - 1)
            {
                tex.SetPixels(pa.colors);
                tex.Apply();
                tex.Compress(false);

                if (tileSize == t.totalPix)
                {
                    t.Tex      = tex;
                    t.finished = true;
                    Debug.Log("Finished: ");
                }
                else
                {
                    t.addTexture(tex, pa.par.localLoc);
                }
            }
        }