![]() |
DI-Guy SDK Documentation
13.7
|
A class that represents a shared 2D texture array. More...
#include <diguyGraphicsTextureArray.h>
Public Member Functions | |
Accessor Functions | |
The functions in this section provide access to data in this object. They are designed to be called by DI-Guy programmers. Unless noted all functions in this section are callable from:
| |
| const char * | get_name () |
| Returns the name of the texture. More... | |
| int | get_num_textures () const |
| returns the number of textures in texture array More... | |
| diguyGraphicsTexture * | get_texture_at_index (int index) |
| returns a pointer to sub texture More... | |
| const char * | get_filename (int index) const |
| This function returns the filename of the texture. More... | |
| const char * | get_ui_name (int index) const |
| gets the UI friendly name of the texture More... | |
| const char * | get_full_filename (int index) const |
| Returns: Where diguy found the file name... will be null if source data isn't available. More... | |
| const char * | get_cached_dds_filename (int index) const |
| Returns: The file after transformation and stored in compressed_texture_cache. More... | |
| int | get_width () |
| Returns the width of the texture array, in pixels; -1 on failure. More... | |
| int | get_height () |
| Returns the height of the texture array, in pixels; -1 on failure. More... | |
| int | get_num_components () |
| This function returns how many components the texture has. More... | |
| int | get_contains_alpha_component () |
| This function returns whether the texture contains an alpha component. More... | |
| int | get_is_clip_map () |
| Returns if this texture should be rendered with alpha to coverage, Clip maps have 4 channels but return false for get_contains_alpha_component Useful for screen door transparency, and out of order transparency. More... | |
| unsigned char * | get_texture_map_data (int index) |
| This function returns a memory buffer with the actual texture data. More... | |
| int | get_texture_map_data_size () |
| This function returns how many bytes are used by the texture map data buffer. More... | |
| diguyGraphicsTextureCompressionType | get_texture_compression_type () |
| This function returns which compression method, if any, is applied to the data returned bu get_texture_map_data(). More... | |
| int | get_num_included_mipmaps () |
| This function returns how many mipmaps are already included in the texture map data. More... | |
| int | get_mipmap_data_size (int mipmap) |
| This function returns the size of the data, in bytes, of the specified mipmap. More... | |
| int | get_mipmap_data_offset (int mipmap) |
| This function returns the data offset of the specified mipmap into the data pointer returned by get_texture_map_data(). More... | |
| int | get_gl_format () |
| This function returns the OpenGL pixel format enumeration of this texture. More... | |
| const char * | get_gl_format_as_string () |
| This function returns the OpenGL pixel format string of this texture. More... | |
| int | get_is_srgb_texture () |
| returns if texture should use sRGB style format hints, useful in DX11 where gl_format is less useful. More... | |
| int | get_dds_block_size () |
| This function returns the "block size" of the dds compression types. More... | |
| int | get_clamp_s () |
| For texture indices less than zero and greater than one, a decision must be made as to whether the texture is repeated or whether the edge pixels are replicated to fill the space. More... | |
| int | get_clamp_t () |
| For texture indices less than zero and greater than one, a decision must be made as to whether the texture is repeated or whether the edge pixels are replicated to fill the space. More... | |
| int | get_is_in_async_load_queue () |
| Is this texture currently being loaded by the asynchronous texture loader. More... | |
| void | get_approximate_color (int index, float **\return, float *g, float **< b >) |
| Returns an approximation of the overall color based on mip-mapping that was generated when bdg files were built. More... | |
| </b > void | free_loader_memory (int index) |
| This function frees most memory allocated by the DI-Guy geometry loader for this object. More... | |
Virtual Functions | |
The functions in this section are all virtual functions that will be called by DI-Guy at various times during DI-Guy execution. Because the functions are all virtual, DI-Guy programmers can create a subclass of this class and override them. Unless otherwise stated, the base class functions do not need to be called. | |
| virtual void | asynchronous_post_load () |
| This function will be called by DI-Guy after the texture is loaded but before build. More... | |
| virtual void | build () |
| This function will be called by DI-Guy when it is time for a renderer-specific texture object to be created. More... | |
| virtual void | unbuild () |
| This function will be called by DI-Guy when it is time for a renderer-specific texture object to be destroyed. More... | |
| virtual void | bind_now (diguyTextureMapType texture_type) |
| This function will be called by DI-Guy when the texture should be made active, or bound. More... | |
| static void | clear_last_bound_texture () |
| This function returns the last bound texture used by DI-Guy. More... | |
Private Functions | |
The functions and variables past this point are for internal use only. No external access to them is expected or necessary. | |
| bdiGeometryTextureArray * | m_scripted_object |
| A pointer to internal data. More... | |
| class | bdiGeometryTextureFile |
| class | bdiGeometryFactory |
| bdiGeometryTextureArray * | get_scripted_object () |
| diguyGraphicsTextureArray (void *internal_data) | |
| A protected constructor. More... | |
| virtual | ~diguyGraphicsTextureArray () |
| A protected destructor. More... | |
A class that represents a shared 2D texture array.
Can be subclassed by filling out the diguy_graphics_set_texture_array_create_func().
|
protected |
A protected constructor.
Constructors are called automatically by DI-Guy.
|
protectedvirtual |
A protected destructor.
Destructors are called automatically by DI-Guy.
| const char* diguyGraphicsTextureArray::get_name | ( | ) |
Returns the name of the texture.
This pointer will never be NULL.
Returns:
name of the texture array
| int diguyGraphicsTextureArray::get_num_textures | ( | ) | const |
returns the number of textures in texture array
| diguyGraphicsTexture* diguyGraphicsTextureArray::get_texture_at_index | ( | int | index | ) |
returns a pointer to sub texture
| const char* diguyGraphicsTextureArray::get_filename | ( | int | index | ) | const |
This function returns the filename of the texture.
This pointer may be NULL if the texture does not have an associated filename.
Returns:
filename of the texture
| const char* diguyGraphicsTextureArray::get_ui_name | ( | int | index | ) | const |
gets the UI friendly name of the texture
| const char* diguyGraphicsTextureArray::get_full_filename | ( | int | index | ) | const |
Returns: Where diguy found the file name... will be null if source data isn't available.
| const char* diguyGraphicsTextureArray::get_cached_dds_filename | ( | int | index | ) | const |
Returns: The file after transformation and stored in compressed_texture_cache.
| int diguyGraphicsTextureArray::get_width | ( | ) |
Returns the width of the texture array, in pixels; -1 on failure.
| int diguyGraphicsTextureArray::get_height | ( | ) |
Returns the height of the texture array, in pixels; -1 on failure.
| int diguyGraphicsTextureArray::get_num_components | ( | ) |
This function returns how many components the texture has.
The number of components will be an integer between 1 and 4.
Most textures have three components, red (R), green (G), and blue (B), or RGB. These textures commonly have filenames with the extension .rgb.
Four component textures add an alpha (A) channel, resulting in RGBA. These textures commonly have filenames with the extension .rgba.
One component textures have only an intensity (I). These textures commonly have filenames with the extension .int.
Two component textures have only an intensity (I), and an alpha channel. These textures commonly have filenames with the extension .inta.
Returns:
number of components in texture; -1 on failure
| int diguyGraphicsTextureArray::get_contains_alpha_component | ( | ) |
This function returns whether the texture contains an alpha component.
Textures that have an alpha component can make objects semi-transparent, which can affect when said objects should be drawn.
Returns:
1 if texture contains an alpha component, 0 if not; -1 on failure
| int diguyGraphicsTextureArray::get_is_clip_map | ( | ) |
Returns if this texture should be rendered with alpha to coverage, Clip maps have 4 channels but return false for get_contains_alpha_component Useful for screen door transparency, and out of order transparency.
| unsigned char* diguyGraphicsTextureArray::get_texture_map_data | ( | int | index | ) |
This function returns a memory buffer with the actual texture data.
The size of buffer can be obtained by calling get_texture_map_data_size().
The texture information is packed into the buffer row by row, in the following order:
There is one byte per component.
This function should not be called after free_loader_memory() has been called.
Note that some renderers expect to take ownership of the texture data that is passed to them. In this case, a copy of this texture data must be made to avoid a double deletion of the memory. This texture data will be deleted by the call to free_loader_memory(), or when this object is deleted.
Returns:
pointer to texture map data
NOTE: The returned pointer may be NULL, if there was some problem loading the texture file.
Callable From:
| int diguyGraphicsTextureArray::get_texture_map_data_size | ( | ) |
This function returns how many bytes are used by the texture map data buffer.
Returns:
buffer size of texture map data, in bytes; may be 0 in the case of a NULL texture
| diguyGraphicsTextureCompressionType diguyGraphicsTextureArray::get_texture_compression_type | ( | ) |
This function returns which compression method, if any, is applied to the data returned bu get_texture_map_data().
Most often compressed textures come from .dds (DirectDraw Surface) files.
Returns:
compression type enumeration
| int diguyGraphicsTextureArray::get_num_included_mipmaps | ( | ) |
This function returns how many mipmaps are already included in the texture map data.
Typically only .dds (DirectDraw Surface) textures have precomputed mipmaps in them.
Note that values 0 and 1 are somewhat the same: there is only one image in the texture map data: the base, unscaled image.
Returns:
num of included mipmaps
| int diguyGraphicsTextureArray::get_mipmap_data_size | ( | int | mipmap | ) |
This function returns the size of the data, in bytes, of the specified mipmap.
"mipmap" 0 is the base, unscaled image, mipmap 1 is the first scaled image, etc.
Returns:
data size, in bytes, of mipmap; -1 on error
| int diguyGraphicsTextureArray::get_mipmap_data_offset | ( | int | mipmap | ) |
This function returns the data offset of the specified mipmap into the data pointer returned by get_texture_map_data().
"mipmap" 0 is the base, unscaled image, mipmap 1 is the first scaled image, etc.
Returns:
data offset, in bytes, of mipmap; -1 on error
| int diguyGraphicsTextureArray::get_gl_format | ( | ) |
This function returns the OpenGL pixel format enumeration of this texture.
This enumeration will be one of the following:
Returns:
OpenGL pixel format enum; -1 on error
In OpenGL and OSG environments, the returned value should be cast into a GLenum.
| const char* diguyGraphicsTextureArray::get_gl_format_as_string | ( | ) |
This function returns the OpenGL pixel format string of this texture.
There are a large number of potential results depending if compressed textures and/or sRGB textures are enabled.
Example of possible results:
| int diguyGraphicsTextureArray::get_is_srgb_texture | ( | ) |
returns if texture should use sRGB style format hints, useful in DX11 where gl_format is less useful.
| int diguyGraphicsTextureArray::get_dds_block_size | ( | ) |
This function returns the "block size" of the dds compression types.
This value can be useful in generating mipmap data offsets.
Alternatively, the function get_mipmap_data_offset() can be called to get the precomputed mipmap data offsets.
Currently this value will be either 8 (for DXT1 compression) or 16 (for DXT3 and DXT5 compression).
Returns:
block size, in bytes
| int diguyGraphicsTextureArray::get_clamp_s | ( | ) |
For texture indices less than zero and greater than one, a decision must be made as to whether the texture is repeated or whether the edge pixels are replicated to fill the space.
This function returns whether the texture should be repeated horizontally (don't clamp) or whether the edge column of pixels should be used (do clamp).
Note that in MultiGen Creator attribute (.attr) files, this corresponds to the "Wrap Method u" attribute.
Returns:
0 is texture should be tiled, 1 if not; -1 on failure
| int diguyGraphicsTextureArray::get_clamp_t | ( | ) |
For texture indices less than zero and greater than one, a decision must be made as to whether the texture is repeated or whether the edge pixels are replicated to fill the space.
This function returns whether the texture should be repeated vertically (don't clamp) or whether the edge row of pixels should be used (do clamp).
Note that in MultiGen Creator attribute (.attr) files, this corresponds to the "Wrap Method v" attribute.
Returns:
0 is texture should be repeated, 1 if not; -1 on failure
| int diguyGraphicsTextureArray::get_is_in_async_load_queue | ( | ) |
Is this texture currently being loaded by the asynchronous texture loader.
if so you can render an approximation of the color via get_approximate_color()
| void diguyGraphicsTextureArray::get_approximate_color | ( | int | index, |
| float **\ | return, | ||
| float * | g, | ||
| float **< b > | |||
| ) |
Returns an approximation of the overall color based on mip-mapping that was generated when bdg files were built.
| </b> void diguyGraphicsTextureArray::free_loader_memory | ( | int | index | ) |
This function frees most memory allocated by the DI-Guy geometry loader for this object.
This function should only be called during or after the object's build() function has been called. After it has been called, calls to many accessor functions will fail.
|
virtual |
This function will be called by DI-Guy after the texture is loaded but before build.
When asynchronous texture loading is active this provides an opportunity to copy data from DI-Guy structures to end user structures in the background loading thread.
Immediate Mode:
Immediate mode renderers may override this function.
Scene Graph:
Scene graph renderers may override this function, if they are using the async texture loader. may need to be coupled with calls to diguyScenario::run_background_load_update()
Callable From:
Reimplemented in diguyOsgGraphicsTextureArray.
|
virtual |
This function will be called by DI-Guy when it is time for a renderer-specific texture object to be created.
At that point the texture information has been read from the texture file, and is available via the Accessor Functions above.
Immediate Mode:
Immediate mode renderers may override this function, to create an object that may be invoked by bind_now().
Scene Graph:
Scene graph renderers usually do override this function, to create an object that gets associated with diguyGraphicsMesh objects.
Callable From:
Reimplemented in diguyOsgGraphicsTextureArray, and diguyOglGraphicsTextureArray.
|
virtual |
This function will be called by DI-Guy when it is time for a renderer-specific texture object to be destroyed.
Immediate Mode:
Immediate mode renderers may override this function, to destroy any object that may have been created by build().
Scene Graph:
Scene graph renderers usually do override this function, to destroy any object that may have been created by build().
Callable From:
Reimplemented in diguyOsgGraphicsTextureArray, and diguyOglGraphicsTextureArray.
|
virtual |
This function will be called by DI-Guy when the texture should be made active, or bound.
Immediate Mode:
Immediate mode renderers usually do override this function, to invoke the object created by build(), or make calls to the renderer to set appropriate texture state.
Scene Graph:
Scene graph renderers usually do not override this function.
Callable From:
Reimplemented in diguyOsgGraphicsTextureArray, and diguyOglGraphicsTextureArray.
|
static |
This function returns the last bound texture used by DI-Guy.
This value can be used in diguyGraphicsTextureArray::bind() to check to see if a texture rebind is necessary; avoiding a texture rebind can avoid a significant performance hit in some rendering systems.
Callable From:
C++
This function clears out the last bound texture variable. diguyScenario::draw() automatically calls it, but it is also recommended that it be called before drawing individual diguyCharacters in case something outside of DI-Guy has changed the texture.
Callable From:
|
inline |
|
friend |
|
friend |
|
private |
A pointer to internal data.