Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

RwTexture
[Rasters, Textures & Images]


Data Structures

struct   RwTexture

Typedefs

typedef RwTexture *(*  RwTextureCallBackRead )(const RwChar *name, const RwChar *maskName)
typedef RwTexture *(*  RwTextureCallBackFind )(const RwChar *name)
typedef RwTexture *(*  RwTextureCallBack )(RwTexture *texture, void *pData)
typedef RwRaster *(*  RwTextureCallBackMipmapGeneration )(RwRaster *raster, RwImage *image)
typedef RwBool(*  RwTextureCallBackMipmapName )(RwChar *name, RwChar *maskName, RwUInt8 mipLevel, RwInt32 format)

Functions

RwInt32  RwTextureRegisterPluginStream (RwUInt32 pluginID, RwPluginDataChunkReadCallBack readCB, RwPluginDataChunkWriteCallBack writeCB, RwPluginDataChunkGetSizeCallBack getSizeCB)
RwInt32  RwTextureSetStreamAlwaysCallBack (RwUInt32 pluginID, RwPluginDataChunkAlwaysCallBack alwaysCB)
RwUInt32  RwTextureStreamGetSize (const RwTexture *texture)
const RwTexture RwTextureStreamWrite (const RwTexture *texture, RwStream *stream)
RwTexture RwTextureStreamRead (RwStream *stream)
RwBool  RwTextureSetFindCallBack (RwTextureCallBackFind callBack)
RwTextureCallBackFind  RwTextureGetFindCallBack (void)
RwBool  RwTextureSetReadCallBack (RwTextureCallBackRead callBack)
RwTextureCallBackRead  RwTextureGetReadCallBack (void)
RwBool  RwTextureSetMipmapping (RwBool enable)
RwBool  RwTextureGetMipmapping (void)
RwBool  RwTextureSetAutoMipmapping (RwBool enable)
RwBool  RwTextureGetAutoMipmapping (void)
RwTexture RwTextureSetRaster (RwTexture *texture, RwRaster *raster)
RwRaster RwTextureGetRaster (const RwTexture *texture)
RwTexture RwTextureCreate (RwRaster *raster)
RwTexture RwTextureAddRef (RwTexture *texture)
RwBool  RwTextureDestroy (RwTexture *texture)
RwChar RwTextureGetName (RwTexture *texture)
RwChar RwTextureGetMaskName (RwTexture *texture)
RwTexture RwTextureSetName (RwTexture *texture, const RwChar *name)
RwTexture RwTextureSetMaskName (RwTexture *texture, const RwChar *maskName)
RwTexDictionary RwTextureGetDictionary (RwTexture *texture)
RwBool  RwTextureGenerateMipmapName (RwChar *name, RwChar *maskName, RwUInt8 mipLevel, RwInt32 format)
RwTexture RwTextureRead (const RwChar *name, const RwChar *maskName)
RwTexture RwTextureSetFilterMode (RwTexture *texture, RwTextureFilterMode filtering)
RwTextureFilterMode  RwTextureGetFilterMode (const RwTexture *texture)
RwTexture RwTextureSetAddressing (RwTexture *texture, RwTextureAddressMode addressing)
RwTexture RwTextureSetAddressingU (RwTexture *texture, RwTextureAddressMode addressing)
RwTexture RwTextureSetAddressingV (RwTexture *texture, RwTextureAddressMode addressing)
RwTextureAddressMode  RwTextureGetAddressing (const RwTexture *texture)
RwTextureAddressMode  RwTextureGetAddressingU (const RwTexture *texture)
RwTextureAddressMode  RwTextureGetAddressingV (const RwTexture *texture)
RwInt32  RwTextureRegisterPlugin (RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB)
RwInt32  RwTextureGetPluginOffset (RwUInt32 pluginID)
RwBool  RwTextureValidatePlugins (const RwTexture *texture)
RwBool  RwTextureSetMipmapGenerationCallBack (RwTextureCallBackMipmapGeneration callback)
RwTextureCallBackMipmapGeneration  RwTextureGetMipmapGenerationCallBack (void)
RwBool  RwTextureSetMipmapNameCallBack (RwTextureCallBackMipmapName callback)
RwTextureCallBackMipmapName  RwTextureGetMipmapNameCallBack (void)
RwBool  RwTextureRasterGenerateMipmaps (RwRaster *raster, RwImage *image)
void  RwTextureSetFreeListCreateParams (RwInt32 blockSize, RwInt32 numBlocksToPrealloc)
void  RwTexDictionarySetFreeListCreateParams (RwInt32 blockSize, RwInt32 numBlocksToPrealloc)
void  RwPalQuantSetMaxDepth (RwUInt32 depth)
RwUInt32  RwPalQuantGetMaxDepth (void)

Detailed Description

Texture handling. Textures are special cases of rasters that can be applied to polygons.

RwTexture Overview

Requirements

Overview

Represents a standard RenderWare Texture map.

Textures reference Rasters (RwRaster), which contain the actual texture and, if applicable, any mip-map data. The texture object is therefore an extension of the basic raster object and some functionality is split across the two APIs because of this. For instance, mip-map functions are found under RwRaster, not RwTexture.

Textures rely on the RwImage object to load bitmaps from standard image file formats such as .BMP, .RAS and .PNG.


Typedef Documentation

typedef RwTexture*(* RwTextureCallBack)(RwTexture *texture, void *pData)
 

RwTextureCallBack represents the function called from RwTexDictionaryForAllTextures for all textures in a given texture dictionary. This function should return the current texture to indicate success. The callback may return NULL to terminate further callbacks on the texture dictionary.

Parameters:
texture  Pointer to the current texture.
pData  User-defined data pointer.
Returns:
Pointer to the current texture
See also:
RwTexDictionaryForAllTextures
typedef RwTexture*(* RwTextureCallBackFind)(const RwChar *name)
 

RwTextureCallBackFind represents the function used by RwTextureRead to search for a texture in memory before attempting to read one from disk. This may involve searching previously loaded texture dictionaries.

Parameters:
name  Pointer to a string containing the name of the texture to find.
Returns:
Pointer to the texture, or NULL if not found.
See also:
RwTextureSetFindCallBack , RwTextureGetFindCallBack
typedef RwRaster*(* RwTextureCallBackMipmapGeneration)(RwRaster * raster, RwImage * image)
 

RwTextureCallBackMipmapGeneration is the callback function supplied to RwTextureSetMipmapGenerationCallBack and returned from RwTextureGetMipmapGenerationCallBack.

The supplied function will be passed a pointer to a raster and an image. The raster is the target for the generated mipmap levels and the image provides the base for their generation.

Parameters:
raster  Pointer to raster, the target for generated mipmap levels
image  Pointer to image, used to generate mipmap levels.
Returns:
Returns a pointer to the raster if successful or NULL if an error occurred.
See also:
RwTextureSetMipmapGenerationCallBack , RwTextureGetMipmapGenerationCallBack , RwTextureSetAutoMipmapping , RwTextureGetAutoMipmapping
typedef RwBool(* RwTextureCallBackMipmapName)(RwChar *name, RwChar *maskName, RwUInt8 mipLevel, RwInt32 format)
 

RwTextureCallBackMipmapName is the callback function supplied to RwTextureSetMipmapNameCallBack and returned from RwTextureGetMipmapNameCallBack.

The supplied function will be passed a pointer to a root name, a maskName, a mipmap level and a format. The function returns TRUE if successful and the root name will have been modified to equal the mipmap name.

Parameters:
name  Pointer to a string containing the root name of the texture. The mipmap level name is put here.
maskName  Pointer to a string containing the root mask name of the texture or NULL if no mask name is required.
mipLevel  A value equal to the mipmap level for which the name is required.
format  A value describing the mipmapping mode. A combination of the bit flags rwRASTERFORMATMIPMAP and rwRASTERFORMATAUTOMIPMAP.
Returns:
Returns TRUE if the name is generated successfully or FALSE if an error occurred.
See also:
RwTextureGenerateMipmapName , RwTextureSetMipmapNameCallBack , RwTextureGetMipmapNameCallBack , RwTextureSetAutoMipmapping , RwTextureGetAutoMipmapping
typedef RwTexture*(* RwTextureCallBackRead)(const RwChar *name, const RwChar *maskName)
 

RwTextureCallBackRead represents the function used by RwTextureRead to read the specified texture from a disk file. This function should return a pointer to the texture to indicate success.

Parameters:
name  Pointer to a string containing the name of the texture to read.
maskName  Pointer to a string containing the name of the mask to read and apply to the texture.
Returns:
Pointer to the texture
See also:
RwTextureSetReadCallBack , RwTextureGetReadCallBack

Function Documentation

RwUInt32 RwPalQuantGetMaxDepth void   
 

RwPalQuantGetMaxDepth returns the maximum depth of the tree used for palette quantization.

Returns:
Current maximum depth of tree used for quantization
See also:
RwTextureRasterGenerateMipmaps , RwPalQuantSetMaxDepth
void RwPalQuantSetMaxDepth RwUInt32    depth
 

RwPalQuantSetMaxDepth sets the maximum depth of the tree used for palette quantization. The deeper the tree, the more memory and time will be used by the quantization process, but the better the results. Values should be less than 8.

Parameters:
depth  Maximum depth of tree to be used for quantization
See also:
RwTextureRasterGenerateMipmaps , RwPalQuantSetMaxDepth
void RwTexDictionarySetFreeListCreateParams RwInt32    blockSize,
RwInt32    numBlocksToPrealloc
 

RwTexDictionarySetFreeListCreateParams allows the developer to specify how many RwTexDictionary s to preallocate space for. Call before RwEngineOpen.

Parameters:
blockSize  number of entries per freelist block.
numBlocksToPrealloc  number of blocks to allocate on RwFreeListCreateAndPreallocateSpace.
See also:
RwFreeList
RwTexture* RwTextureAddRef RwTexture   texture
 

RwTextureAddRef is used to increment the reference count of the specified texture. Use this function to indicate that a new object depends on the texture's existence. This ensures that the texture is not lost when other objects that use this texture are destroyed.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  The pointer to the texture to increment reference count
Returns:
Returns a pointer to the texture
See also:
RwTextureDestroy , RpMaterialSetTexture
RwTexture* RwTextureCreate RwRaster   raster
 

RwTextureCreate is used to create a new texture from the specified raster. The raster must have been created with type flag rwRASTERTYPETEXTURE or rwRASTERTYPECAMERATEXTURE to be used as a texture and to be of a size and depth compatible with the particular device it is created for. If the texture is added to a texture dictionary it is recommended that the texture be given a name so that it can be identified when the dictionary is searched. On creation the texture has a reference count of one.

Note:
Newly created textures have the following default values:
  • filtering - rwFILTERNEAREST
  • u address - rwTEXTUREADDRESSWRAP
  • v address - rwTEXTUREADDRESSWRAP
Parameters:
raster  A pointer to the raster to use as a texture
Returns:
Returns a pointer to the newly created texture if successful or NULL if there is an error
See also:
RwRasterCreate , RwTexDictionaryAddTexture , RwTexDictionarySetCurrent , RwTextureSetName , RwTextureDestroy
RwBool RwTextureDestroy RwTexture   texture
 

RwTextureDestroy is used to destroy the specified texture. If the texture is defined in a texture dictionary the texture is removed from that dictionary. The raster associated with the texture is also destroyed by this function.

Note:
Only textures whose reference counts are zero are actually removed from the system. A reference count greater than one indicates that its particular texture is still being used by one or more objects. Hence, this function will only decrement the texture's reference count if this is the case.
Parameters:
texture  A pointer to the texture to destroy
Returns:
Returns TRUE if the texture has been destroyed or FALSE if there is an error
See also:
RwTextureCreate , RwTextureRead , RwTextureAddRef
RwBool RwTextureGenerateMipmapName RwChar   name,
RwChar   maskName,
RwUInt8    mipLevel,
RwInt32    format
 

RwTextureGenerateMipmapName is used to generate the name of a mipmap level file.

It is possible to supply a user defined procedure for naming mipmap levels. The API function RwTextureSetMipmapNameCallBack should be used before reading of textures.

Parameters:
name  A pointer to a string containing the root name of the texture. This must have at least rwTEXTUREMIPMAPNAMECHARS free storage of size RwChar free after the name itself. The mipmap level name is put here.
maskName  A pointer to a string containing the root mask name of the texture or NULL if no mask name is required. This must have at least rwTEXTUREMIPMAPNAMECHARS free storage of size RwChar free after the name itself. The mipmap level mask name is put here.
mipLevel  A value equal to the mipmap level for which the name is required.
format  A value describing the mipmapping mode. A combination of the bit flags rwRASTERFORMATMIPMAP and rwRASTERFORMATAUTOMIPMAP.
Returns:
Returns TRUE if the operation was successful and FALSE if there was a failure. If the return is FALSE the names are not altered
See also:
RwTextureSetMipmapNameCallBack , RwTextureGetMipmapNameCallBack , RwTextureRead
RwTextureAddressMode RwTextureGetAddressing const RwTexture   texture
 

RwTextureGetAddressing is used to retrieve the current texture-addressing mode of the specified texture. The texture-addressing mode determines how the UV coordinates are used to generate the texel color.

Note:
If the addressing modes in the u & v direction are not the same this function will return rwTEXTUREADDRESSNATEXTUREADDRESS.
Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  A pointer to the texture to query.
Returns:
Returns the texture's addressing mode if successful or rwTEXTUREADDRESSNATEXTUREADDRESS if there is an error. Valid addressing modes are:
  • rwTEXTUREADDRESSWRAP Wrap mode enables tiling as usual, and is the default
  • rwTEXTUREADDRESSMIRROR Mirror mode flips alternate copies of the texture
  • rwTEXTUREADDRESSCLAMP Clamp mode limits the range of UV, so that the texture is stretched at the edges
  • rwTEXTUREADDRESSBORDER Border mode applies the material color to the polygon where UV falls outside the range 0-1
See also:
RwTextureGetAddressingU , RwTextureGetAddressingV , RwTextureSetAddressing , RwTextureSetAddressingU , RwTextureSetAddressingV
RwTextureAddressMode RwTextureGetAddressingU const RwTexture   texture
 

RwTextureGetAddressingU is used to retrieve the current texture-addressing mode of the specified texture. The texture-addressing mode determines how the UV coordinates are used to generate the texel color.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  A pointer to the texture to query
Returns:
Returns the texture's addressing mode if successful or rwTEXTUREADDRESSNATEXTUREADDRESS if there is an error. Valid addressing modes are:
  • rwTEXTUREADDRESSWRAP Wrap mode enables tiling as usual, and is the default
  • rwTEXTUREADDRESSMIRROR Mirror mode flips alternate copies of the texture
  • rwTEXTUREADDRESSCLAMP Clamp mode limits the range of UV, so that the texture is stretched at the edges
  • rwTEXTUREADDRESSBORDER Border mode applies the material color to the polygon where UV falls outside the range 0-1
See also:
RwTextureGetAddressing , RwTextureGetAddressingV , RwTextureSetAddressing , RwTextureSetAddressingU , RwTextureSetAddressingV
RwTextureAddressMode RwTextureGetAddressingV const RwTexture   texture
 

