You are here

Texture Atlas Utilities

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!
AttachmentSize
texture_atlas_sample.png1.33 KB
texture-atlas-utils.scm27.16 KB

Utilities to create texture atlases from sets of images, useful in 3D games to avoid excessive state changes.

In addition to the atlas image, a ".tat" file is generated and updated to indicate which component images were incorporated into the atlas image. The format of this file is suitable for direct use in C/C++ development:


// TAT 1.0 SAMPLE
// this file generated by gimp texture-atlas-utils.scm
// SRC /home/path/miner_paint.xcf 0 0 \s+copy
#define LIST_SAMPLE_ATLAS(_) \
_(0,MINER_PAINT,FRAME_005,0,0,32,32) \
_(1,MINER_PAINT,FRAME_003,0,32,32,32) \
_(2,MINER_PAINT,FRAME_004,32,0,32,32) \
_(3,MINER_PAINT,FRAME_002,32,32,32,32) \
_(4,MINER_PAINT,FRAME_001,64,0,32,32)

Menu items to add and remove source images from the atlas are added under Image/Texture Atlas/...

Currently the source images can have borders added and be aligned to 2^N boundaries.

Code License: 
GIMP Version: 
Scripting Engine: 

Comments

Good job.
Sometimes it shows strange error. "set-input-port: needs 1 argument(s) " when I try to add a new image. But it usually works after a few retries.

I'm transforming the tat file to xml plist so I can load it with Cocos2d.

Sometimes it shows strange error. "set-input-port: needs 1 argument(s) "

I am suspecting that is a problem inherent to Script-fu, if not to TinyScheme itself. I have sporadically encountered it whenever reading text files from a script and it appears to behave quite inconsistently (perhaps ports or file handles are not being protected properly from being garbage collected).

This issue definitely needs to be pursued so if you can provide any additional information, please post about it (probably not in this thread though :) ).

Subscribe to Comments for "Texture Atlas Utilities"