Class TexturePacker

java.lang.Object
com.ardor3d.extension.atlas.TexturePacker

public class TexturePacker extends Object
A tool that uses the AtlasNode/AtlasPacker algorithm to pack textures into texture atlases. It modifies the uv coordinates of the meshes, and tries to pack the atlases in a way that works with the wrap modes of the textures involved.

Simple use case:

 // Create a texture atlas packer with maximum atlas size of 256x256
 final TexturePacker packer = new TexturePacker(256, 256);

 // Add meshes into atlas (lots of different ways of doing this if you have other source/target texture indices)
 packer.insert(mesh1);
 packer.insert(mesh2);

 // Create all the atlases (also possible to set filters etc here through the AtlasTextureParameter)
 packer.createAtlases();
 
  • Constructor Details

    • TexturePacker

      public TexturePacker(int atlasWidth, int atlasHeight)
  • Method Details

    • insert

      public void insert(Mesh mesh)
    • insert

      public void insert(Mesh mesh, int textureIndex)
    • insert

      public void insert(Mesh mesh, int textureIndex, int targetTextureIndex)
    • insert

      public void insert(TextureParameter parameterObject)
    • createAtlases

      public void createAtlases()
    • createAtlases

      public void createAtlases(AtlasTextureParameter atlasTextureParameter)
    • getTextures

      public List<Texture> getTextures()
    • getAtlasWidth

      public int getAtlasWidth()
    • getAtlasHeight

      public int getAtlasHeight()