Skip to content

Instantly share code, notes, and snippets.

@aras-p
Created May 11, 2012 07:20
Show Gist options
  • Select an option

  • Save aras-p/2658102 to your computer and use it in GitHub Desktop.

Select an option

Save aras-p/2658102 to your computer and use it in GitHub Desktop.
#define HANDLE_LIST(texList, FormatFunc, AtlasFunc) \
do { \
const unsigned count = texList.size(); \
Texture2D** tex = count ? &texList[0] : 0; \
\
TextureFormat format; \
unsigned page, pad; \
TextureFilterMode filter; \
\
FormatFunc(tex, count, &format); \
DeterminePageParams(tex, count, format, &page, &pad, &filter ); \
\
unsigned begin = atlas->PageCount(); \
unsigned end = atlas->AtlasFunc(page, pad, format, tex, count); \
for( unsigned i = begin ; i < end ; ++i ) \
atlas->GetPage(i)->SetFilterMode(filter); \
} while(0) \
atlas->Reset();
HANDLE_LIST(targetUncompressedTex, DetermineUncompressedFormat, BuildAtlas);
HANDLE_LIST(targetCompressedTex, DetermineCompressedFormat, AppendToAtlas);
atlas->CallAwakeForPages(0, atlas->PageCount());
atlas->AwakeFromLoad(kInstantiateOrCreateFromCodeAwakeFromLoad);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment