class
TextureTable
TextureTable keeps information on textures used while rendering.
Methods
Method | Description |
AddItem | Adds an item to the table. The returned value is the id of the item within the table, which can be used to retrieve the item using GetItem(). |
AddTexture | Adds a texture to the table. The returned value is the id of the texture within the table. |
ChangeTexturePrefixPath | Changes the prefix path (drive, directory) of all matching texture paths in all the textures in the table, with the new one. This method is useful when external textures are placed in a specific folder, which needs to be moved. |
Clear | Clears the table, and removes all items. If AddItem is called after Clear, the item ids will start over from 0. |
Copy | Clears the current table and copies the items from a source table. |
FindItem | Finds a named item in the table. If multiple items have the same name, the first will be returned. If no item was found, null will be returned. |
FindItemId | Finds the id of an item in the table, using the name. If multiple items have the same name, the first will be returned. If no item was found, the return will be -1. |
FindTexture | Finds a texture in the table, using the texture name. If multiple textures have the same name, the first will be returned. If the texture was not found, null will be returned. |
FindTextureId | Finds the id of a texture in the table, using the texture name. If multiple textures have the same name, the first will be returned. If the texture was not found, -1 will be returned. |
FindTextureUsingPath | Finds a texture in the table, using the texture path. If multiple textures have the same path, the first will be returned. If the texture was not found, null will be returned. |
GetClass | Get the name of the TextureTable class. |
GetItem | Returns the i:th item, using the id of the item. |
GetItemsCount | The number of item id:s in the table. If an item has been removed, using RemoveItem, the id is still counted in this method. GetIdsCount also equals the id that will be applied to the next item added to the table. |
GetTexture | Returns the i:th texture, using the id of the texture. |
GetTexturesCount | Returns the number of textures in the table. |
IsA | Returns true if TextureTable is a or is a descendant of the class named as the type parameter. |
IsNull | Returns true if the TextureTable object is invalid. |
RemoveItem | Removes an item, and invalidates the id. The id will not point at a valid item, until Clear is called and new items are added up until the id. |
RemoveTexture | Removes a texture. If GetTexture is called with the texture id, the value returned will be null. |
SetItem | Sets an item in the table. The id must exist in the table. |
SetTexture | Sets a texture in the table. |
Static methods
Method | Description |
IsClassA | Returns true if the class is a or is a descendant of the class named as the type parameter. |
SafeCast | SafeCast makes sure the input object is of a class that can be cast into spTextureTable, and if this is the case, returns the object cast into spTextureTable. |
Methods details
AddItem
Adds an item to the table. The returned value is the id of the item within the table, which can be used to retrieve the item using GetItem().
Syntax
Parameters
Type | Name | Min | Max | Description |
Object | item | | | Is the item that is to be added to the table. |
Return value
Type: rid
Syntax
Parameters
Type | Name | Min | Max | Description |
Object | item | | | Is the item that is to be added to the table. |
Return value
Type: rid
Syntax
Parameters
Name | Type | Min | Max | Description |
item | Object | | | Is the item that is to be added to the table. |
Return value
Type: int
AddTexture
Adds a texture to the table. The returned value is the id of the texture within the table.
Syntax
Parameters
Type | Name | Min | Max | Description |
Texture | texture | | | The texture to add into the table. |
Return value
Type: rid
Syntax
Parameters
Type | Name | Min | Max | Description |
Texture | texture | | | The texture to add into the table. |
Return value
Type: rid
Syntax
Parameters
Name | Type | Min | Max | Description |
texture | Texture | | | The texture to add into the table. |
Return value
Type: int
ChangeTexturePrefixPath
Changes the prefix path (drive, directory) of all matching texture paths in all the textures in the table, with the new one. This method is useful when external textures are placed in a specific folder, which needs to be moved.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | current_path_prefix | | | The current prefix path, either relative or absolute. |
const char * | new_path_prefix | | | The new prefix path. |
Syntax
Parameters
Type | Name | Min | Max | Description |
string | current_path_prefix | | | The current prefix path, either relative or absolute. |
string | new_path_prefix | | | The new prefix path. |
Syntax
Parameters
Name | Type | Min | Max | Description |
current_path_prefix | str | | | The current prefix path, either relative or absolute. |
new_path_prefix | str | | | The new prefix path. |
Clear
Clears the table, and removes all items. If AddItem is called after Clear, the item ids will start over from 0.
Syntax
Parameters
Clear takes no parameters.
Syntax
Parameters
Clear takes no parameters.
Syntax
Parameters
Clear takes no parameters.
Copy
Clears the current table and copies the items from a source table.
Syntax
Parameters
Type | Name | Min | Max | Description |
Table | src | | | The table to copy. |
Syntax
Parameters
Type | Name | Min | Max | Description |
Table | src | | | The table to copy. |
Syntax
Parameters
Name | Type | Min | Max | Description |
src | Table | | | The table to copy. |
FindItem
Finds a named item in the table. If multiple items have the same name, the first will be returned. If no item was found, null will be returned.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | name | | | Is the string that is to be searched for. |
Return value
Type: Object
Syntax
Parameters
Type | Name | Min | Max | Description |
string | name | | | Is the string that is to be searched for. |
Return value
Type: Object
Syntax
Parameters
Name | Type | Min | Max | Description |
name | str | | | Is the string that is to be searched for. |
Return value
Type: Object
FindItemId
Finds the id of an item in the table, using the name. If multiple items have the same name, the first will be returned. If no item was found, the return will be -1.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | name | | | Is the string that is to be searched for. |
Return value
Type: rid
Syntax
Parameters
Type | Name | Min | Max | Description |
string | name | | | Is the string that is to be searched for. |
Return value
Type: rid
Syntax
Parameters
Name | Type | Min | Max | Description |
name | str | | | Is the string that is to be searched for. |
Return value
Type: int
FindTexture
Finds a texture in the table, using the texture name. If multiple textures have the same name, the first will be returned. If the texture was not found, null will be returned.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | name | | | The texture name to look for. |
Return value
Type: Texture
Syntax
Parameters
Type | Name | Min | Max | Description |
string | name | | | The texture name to look for. |
Return value
Type: Texture
Syntax
Parameters
Name | Type | Min | Max | Description |
name | str | | | The texture name to look for. |
Return value
Type: Texture
FindTextureId
Finds the id of a texture in the table, using the texture name. If multiple textures have the same name, the first will be returned. If the texture was not found, -1 will be returned.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | name | | | The texture name to look for. |
Return value
Type: rid
Syntax
Parameters
Type | Name | Min | Max | Description |
string | name | | | The texture name to look for. |
Return value
Type: rid
Syntax
Parameters
Name | Type | Min | Max | Description |
name | str | | | The texture name to look for. |
Return value
Type: int
FindTextureUsingPath
Finds a texture in the table, using the texture path. If multiple textures have the same path, the first will be returned. If the texture was not found, null will be returned.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | path | | | Is the texture path. |
Return value
Type: Texture
Syntax
Parameters
Type | Name | Min | Max | Description |
string | path | | | Is the texture path. |
Return value
Type: Texture
Syntax
Parameters
Name | Type | Min | Max | Description |
path | str | | | Is the texture path. |
Return value
Type: Texture
GetClass
Get the name of the TextureTable class.
Syntax
Parameters
GetClass takes no parameters.
Return value
Type: spString
Syntax
Parameters
GetClass takes no parameters.
Return value
Type: string
Syntax
Parameters
GetClass takes no parameters.
Return value
Type: str
GetItem
Returns the i:th item, using the id of the item.
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | Is the id of the requested object. |
Return value
Type: Object
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | Is the id of the requested object. |
Return value
Type: Object
Syntax
Parameters
Name | Type | Min | Max | Description |
id | int | | | Is the id of the requested object. |
Return value
Type: Object
GetItemsCount
The number of item id:s in the table. If an item has been removed, using RemoveItem, the id is still counted in this method. GetIdsCount also equals the id that will be applied to the next item added to the table.
Syntax
Parameters
GetItemsCount takes no parameters.
Return value
Type: unsigned int
Syntax
Parameters
GetItemsCount takes no parameters.
Return value
Type: uint
Syntax
Parameters
GetItemsCount takes no parameters.
Return value
Type: int
GetTexture
Returns the i:th texture, using the id of the texture.
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | The id of the texture in the table. |
Return value
Type: Texture
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | The id of the texture in the table. |
Return value
Type: Texture
Syntax
Parameters
Name | Type | Min | Max | Description |
id | int | | | The id of the texture in the table. |
Return value
Type: Texture
GetTexturesCount
Returns the number of textures in the table.
Syntax
Parameters
GetTexturesCount takes no parameters.
Return value
Type: unsigned int
Syntax
Parameters
GetTexturesCount takes no parameters.
Return value
Type: uint
Syntax
Parameters
GetTexturesCount takes no parameters.
Return value
Type: int
IsA
Returns true if TextureTable is a or is a descendant of the class named as the type parameter.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | type | | | Name of the class to check if TextureTable is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
Type | Name | Min | Max | Description |
string | type | | | Name of the class to check if TextureTable is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
Name | Type | Min | Max | Description |
type | str | | | Name of the class to check if TextureTable is, or is a descendant of. |
Return value
Type: bool
IsNull
Returns true if the TextureTable object is invalid.
Syntax
Parameters
IsNull takes no parameters.
Return value
Type: bool
Syntax
Parameters
IsNull takes no parameters.
Return value
Type: bool
Syntax
Parameters
IsNull takes no parameters.
Return value
Type: bool
RemoveItem
Removes an item, and invalidates the id. The id will not point at a valid item, until Clear is called and new items are added up until the id.
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | The id of the object that should be removed. |
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | The id of the object that should be removed. |
Syntax
Parameters
Name | Type | Min | Max | Description |
id | int | | | The id of the object that should be removed. |
RemoveTexture
Removes a texture. If GetTexture is called with the texture id, the value returned will be null.
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | The id of the texture in the table. |
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | The id of the texture in the table. |
Syntax
Parameters
Name | Type | Min | Max | Description |
id | int | | | The id of the texture in the table. |
SetItem
Sets an item in the table. The id must exist in the table.
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | Is the id that is to be set. |
Object | item | | | Is the object set to the id. |
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | Is the id that is to be set. |
Object | item | | | Is the object set to the id. |
Syntax
Parameters
Name | Type | Min | Max | Description |
id | int | | | Is the id that is to be set. |
item | Object | | | Is the object set to the id. |
SetTexture
Sets a texture in the table.
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | The id of the texture in the table. |
Texture | texture | | | The texture to set into the table. |
Syntax
Parameters
Type | Name | Min | Max | Description |
rid | id | | | The id of the texture in the table. |
Texture | texture | | | The texture to set into the table. |
Syntax
Parameters
Name | Type | Min | Max | Description |
id | int | | | The id of the texture in the table. |
texture | Texture | | | The texture to set into the table. |
Static methods details
IsClassA
Returns true if the class is a or is a descendant of the class named as the type parameter.
Syntax
Parameters
Type | Name | Min | Max | Description |
const char * | type | | | Name of the class to check if the class is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
Type | Name | Min | Max | Description |
string | type | | | Name of the class to check if the class is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
Name | Type | Min | Max | Description |
type | str | | | Name of the class to check if the class is, or is a descendant of. |
Return value
Type: bool
SafeCast
SafeCast makes sure the input object is of a class that can be cast into spTextureTable, and if this is the case, returns the object cast into spTextureTable.
Syntax
Parameters
Type | Name | Min | Max | Description |
Object | object | | | Object to cast. |
Return value
Type: TextureTable
Syntax
Parameters
Type | Name | Min | Max | Description |
Object | object | | | Object to cast. |
Return value
Type: TextureTable
Syntax
Parameters
Name | Type | Min | Max | Description |
object | Object | | | Object to cast. |
Return value
Type: TextureTable