MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSL3DTextureLoader Class Reference

Detailed Description

This utility class provides methods to load raster images that make up the textures associated with a model.

Deprecated
Deprecated as of MapLink 11.1. Advised to use MapLink Earth SDK instead.

Public Member Functions

 TSL3DTextureLoader ()
 
void destroy ()
 
bool loadTexture (const char *filename, TSLUSize textureWidth, TSLUSize textureHeight, TSLUSize *actualWidth, TSLUSize *actualheight, int *depth, unsigned char **texture)
 
bool textureDimensions (const char *filename, TSLUSize *width, TSLUSize *height)
 
void * operator new (size_t size) TSL_NO_THROW
 
void * operator new (size_t size, char *filename, int line)
 

Static Public Member Functions

static void freeBuffer (unsigned char *buffer)
 

Constructor & Destructor Documentation

◆ TSL3DTextureLoader()

TSL3DTextureLoader::TSL3DTextureLoader ( )

Member Function Documentation

◆ destroy()

void TSL3DTextureLoader::destroy ( )

Deletes this object.

◆ freeBuffer()

static void TSL3DTextureLoader::freeBuffer ( unsigned char * buffer)
static

Frees the memory buffer allocated by a call to loadTexture. Applications should call this function instead of deleting the buffer directly to ensure the correct heap is used.

◆ loadTexture()

bool TSL3DTextureLoader::loadTexture ( const char * filename,
TSLUSize textureWidth,
TSLUSize textureHeight,
TSLUSize * actualWidth,
TSLUSize * actualheight,
int * depth,
unsigned char ** texture )

Loads the texture specified by filename and returns it as an array of RGB values via the texture parameter. It is the user's responsibility to free this memory once it has been finished with.

Note that some 3D implementations expect texture sizes to be powers of 2. In this case, you should specify the desired texture size in this format and the returned data will indicate how large the actual texture is for non-square textures. This information can then be used to adjust texture coordinates for the resulting model to only cover the actual texture size.

Parameters
filenamefull path to the texture file to load including filename
textureWidthdesired width of the texture in pixels
textureHeightdesired height of the texture in pixels
actualWidthset to the actual width of the loaded texture
actualHeightset to the actual height of the loaded texture
depthset to the colour depth of the loaded texture. This will either be 8 or 24.
textureset to the raw texture data. If depth is 8, this will consist of actualWidth * actualHeight colour indexes. If depth is 24, this will consist of actualWidth * actualHeight RGB components, with each component being 8 bits. Note that it is the user's responsibility to delete this memory by calling freeBuffer on this class.
Returns
true if the texture was loaded successfully, otherwise false.

◆ operator new() [1/2]

void * TSL3DTextureLoader::operator new ( size_t size)

Allocation override for API redirection.

◆ operator new() [2/2]

void * TSL3DTextureLoader::operator new ( size_t size,
char * filename,
int line )

When included in an MFC application in debug mode, the debug new expects this to be here. Override it and return the same as the normal one. The library must include it when compiled in release mode, since the user's application may be in debug mode.

◆ textureDimensions()

bool TSL3DTextureLoader::textureDimensions ( const char * filename,
TSLUSize * width,
TSLUSize * height )

Queries the specified file for its dimensions. These values can be used to determine an appropriate size for the texture.

Parameters
filenamefull path to the texture including filename
widthset to the width of the texture in pixels
heightset to the height of the texture in pixels
Returns
true if the texture dimensions were queried successfully, otherwise false.