Example #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());
        }
Example #2
0
        void DoSubdivide()
        {
            northEast = new QuadtreeTextureCompression(boundary.NorthEast, map, sourceImage);
            northWest = new QuadtreeTextureCompression(boundary.NorthWest, map, sourceImage);

            southEast = new QuadtreeTextureCompression(boundary.SouthEast, map, sourceImage);
            southWest = new QuadtreeTextureCompression(boundary.SouthWest, map, sourceImage);

            divided = true;

            northEast.Subdivide();
            northWest.Subdivide();
            southEast.Subdivide();
            southWest.Subdivide();
        }
Example #3
0
        public int CompareTo(object obj)
        {
            QuadtreeTextureCompression other = obj as QuadtreeTextureCompression;

            if (boundary.DoubleWidth < other.boundary.DoubleWidth)
            {
                return(-1);
            }
            else if (boundary.DoubleWidth > other.boundary.DoubleWidth)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
Example #4
0
 public CompressedTextureGenerator(QuadtreeTextureCompression quadtree, Texture2D sourceImage)
 {
     this.quadtree    = quadtree;
     this.sourceImage = sourceImage;
 }
Example #5
0
 public QuadtreeTextureCompressionAndColor(QuadtreeTextureCompression quadtree, Color color)
 {
     this.quadtree = quadtree;
     this.color    = color;
 }