|  | GL Studio C++ Runtime API
    | 
#include <texture_palette.h>
| Classes | |
| class | DistiAttributeTexturePalette | 
| class | DistiAttributeTexturePalette_V21 | 
| Public Member Functions | |
| TexturePalette (int size=0) | |
| void | PaletteSize (int newSize) | 
| TexturePaletteEntry * | Entry (int i) | 
| unsigned int | size (void) const | 
| void | InvalidateTextures (void) | 
| int | FindAvailableSlot (void) | 
| const char * | TextureFilename (int i) | 
| void | TextureFilename (int i, const char *filename) | 
| bool | SetTexture (int i, const char *filename, const Image::LoadOptions &options=Image::LoadOptions(), bool glTexCompress=false, bool allowNPOT=true) | 
| bool | SetTexture (int i, TexturePaletteEntry *entry) | 
| bool | SetTexture (int i, Image *image) | 
| bool | SetInlineTexture (int i, glsInlineImage &image) | 
| bool | DisableImageSharing (int index) | 
| int | FindTextureByName (const char *name) | 
| TextureState_e | TextureState (int i) | 
| int | Width (int i) | 
| int | Height (int i) | 
| int | TextureWidth (int i) | 
| int | TextureHeight (int i) | 
| float | TextureCoordX (int i) | 
| float | TextureCoordY (int i) | 
| void | InvalidateTexture (int i) | 
| void | BindTexture (int i) | 
| int | TextureValid (int i) | 
| void | DeleteTexture (int i) | 
| Image * | Texture (int i) | 
| bool | GenerateInline (int i) | 
| bool | UseGLTextureCompression (int i) | 
| bool | AllowNPOT (int i) | 
| long | CompressedSize (int i) | 
| glsImageCodec | Codec (int i) | 
| int | CompressionFactor (int i) | 
| void | GenerateInline (int i, bool val) | 
| void | UseGLTextureCompression (int i, bool val) | 
| void | AllowNPOT (int i, bool val) | 
| void | CompressedSize (int i, long val) | 
| void | Codec (int i, glsImageCodec val, bool reload=true) | 
| void | CompressionFactor (int i, int val, bool reload=true) | 
| void | DesiredLoadSize (int i, int width, int height) | 
| void | Reload (int i) | 
| void | SetMipMap (int i, bool val) | 
| void | PreviewGenerated (int i) | 
| void | SetTexturePaletteCallback (void(*callback)(bool, int, DisplayFrame *), DisplayFrame *owningFrame) | 
| Static Public Member Functions | |
| static bool | DownsizeImage (Image *image, int desiredWidth, int desiredHeight) | 
| Public Attributes | |
| DynamicArray< TexturePaletteEntry, false > | palette | 
Texture Palette class. Stores a list of textures, each with its own texture handle. This the textures to be stored separately from the objects, which allows multiple objects to share the same textures.
| TexturePalette | ( | int | size = 0 | ) | 
Create a new texture palette with the indicated number of entries
| size | The number of entries in the palette | 
| bool AllowNPOT | ( | int | i | ) | 
| i | The index of the texture | 
| void AllowNPOT | ( | int | i, | 
| bool | val | ||
| ) | 
Set True if the image is allowed to be non power of two
| i | The index of the texture | 
| val | the value to set allowing non-power of two (NPOT) functionality | 
| void BindTexture | ( | int | i | ) | 
Bind the texture at the given index, unless it is already bound. Set as the texture to be used for texturing polygons
| i | The index of the texture | 
| glsImageCodec Codec | ( | int | i | ) | 
| i | The index of the texture | 
| void Codec | ( | int | i, | 
| glsImageCodec | val, | ||
| bool | reload = true | ||
| ) | 
Set CODEC that will be used to compress an inline image
| i | The index of the texture | 
| val | The codec to set | 
| reload | Whether or not to reload the image | 
| long CompressedSize | ( | int | i | ) | 
| i | The index of the texture | 
| void CompressedSize | ( | int | i, | 
| long | val | ||
| ) | 
Set Size of image when compressed with currently set inline CODEC
| i | The index of the texture | 
| val | 
| int CompressionFactor | ( | int | i | ) | 
| i | The index of the texture | 
| void CompressionFactor | ( | int | i, | 
| int | val, | ||
| bool | reload = true | ||
| ) | 
Set Compression factor of the image, used only for JPEG
| i | The index of the texture | 
| val | |
| reload | 
| void DeleteTexture | ( | int | i | ) | 
Delete the texture at the given index. Mark the index as unused.
| i | The index of the texture | 
| void DesiredLoadSize | ( | int | i, | 
| int | width, | ||
| int | height | ||
| ) | 
Sets the desired load size for the image. If the loaded image is larger than the specified dimensions, it will be scaled down during the load.
| i | The index of the texture | 
| width | The desired width | 
| height | The desired height | 
| bool DisableImageSharing | ( | int | index | ) | 
Disables image sharing for the Image at the given index and ensures that the index refers to a unique Image instance. Note: If you want to disable image sharing for an Image that is not yet in a palette, you should call AllowImageSharing(false) on the Image.
| index | The index of the texture to disable image sharing. The Image must already be loaded in the palette. | 
| 
 | static | 
Scales down an image to the next power-of-two size where (width <= desiredWidth || height <= desiredHeight) Maintains aspect ratio. Note: This method may be removed from the TexturePalette in the future.
| TexturePaletteEntry* Entry | ( | int | i | ) | 
Returns the texture palette entry at index i
| int FindAvailableSlot | ( | void | ) | 
Finds an unused slot in the texture palette.
| int FindTextureByName | ( | const char * | name | ) | 
Finds a texture based on its filename
| name | The filename of the texture to find | 
| bool GenerateInline | ( | int | i | ) | 
| i | The index of the texture | 
| void GenerateInline | ( | int | i, | 
| bool | val | ||
| ) | 
Set True if the image is to be generated as inline code
| i | The index of the texture | 
| val | 
| int Height | ( | int | i | ) | 
Returns the height of the texture image in pixels
| i | The index of the texture to get the height of | 
| void InvalidateTexture | ( | int | i | ) | 
Invalidate the texture at the given index, causing it to be rebound the next time it is referencd
| i | The index of the texture | 
| void InvalidateTextures | ( | void | ) | 
Invalidates all of the textures in the palette, forcing them to be rebound the next time they are referenced by an object.
| void PaletteSize | ( | int | newSize | ) | 
Resize texture palette with the indicated number of entries
| newSize | The new number of entries in the palette | 
| void PreviewGenerated | ( | int | i | ) | 
Compress using the current compression settings for the texture and scale down to the DesiredLoadSize.
| i | The index of the texture | 
| void Reload | ( | int | i | ) | 
Reload a texture from disk, then downsize and compress it using the current settings of the TexturePaletteEntry
| i | The index of the texture to reload | 
| bool SetInlineTexture | ( | int | i, | 
| glsInlineImage & | image | ||
| ) | 
Sets the texture at the given index
| i | The index to insert at | 
| image | Structure containing the compressed image data | 
| void SetMipMap | ( | int | i, | 
| bool | val | ||
| ) | 
Set mip-mapping state for given texture
| i | The index of the texture to set mipmapping for | 
| val | The mipmapping state to set | 
| bool SetTexture | ( | int | i, | 
| const char * | filename, | ||
| const Image::LoadOptions & | options = Image::LoadOptions(), | ||
| bool | glTexCompress = false, | ||
| bool | allowNPOT = true | ||
| ) | 
Sets the texture at the given index. Attempts to load the texture from disk
| i | The texture index to load the texture into | 
| filename | The filename to set | 
| options | Image load options (e.g. reverse alpha) | 
| glTexCompress | The GlTextureCompression setting for the new Image. | 
| allowNPOT | If the image is allowed to be non-power of two (NPOT) | 
| bool SetTexture | ( | int | i, | 
| TexturePaletteEntry * | entry | ||
| ) | 
Sets the texture at the given index using a TexturePaletteEntry structure. This is generally only used in the Editor
| i | |
| entry | Image generation options, NULL if not setting them | 
| bool SetTexture | ( | int | i, | 
| Image * | image | ||
| ) | 
Sets the texture at the given index Does NOT attempt to load a file
| i | The texture index to load the texture into | 
| image | An image that will be the texture | 
| void SetTexturePaletteCallback | ( | void(*)(bool, int, DisplayFrame *) | callback, | 
| DisplayFrame * | owningFrame | ||
| ) | 
Sets up for a callback to be used for reacting to the texture palette items and filenames to be updated.
| callback | A function accepting whether the texture was added/modified(true) or removed(false), the index of it, and the frame this palette belongs to. | 
| owningFrame | The display frame that this texture palette belongs to. | 
| unsigned int size | ( | void | ) | const | 
Gets the size of the texture palette
| Image* Texture | ( | int | i | ) | 
Get a pointer to the texture at the given index.
| i | The index of the texture | 
| float TextureCoordX | ( | int | i | ) | 
Returns the Texture Coordinate of the upper right corner of the image computed as (Width/TextureWidth)
| i | The index of the texture | 
| float TextureCoordY | ( | int | i | ) | 
Returns the Texture Coordinate of the upper right corner of the image computed as (Height/TextureHeight)
| i | The index of the texture | 
| const char* TextureFilename | ( | int | i | ) | 
Returns the filename associated with the texture at the given index.
| i | The index to get the filename from | 
| void TextureFilename | ( | int | i, | 
| const char * | filename | ||
| ) | 
Sets the filename associated with the texture at the given index.
| i | The index to get the filename from | 
| filename | The filename to set | 
| int TextureHeight | ( | int | i | ) | 
Returns the power of two height of the texture image in pixels
| i | The index of the texture to get the power of two height of | 
| TextureState_e TextureState | ( | int | i | ) | 
Gets the texture state of the texture at the given index.
| i | The index to get the texture state from | 
| int TextureValid | ( | int | i | ) | 
Return whether or not texture is bound
| i | The index of the texture | 
| int TextureWidth | ( | int | i | ) | 
Returns the power of two width of the texture image in pixels
| i | The index of the texture to get the power of two width of | 
| bool UseGLTextureCompression | ( | int | i | ) | 
| i | The index of the texture | 
| void UseGLTextureCompression | ( | int | i, | 
| bool | val | ||
| ) | 
Set True if the image is to be generated to use OpenGL texture compression
| i | The index of the texture | 
| val | 
| int Width | ( | int | i | ) | 
Returns the width of the texture image in pixels
| i | The index of the texture to get the width of | 
| DynamicArray<TexturePaletteEntry, false> palette | 
A dynamic array of TexturePaletteEntry