WhirlyGlobe  1.1
A 3D interactive globe toolkit for ios
TextureAtlas Class Reference

#import <TextureAtlas.h>

List of all members.

Public Member Functions

(id) - inithWithTexSizeX:texSizeY:cellSizeX:cellSizeY:
(BOOL) - addImage:texOrg:texDest:
(BOOL) - getImageLayout:texOrg:texDest:
 We cache the images and their coordinates. Query the cache.
(WhirlyGlobe::Texture *) - createTexture
 Generate a texture from the images.

Protected Attributes

unsigned int texSizeX
 Texture size.
unsigned int texSizeY
unsigned int gridSizeX
 Grid size (for sorting)
unsigned int gridSizeY
unsigned int cellSizeX
 Cell sieze.
unsigned int cellSizeY
bool * layoutGrid
 Used for sorting new images.
NSMutableArray * images
 Images we've rendered so far (for lookup)

Detailed Description

A Texture Atlas is an object used to consolidate textures for performance. OpenGL doesn't like having a lot of little textures and would much prefer one big one. This is how we do that. Texture Atlases are typically built on the fly with images that come in from other sources.


Member Function Documentation

- (BOOL) addImage: (UIImage *)  image
texOrg: (WhirlyGlobe::TexCoord &)  org
texDest: (WhirlyGlobe::TexCoord &)  dest 

Add the image to this atlas and return texture coordinates to map into. Returns false if there wasn't room

- (id) inithWithTexSizeX: (unsigned int)  texSizeX
texSizeY: (unsigned int)  texSizeY
cellSizeX: (unsigned int)  cellSizeX
cellSizeY: (unsigned int)  cellSizeY 

Construct with texture size (needs to be a power of 2). We sort images into buckets (sizeX/gridX,sizeY/gridY)


The documentation for this class was generated from the following file: