This object represents a Texture Dictionary: a database of Textures (RwTexture) and their associated Rasters (RwRaster). They may be used in two main ways:
See:
When an attempt is made to load a texture, the current dictionary is first searched if one is defined. If there is no current dictionary, then all dictionaries in the system are searched. If the texture is not found, then the image file is read from disk. See also:
If a texture is loaded from a file, then it is automatically added to the current dictionary if one is defined. Alternatively, a texture may be added to a dictionary manually using RwTexDictionaryAddTexture, but note that a texture may only be attached to one dictionary at a time.
A texture's reference count is not actually incremented when it is added to a dictionary. When the texture is destroyed ( RwTextureDestroy is called for the last reference) it is also removed from the dictionary. Any other objects that are created or loaded and require the texture after this will cause it to be loaded again. To avoid this, a texture may be made to persist in the dictionary by incrementing its reference count with RwTextureAddRef. Note that if a texture dictionary is read in from a stream, then its textures are automatically made persistent.
A dictionary should not be destroyed until all objects referencing textures in the dictionary have been destroyed first. After this, the only textures that should remain are those that have been made persistent, and they should have a reference count of 1. They will be destroyed during a call to RwTexDictionaryDestroy since this calls RwTextureDestroy for any remaining textures.
See:
These are for iterating over all textures in a dictionary or all dictionaries in the system. See:
See:
When a saved dictionary is streamed in, the textures do have reference counts for their dictionary entry. This means that objects using the textures may be created and destroyed without the textures being completely destroyed and removed from the dictionary. When the textures are no longer required, destruction of the dictionary will cause them to be destroyed.
Developers should note that, when written to a RenderWare Binary Stream, Texture Dictionaries also store the associated Rasters. Rasters are, by definition, platform-dependent, so Texture Dictionaries cannot normally be read on platforms other than those on which they were generated.
If a texture dictionary would be usefully read on multiple platforms, then a Platform Independent Texture Dictionary can be created. See RtPITexD for more details.
See:
|
|
RwTexDictionaryCallBack represents the function called from RwTexDictionaryForAllTexDictionaries for all texture dictionaries that currently exist. This function should return the current texture dictionary to indicate success. The callback may return NULL to terminate further callbacks on the texture dictionary. It may safely destroy the current texture dictionary without adversely affecting the iteration process.
|
|
||||||||||||
|
RwTexDictionaryAddTexture is used to add the specified texture to the given texture dictionary. It is recommended that the texture is named so that it can be identified when searching the texture dictionaries.
|
|
|
RwTexDictionaryCreate is used to create a new texture dictionary for storing textures.
|
|
|
RwTexDictionaryDestroy is used to destroy the specified texture dictionary. If the dictionary is the current one, the current dictionary is set to NULL. Any objects that reference textures in the dictionary must be destroyed first. The only textures that should then remain in the dictionary are those that were either streamed in with the dictionary, or forced to be persistent by incrementing their reference count. The reference count should be 1. RwTexDictionaryDestroy will call RwTextureDestroy for these remaining textures so that they will be removed from the system.
|
|
||||||||||||
|
RwTexDictionaryFindNamedTexture is used to find the specified named texture in the given texture dictionary. The search is only performed on the texture's name and not on the texture's pointer. Hence, the texture must have been named prior to this function call.
|
|
||||||||||||
|
RwTexDictionaryForAllTexDictionaries is used to execute the given callback function on all currently existing texture dictionaries. The format of the callback function is:
RwTexDictionary * (*RwTexDictionaryCallBack) (RwTexDictionary *dict, void *data) where data is a user-supplied data pointer to pass to the callback function.
|
|
||||||||||||||||
|
RwTexDictionaryForAllTextures is used to execute the given callback function on all textures in the specified texture dictionary. The format of the callback function is:
RwTexture * (*RwTextureCallBack) (RwTexture *texture, void *data) where data is a user-supplied data pointer to pass to the callback function.
|
|
|
RwTexDictionaryGetCurrent is used to retrieve the current texture dictionary, if any. See RwTexDictionary Overview for details of how the current dictionary is used.
|
|
|
RwTexDictionaryGetPluginOffset is used to get the offset of a previously registered plugin.
|
|
||||||||||||||||||||||||
|
RwTexDictionaryRegisterPlugin is used to register a plugin and reserve some space within a texture dictionary. This must happen after the engine has been initialized but before the engine is opened.
|
|
||||||||||||||||||||
|
RwTexDictionaryRegisterPluginStream is used to associate a set of binary stream functionality with a previously registered TexDictionary Plugin.
|
|
|
RwTexDictionaryRemoveTexture is used to remove the specified texture from the texture dictionary it is a member of. Removing the texture from the dictionary does not actually destroy it, so if this is the intention, use RwTextureDestroy in place of this function (see also the discussion in RwTexDictionary Overview).
|
|
|
RwTexDictionarySetCurrent is used to specify the current texture dictionary. Use NULL to indicate that there is no default texture dictionary. See RwTexDictionary Overview for details of how the current dictionary is used.
|
|
||||||||||||
|
RwTexDictionarySetStreamAlwaysCallBack is used to associate a binary stream functionality with a previously registered TexDictionary Plugin. This callback is called for all plugins after stream data reading has completed.
|
|
|
RwTexDictionaryStreamGetSize is used to determine the size in bytes of the binary representation of the specified texture dictionary. 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.
|
|
|
RwTexDictionaryStreamRead is used to read a texture dictionary from the specified binary stream. Prior to this function call, a binary texture dictionary chunk must have been found in the stream.
RwStream *stream; RwTexDictionary *newTexDictionary; stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "mybinary.xxx"); if( stream ) { if( RwStreamFindChunk(stream, rwID_TEXDICTIONARY, NULL, NULL) ) { newTexDictionary = RwTexDictionaryStreamRead(stream); } RwStreamClose(stream, NULL); }
|
|
||||||||||||
|
RwTexDictionaryStreamWrite is used to write the specified texture dictionary to the given binary stream. The stream must have been opened prior to this function call.
|
|
|
RwTexDictionaryValidatePlugins is used to validate the plugin memory allocated within the specified texture dictionary. 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.
|
© 1993-2004 Criterion Software Limited. All rights reserved. Built Thu Feb 12 13:46:53 2004.
Send Feedback