Exemplo n.º 1
0
        private void GenerateQuadtree()
        {
            if (Input.GetKeyDown(KeyCode.Space) == false)
            {
                return;
            }

            int width  = SourceImage.width;
            int height = SourceImage.height;

            quadtreeTexture            = new Texture2D(width, height, TextureFormat.RGB24, false);
            quadtreeTexture.filterMode = FilterMode.Point;

            quadtree = new QuadtreeTextureCompression(new Rectangle(width / 2, height / 2, width / 2, height / 2),
                                                      LaplacianMap, SourceImage);

            ClearQuadtreeTexture();

            quadtree.Show(quadtreeTexture);

            MyRenderer.material.mainTexture = quadtreeTexture;

            Subdivide();

            quadtreeTexture.Apply();

            Debug.Log("Compressed texture Size: " + quadtree.CompressedTextureSize());
        }
Exemplo n.º 2
0
        public void Generate(Texture2D texture, Renderer renderer)
        {
            Vector2Int compressedSize = quadtree.CompressedTextureSize();

            texture            = new Texture2D(compressedSize.x, compressedSize.y, TextureFormat.RGB24, false);
            texture.filterMode = FilterMode.Point;


            renderer.material.mainTexture = texture;

            Colorize(texture);

            texture.Apply();
        }