示例#1
0
        public ITexels PackTexture(Texture texture)
        {
            if (this.nextOffset.X + texture.Size.X >= this.WorkingTexture.Size.X)
            {
                this.nextOffset = new Vector2(0, this.nextOffset.Y + rowHeight);
                rowHeight       = 0;
            }

            if (this.nextOffset.Y + texture.Size.Y >= this.WorkingTexture.Size.Y)
            {
                this.finishTexture();
            }

            var ret = new TexelsAtlas(this.WorkingTexture, (ushort)this.nextOffset.X, (ushort)this.nextOffset.Y, (ushort)texture.Size.X, (ushort)texture.Size.Y);

            this.WorkingTexture.Update(texture.CopyToImage(), (uint)this.nextOffset.X, (uint)this.nextOffset.Y);

            this.nextOffset.X += texture.Size.X;

            this.rowHeight = Math.Max(this.rowHeight, texture.Size.Y);

            return(ret);
        }
示例#2
0
        public ITexels PackTexels(ITexels texels)
        {
            var ret = new TexelsAtlas(WorkingTexture, 0, 0, texels.Width, texels.Height);

            return(ret);
        }