RwTextureGetAddressingV is used to retrieve the current texture-addressing mode of the specified texture. The texture-addressing mode determines how the UV coordinates are used to generate the texel color.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  A pointer to the texture to query.
Returns:
Returns the texture's addressing mode if successful or rwTEXTUREADDRESSNATEXTUREADDRESS if there is an error. Valid addressing modes are:
  • rwTEXTUREADDRESSWRAP Wrap mode enables tiling as usual, and is the default
  • rwTEXTUREADDRESSMIRROR Mirror mode flips alternate copies of the texture
  • rwTEXTUREADDRESSCLAMP Clamp mode limits the range of UV, so that the texture is stretched at the edges
  • rwTEXTUREADDRESSBORDER Border mode applies the material color to the polygon where UV falls outside the range 0-1
See also:
RwTextureGetAddressing , RwTextureGetAddressingU , RwTextureSetAddressing , RwTextureSetAddressingU , RwTextureSetAddressingV
RwBool RwTextureGetAutoMipmapping void   
 

RwTextureGetAutoMipmapping is used to enquire whether mipmaps are automatically generated when reading a texture or also read in from separate files.

The default setting is FALSE, i.e. the mipmaps will be read in also.

This setting is only used if mipmaps are available.

Returns:
Returns TRUE if mipmaps are automatically generated and FALSE if they are to be read in from separate files
See also:
RwTextureSetAutoMipmapping , RwTextureSetMipmapping , RwTextureGetMipmapping , RwTextureRead
RwTexDictionary* RwTextureGetDictionary RwTexture   texture
 

RwTextureGetDictionary is used to determine the texture dictionary that the specified texture belongs to.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  A pointer to the texture to query.
Returns:
Returns a pointer to the texture dictionary if successful or NULL if the texture does not belong to any dictionary
See also:
RwTexDictionaryAddTexture , RwTexDictionaryRemoveTexture
RwTextureFilterMode RwTextureGetFilterMode const RwTexture   texture
 

RwTextureGetFilterMode is used to retrieve the current texture-filtering mode of the specified texture.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  A pointer to the texture to query
Returns:
Returns the texture's filtering mode if successful or rwFILTERNAFILTERMODE if there is an error. Valid filtering modes are:
  • rwFILTERNEAREST - Point sampled
  • rwFILTERLINEAR - Bilinear interpolation
  • rwFILTERMIPNEAREST - Point sampled per pixel mipmap
  • rwFILTERMIPLINEAR - Bilinear interpolation per pixel mipmap
  • rwFILTERLINEARMIPNEAREST - Mipmap interpolated, point sampled
  • rwFILTERLINEARMIPLINEAR - Trilinear interpolation
See also:
RwTextureSetFilterMode , RwTextureGetAddressing , RwTextureSetAddressing
RwTextureCallBackFind RwTextureGetFindCallBack void   
 

RwTextureGetFindCallBack is used to enquire which function is currently used by RwTextureRead to search for textures in memory before an attempt is made to read them from an image file on disk.

Returns:
Returns a pointer to the current texture find function
See also:
RwTextureSetFindCallBack , RwTextureSetReadCallBack , RwTextureGetReadCallBack , RwTextureRead , RwImageRead
RwChar* RwTextureGetMaskName RwTexture   texture
 

RwTextureGetMaskName is used to retrieve the mask name of the specified texture. The mask name is usually only defined if the texture has been created by reading an image file from disk together with a mask image file. Otherwise, the mask name is an empty string.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  A pointer to the texture to query
Returns:
Returns a pointer to a string equal to the mask name if successful or NULL if there is an error or if the texture has no mask name
See also:
RwTextureGetName , RwTextureSetMaskName , RwTextureSetName , RwTextureCreate , RwTextureRead
RwTextureCallBackMipmapGeneration RwTextureGetMipmapGenerationCallBack void   
 

RwTextureGetMipmapGenerationCallBack This function is called at texture read time if mipmaps are available and are to be automatically generated.

Returns:
Returns a pointer to the function currently used to generate mipmaps
See also:
RwTextureSetMipmapGenerationCallBack , RwTextureSetMipmapping , RwTextureSetAutoMipmapping , RwTextureRasterGenerateMipmaps
RwTextureCallBackMipmapName RwTextureGetMipmapNameCallBack void   
 

RwTextureGetMipmapNameCallBack queries the function currently used to generate names for mip level files for textures.

Returns:
Returns a pointer to the function currently used to generate names for mip level files for textures. Returns NULL if there is no function or there is an error
See also:
RwTextureSetMipmapNameCallBack , RwTextureSetMipmapGenerationCallBack , RwTextureGetMipmapGenerationCallBack , RwTextureSetMipmapping , RwTextureSetAutoMipmapping , RwTextureRasterGenerateMipmaps
RwBool RwTextureGetMipmapping void   
 

RwTextureGetMipmapping is used to enquire whether mipmaps will be available when reading textures.

The default setting is FALSE, i.e. mipmaps are not available.

Returns:
Returns TRUE if mipmaps are available or FALSE if they are not
See also:
RwTextureSetAutoMipmapping , RwTextureGetAutoMipmapping , RwTextureRead
RwChar* RwTextureGetName RwTexture   texture
 

RwTextureGetName is used to retrieve the name of the specified texture.

Note that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.

Parameters:
texture  A pointer to the texture to query.
Returns:
Returns a pointer to a string equal to the name of the texture which may be an empty string
See also:
RwTextureGetMaskName , RwTextureSetName , RwTextureSetMaskName , RwTextureCreate , RwTextureRead
RwInt32 RwTextureGetPluginOffset RwUInt32    pluginID
 

RwTextureGetPluginOffset is used to get the offset of a previously registered plugin.

Parameters:
pluginID  The plugin ID for which to get the data offset
Returns:
Returns the data block offset or -1 if the plugin is not registered
See also:
RwTextureRegisterPlugin , RwTextureRegisterPluginStream , RwTextureValidatePlugins
RwRaster* RwTextureGetRaster const RwTexture   texture
 

RwTextureGetRaster is used to retrieve the raster associated with the specified texture.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  A pointer to the texture to query
Returns:
Returns a pointer to the raster
See also:
RwTextureSetRaster , RwTextureCreate
RwTextureCallBackRead RwTextureGetReadCallBack void   
 

RwTextureGetReadCallBack is used to enquire which function is currently used for reading textures from image files.

Returns:
Returns a pointer to the user defined texture reading function
See also:
RwTextureSetReadCallBack , RwTextureSetFindCallBack , RwTextureGetFindCallBack , RwTextureRead , RwImageRead
RwBool RwTextureRasterGenerateMipmaps RwRaster   raster,
RwImage   image
 

RwTextureRasterGenerateMipmaps is used to generate mipmaps for a raster, either from the supplied image (all mip levels including 0 are generated), or from mip level 0 of the raster into the remaining mip levels (no image supplied). The mipmaps are generated by the default callback function or a user supplied callback.

Parameters:
raster  A pointer to the raster that is to have the mipmaps generated.
image  A pointer to an image from which to generate the mipmaps or NULL.
Returns:
Returns TRUE if the mipmaps where generated correctly, or FALSE if there was an error
See also:
RwTextureSetMipmapping , RwTextureSetAutoMipmapping , RwTextureSetMipmapGenerationCallBack , RwPalQuantSetMaxDepth , RwPalQuantGetMaxDepth
RwTexture* RwTextureRead const RwChar   name,
const RwChar   maskName
 

RwTextureRead is used to read a texture from the specified image file on disk. A second image may also be read containing a mask to be applied to the first image after they have been read from the file system. If the mask is not required NULL should be passed as the mask image file name. The strings supplied for the texture names must form the leaf part (i.e. without path or extension) of the pathname for the texture file. For portability it is best to choose texture file names that are a maximum of 8 characters long and which are acceptable to MS-DOS as file names. The rest of the pathname of the texture file is obtained from the current search path; if the search path is not set it is assumed that the texture resides in the same directory as the application executable.

New format modules can be added using RwImageRegisterImageFormat. It is also possible to specify a user defined procedure for loading textures from image files of other formats. The API function RwTextureSetReadCallBack is used for this purpose and should be used before calling RwTextureRead.

A texture may have already been loaded and may be in a texture dictionary. Therefore, before the texture file is read from disk, a search is first made. By default, the current texture dictionary is searched for a texture of the same name, or if the current dictionary is not defined, all textures dictionaries are searched. This behavior may be overridden by a user defined callback set with RwTextureSetFindCallBack.

Only if the texture has not been found in memory is the disk file actually read. Therefore different textures must have different names.

When a new texture has been successfully loaded it is added to the current texture dictionary, if one is defined.

Note:
Gamma correction is automatically applied to the texture as it is loaded. Use RwImageSetGamma to set the current gamma value to 1.0 if gamma correction is not required.
Note:
The texture is created with a reference count of one. Hence, it is the responsibility of the application to destroy the texture if it is no longer required.
Parameters:
name  A pointer to a string containing the name of the texture to be read
maskName  A pointer to a string containing the name of the mask or NULL if not required
Returns:
Returns a pointer to the new texture if successful or NULL if there is an error
See also:
RwImageSetPath , RwImageSetGamma , RwImageRegisterImageFormat , RwTextureSetReadCallBack , RwTextureSetFindCallBack , RwTexDictionarySetCurrent , RwTextureSetMipmapping , RwTextureSetAutoMipmapping , RwTextureDestroy
RwInt32 RwTextureRegisterPlugin RwInt32    size,
RwUInt32    pluginID,
RwPluginObjectConstructor    constructCB,
RwPluginObjectDestructor    destructCB,
RwPluginObjectCopy    copyCB
 

RwTextureRegisterPlugin is used to register a plugin and reserve some space within a texture. This must happen after the engine has been initialized but before the engine is opened.

