![]() |
DI-Guy SDK Documentation
13.1
|
A class that represents a shared texture. Can be subclassed by filling out the diguy_graphics_set_texture_create_func(). More...
#include <diguyGraphicsTexture.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... | |
| const char * | get_filename () |
| This function returns the filename of the texture. More... | |
| int | get_width () |
| Returns: the width of the texture, in pixels; -1 on failure. More... | |
| int | get_height () |
| Returns: the height of the texture, 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... | |
| unsigned char * | get_texture_map_data () |
| 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_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... | |
| void | free_loader_memory () |
| 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 | 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 diguyGraphicsTexture * | get_last_bound_texture (int texture_unit=0) |
| This function returns the last bound texture used by DI-Guy. More... | |
| static void | clear_last_bound_texture () |
| This function clears out the last bound texture variable. More... | |
Private Functions | |
The functions and variables past this point are for internal use only. No external access to them is expected or necessary. | |
| bdiGeometryTextureFile * | m_scripted_object |
| A pointer to internal data. More... | |
| class | bdiGeometryTextureFile |
| class | bdiGeometryFactory |
| bdiGeometryTextureFile * | get_scripted_object () |
| diguyGraphicsTexture (void *internal_data) | |
| A protected constructor. More... | |
| virtual | ~diguyGraphicsTexture () |
| A protected destructor. More... | |
A class that represents a shared texture. Can be subclassed by filling out the diguy_graphics_set_texture_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* diguyGraphicsTexture::get_name | ( | ) |
Returns the name of the texture.
This pointer will never be NULL.
Returns:
name of the texture
| const char* diguyGraphicsTexture::get_filename | ( | ) |
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
| int diguyGraphicsTexture::get_width | ( | ) |
Returns: the width of the texture, in pixels; -1 on failure.
| int diguyGraphicsTexture::get_height | ( | ) |
Returns: the height of the texture, in pixels; -1 on failure.
| int diguyGraphicsTexture::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 diguyGraphicsTexture::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
| unsigned char* diguyGraphicsTexture::get_texture_map_data | ( | ) |
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 diguyGraphicsTexture::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 diguyGraphicsTexture::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 diguyGraphicsTexture::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 diguyGraphicsTexture::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 diguyGraphicsTexture::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 diguyGraphicsTexture::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* diguyGraphicsTexture::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 diguyGraphicsTexture::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 diguyGraphicsTexture::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 diguyGraphicsTexture::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
| void diguyGraphicsTexture::free_loader_memory | ( | ) |
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 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 diguyOsgGraphicsTexture, and diguyOglGraphicsTexture.
|
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 diguyOsgGraphicsTexture, and diguyOglGraphicsTexture.
|
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 diguyOglGraphicsTexture.
|
static |
This function returns the last bound texture used by DI-Guy.
This value can be used in diguyGraphicsTexture::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:
|
static |
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.