Parameters:
size  An RwInt32 value equal to the size of the memory block to reserve
pluginID  An RwInt32 value equal to the plugin ID (must be unique; used to identify binary chunks)
constructCB  A constructor for the plugin data block
destructCB  A destructor for the plugin data block
copyCB  A copy constructor for the plugin data block
Returns:
Returns the byte offset within the texture of memory reserved for this plugin or a negative value if there is an error
See also:
RwTextureRegisterPluginStream , RwTextureGetPluginOffset , RwTextureValidatePlugins
RwInt32 RwTextureRegisterPluginStream RwUInt32    pluginID,
RwPluginDataChunkReadCallBack    readCB,
RwPluginDataChunkWriteCallBack    writeCB,
RwPluginDataChunkGetSizeCallBack    getSizeCB
 

RwTextureRegisterPluginStream is used to associate a set of binary stream functionality with a previously registered texture plugin.

Parameters:
pluginID  A unique RwInt32 value equal to the plugin ID. (It is used to identify binary chunks).
readCB  A callback used when a chunk is read that is identified as being for this plugin
writeCB  A callback used when a chunk should be written out for this plugin
getSizeCB  A callback used to determine the binary stream size required for this plugin (return negative to suppress chunk writing)
Returns:
Returns an RwInt32 containing the byte offset within the texture of memory reserved for this plugin, or a negative value if there is an error.
See also:
RwTextureSetStreamAlwaysCallBack , RwTextureRegisterPlugin , RwTextureGetPluginOffset , RwTextureValidatePlugins
RwTexture* RwTextureSetAddressing RwTexture   texture,
RwTextureAddressMode    addressing
 

RwTextureSetAddressing is used to specify the texture-addressing mode for the given texture. The texture-addressing mode determines how the UV coordinates are used to generate the texel color. This function set the u & v addressing modes. The same result can be achieved by calling RwTextureSetAddressingU & RwTextureSetAddressingV separately.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  A pointer to the texture whose filtering mode is to be set
addressing  A value equal to the addressing mode:
  • rwTEXTUREADDRESSWRAP Wrap mode enables tiling as usual, and is the default
  • rwTEXTUREADDRESSMIRROR Mirror mode flips alternate copies of the texture
  • rwTEXTUREADDRESSCLAMP Clamp mode limits the range of UV, so that the texture is stretched at the edges
  • rwTEXTUREADDRESSBORDER Border mode applies the material color to the polygon where UV falls outside the range 0-1
Returns:
Returns a pointer to the texture
See also:
RwTextureGetAddressing , RwTextureGetAddressingU , RwTextureGetAddressingV , RwTextureSetAddressingU , RwTextureSetAddressingV
RwTexture* RwTextureSetAddressingU RwTexture   texture,
RwTextureAddressMode    addressing
 

RwTextureSetAddressingU is used to specify the texture-addressing mode for the given texture. The texture-addressing mode determines how the UV coordinates are used to generate the texel color. This function sets the addressing mode used in the u direction. Note that not all platforms support this feature.

Note:
that this function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  A pointer to the texture whose texture-addressing mode is to be set.
addressing  A value equal to the addressing mode:
  • rwTEXTUREADDRESSWRAP Wrap mode enables tiling as usual, and is the default
  • rwTEXTUREADDRESSMIRROR Mirror mode flips alternate copies of the texture
  • rwTEXTUREADDRESSCLAMP Clamp mode limits the range of UV, so that the texture is stretched at the edges
  • rwTEXTUREADDRESSBORDER Border mode applies the material color to the polygon where UV falls outside the range 0-1
Returns:
Returns the pointer to the texture
See also:
RwTextureSetAddressing , RwTextureSetAddressingV , RwTextureGetAddressing , RwTextureGetAddressingU , RwTextureGetAddressingV
RwTexture* RwTextureSetAddressingV RwTexture   texture,
RwTextureAddressMode    addressing
 

RwTextureSetAddressingV is used to specify the texture-addressing mode for the given texture. The texture-addressing mode determines how the UV coordinates are used to generate the texel color. This function sets the addressing mode used in the v direction. Note that not all platforms support this feature.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  A pointer to the texture whose texture-addressing mode is to be set
addressing  A value equal to the addressing mode:
  • rwTEXTUREADDRESSWRAP Wrap mode enables tiling as usual, and is the default
  • rwTEXTUREADDRESSMIRROR Mirror mode flips alternate copies of the texture
  • rwTEXTUREADDRESSCLAMP Clamp mode limits the range of UV, so that the texture is stretched at the edges
  • rwTEXTUREADDRESSBORDER Border mode applies the material color to the polygon where UV falls outside the range 0-1
Returns:
Returns the pointer to the texture
See also:
RwTextureSetAddressing , RwTextureSetAddressingU , RwTextureGetAddressing , RwTextureGetAddressingU , RwTextureGetAddressingV
RwBool RwTextureSetAutoMipmapping RwBool    enable
 

RwTextureSetAutoMipmapping is used to indicate whether mipmaps (if enabled) should have their contents generated automatically whenever a texture is read from a file, or whether the mipmaps should be read from separate files. If reading from separate files the default naming convention is to postfix the texture and mask name with "mn" where n is the index of the mipmap level, i.e. m0, m1, m2 etc. RwTextureSetMipmapNameCallBack can be called to change the way the mipmap names are generated. Use this function to choose between automatically generating mipmaps (TRUE) or reading mipmaps (FALSE).

The default setting is FALSE, i.e. the mipmaps will be read.

This setting is only used if mipmaps are available.

Parameters:
enable  An RwBool value equal to TRUE if mipmaps are to be generated or FALSE if they are to be read from separate files
Returns:
Returns TRUE
See also:
RwTextureGetAutoMipmapping , RwTextureSetMipmapping , RwTextureGetMipmapping , RwTextureRead
RwTexture* RwTextureSetFilterMode RwTexture   texture,
RwTextureFilterMode    filtering
 

RwTextureSetFilterMode is used to specify the texture-filtering mode for the given texture.

Note:
This function is used for debug purposes only and, for efficiency, is available as a macro for final release versions of an application.
Parameters:
texture  A pointer to the texture whose filtering mode is to be set
filtering  A value equal to the filtering mode:
  • rwFILTERNEAREST - Point sampled
  • rwFILTERLINEAR - Bilinear interpolation
  • rwFILTERMIPNEAREST - Point sampled per pixel mipmap
  • rwFILTERMIPLINEAR - Bilinear interpolation per pixel mipmap
  • rwFILTERLINEARMIPNEAREST - Mipmap interpolated, point sampled
  • rwFILTERLINEARMIPLINEAR - Trilinear interpolation
Returns:
Returns a pointer to the texture
See also:
RwTextureGetFilterMode , RwTextureSetAddressing , RwTextureGetAddressing
RwBool RwTextureSetFindCallBack RwTextureCallBackFind    callBack
 

RwTextureSetFindCallBack is used to override the callback that will be used by RwTextureRead to search for a texture in memory before attempting to read one from an image file on disk.

The default find function searches the current texture dictionary if one is set, or otherwise searches all texture dictionaries in the system. A user specified callback may implement other types of behavior such as searching a subset of texture dictionaries that are relevant to a particular part of a game.

Parameters:
callBack  A pointer to the texture find function
Returns:
Returns TRUE
See also:
RwTextureGetFindCallBack , RwTextureSetReadCallBack , RwTextureGetReadCallBack , RwTextureRead , RwImageRead
void RwTextureSetFreeListCreateParams RwInt32    blockSize,
RwInt32    numBlocksToPrealloc
 

RwTextureSetFreeListCreateParams allows the developer to specify how many RwTexture s to preallocate space for. Call before RwEngineOpen.

Parameters:
blockSize  number of entries per freelist block.
numBlocksToPrealloc  number of blocks to allocate on RwFreeListCreateAndPreallocateSpace.
See also:
RwFreeList
RwTexture* RwTextureSetMaskName RwTexture   texture,
const RwChar   maskName
 

RwTextureSetMaskName is used to give the specified texture the given mask name.

Parameters:
texture  A pointer to the texture whose mask name will be defined
maskName  A pointer to the texture's mask name to set.
Returns:
Returns a pointer to the texture
See also:
RwTextureGetMaskName , RwTextureSetName , RwTextureCreate , RwTextureRead
RwBool RwTextureSetMipmapGenerationCallBack RwTextureCallBackMipmapGeneration    callback
 

RwTextureSetMipmapGenerationCallBack is used to specify the function to be used to generate mipmaps automatically. This function will be called at texture read time if mipmaps are available and automatic mipmap generation is enabled.

Parameters:
callback  A pointer to the mipmap generation callback function to be used to generate mipmaps automatically
Returns:
Returns TRUE
See also:
RwTextureGetMipmapGenerationCallBack , RwTextureSetMipmapping , RwTextureSetAutoMipmapping , RwTextureRasterGenerateMipmaps
RwBool RwTextureSetMipmapNameCallBack RwTextureCallBackMipmapName    callback
 

RwTextureSetMipmapNameCallBack is used to specify the function to be used to generate the names of the files containing mipmap levels.

The function will be called with a root name and a given mipmap level at texture load time if mipmaps are available and automatic mipmap generation is disabled, i.e. the texture being loaded has mipmap levels stored.

Parameters:
callback  A pointer to the mipmap name callback to be used to generate the names of the files containing mipmap levels
Returns:
Returns TRUE
See also:
RwTextureGetMipmapNameCallBack , RwTextureSetMipmapGenerationCallBack , RwTextureGetMipmapGenerationCallBack , RwTextureSetMipmapping , RwTextureSetAutoMipmapping , RwTextureRasterGenerateMipmaps
RwBool RwTextureSetMipmapping RwBool    enable
 

RwTextureSetMipmapping is used to indicate whether mipmaps will be available whenever a texture is read from an image file. Use this function to turn-on and turn-off creation of textures with mipmaps.

The default setting is FALSE, i.e. textures will be created without mipmaps.

Note:
This function affects only textures loaded with RwTextureRead. Textures loaded indirectly using RpWorldStreamRead or RpClumpStreamRead have mipmaps processed in a different manner. In these cases, the filter mode stored in the binary file affects whether mipmaps are created or not. Artists can control this using the filter modes assigned to each texture in the modeler. For example, in 3ds max if a texture is marked for "pyramidal" filtering, on export this is converted to trilinear, implying a mipmap stack is needed.
Parameters:
enable  An RwBool value equal to TRUE if mipmaps are required or FALSE if they are not.
Returns:
Returns TRUE
See also:
RwTextureGetMipmapping , RwTextureSetAutoMipmapping , RwTextureGetAutoMipmapping , RwTextureRead
RwTexture* RwTextureSetName RwTexture   texture,
const RwChar   name
 

RwTextureSetName is used to give the specified texture the given name. Textures with names can be searched for in texture dictionaries.

Parameters:
texture  A pointer to the texture whose name will be defined
name  A pointer to the texture's name to set
Returns:
Returns a pointer to the texture
See also:
RwTextureGetName , RwTextureSetMaskName , RwTextureCreate , RwTextureRead
RwTexture* RwTextureSetRaster RwTexture   texture,
RwRaster   raster
 

RwTextureSetRaster is used to specify a raster that will store the pixels of the given texture. To be used as a texture the raster must have been created with either type flag rwRASTERTYPETEXTURE or rwRASTERTYPECAMERATEXTURE and to be of a size and depth compatible with the particular device it is created for.

Parameters:
texture  A pointer to the texture whose raster will be set
raster  A pointer to the raster
Returns:
Returns a pointer to the texture if successful or NULL if there is an error
See also:
RwTextureGetRaster , RwTextureCreate , RwRasterCreate
RwBool RwTextureSetReadCallBack RwTextureCallBackRead    callBack
 

RwTextureSetReadCallBack is used to override the function that will be used to read textures from image files.

The default texture loading mechanism can be used to read any image formats that have been registered with RwImageRegisterImageFormat.

Parameters:
callBack  A pointer to the texture-reading function
Returns:
Returns TRUE
See also:
RwTextureGetReadCallBack , RwTextureSetFindCallBack , RwTextureGetFindCallBack , RwTextureRead , RwImageRead
RwInt32 RwTextureSetStreamAlwaysCallBack RwUInt32    pluginID,
RwPluginDataChunkAlwaysCallBack    alwaysCB
 

RwTextureSetStreamAlwaysCallBack is used to associate a binary stream functionality with a previously registered texture plugin. This callback is called for all plugins after stream data reading has completed.

Parameters:
pluginID  An RwInt32 value equal to the plugin ID. (This must be unique. It is used to identify binary chunks.)
alwaysCB  The callback used when object base and plugin data reading is complete
Returns:
Returns an RwInt32 containing the byte offset within the texture of memory reserved for this plugin, or a negative value if there is an error
See also:
RwTextureRegisterPluginStream , RwTextureRegisterPlugin , RwTextureGetPluginOffset , RwTextureValidatePlugins
RwUInt32 RwTextureStreamGetSize const RwTexture   texture
 

RwTextureStreamGetSize is used to determine the size in bytes of the binary representation of the specified texture. This is used in the binary chunk header to indicate the size of the texture chunk. The size does not include the size of the chunk header.

Parameters:
texture  A pointer to the texture whose binary size is required.
Returns:
Returns the chunk size of the texture.
See also:
RwTextureStreamRead , RwTextureStreamWrite , RwTextureRead
RwTexture* RwTextureStreamRead RwStream   stream
 

RwTextureStreamRead is used to read a texture from the specified binary stream. Prior to this function call a binary texture chunk must have been found in the stream.

The sequence to locate and read a texture from a binary stream connected to a disk file is as follows:

   RwStream *stream;
   RwTexture *newTexture;
  
   stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "mybinary.xxx");
   if( stream )
   {
       if( RwStreamFindChunk(stream, rwID_TEXTURE, NULL, NULL) )
       {
           newTexture = RwTextureStreamRead(stream);
       }
  
       RwStreamClose(stream, NULL);
   }
Parameters:
stream  A pointer to the binary stream from which the texture will be read
Returns:
Returns a pointer to the texture if successful or NULL if there is an error
See also:
RwTextureStreamGetSize , RwTextureStreamWrite , RwStreamOpen , RwStreamClose , RwStreamFindChunk
const RwTexture* RwTextureStreamWrite const RwTexture   texture,
RwStream   stream
 

RwTextureStreamWrite is used to write the specified texture to the given binary stream. The stream must have been opened prior to this function call.

Parameters:
texture  A pointer to the texture to be written
stream  A pointer to the binary stream
Returns:
Returns a pointer to the texture if successful, or NULL if there is an error
Note:
Note that this API call does not serialize the pixel data for the texture. To serialize the pixel data you must use texture dictionaries.
See also:
RwTextureStreamGetSize , RwTextureStreamRead , RwTexDictionaryStreamWrite , RwStreamOpen , RwStreamClose
RwBool RwTextureValidatePlugins const RwTexture   texture
 

RwTextureValidatePlugins is used to validate the plugin memory allocated within the specified texture. This function is useful for determining where memory trampling may be occurring within an application.

This function only returns a meaningful response under a debug library.

Parameters:
texture  A pointer to the texture to validate
Returns:
Returns TRUE is the texture data is valid or FALSE if there is an error or if the texture data has become corrupt
See also:
RwTextureRegisterPlugin , RwTextureRegisterPluginStream , RwTextureGetPluginOffset

Criterion Software © 1993-2003 Criterion Software Limited. All rights reserved. Built Tue Apr 22 12:46:15 2003. Send Feedback
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)