|
NSUNI/NSLAR Library a250670
|
Classes | |
| struct | nnl::texture::TextureData |
| Structure representing image data of a texture. More... | |
| struct | nnl::texture::Texture |
| Structure representing a texture. More... | |
| struct | nnl::texture::ConvertParam |
| Structure to hold parameters for texture conversion. More... | |
Typedefs | |
| using | nnl::texture::TextureContainer = std::vector<Texture> |
| Type alias for a container of textures. | |
Functions | |
| std::vector< STexture > | nnl::texture::Convert (const TextureContainer &texture_container, bool mipmaps=false) |
| Converts a container of textures to a simplified representation. | |
| TextureContainer | nnl::texture::Convert (std::vector< STexture > &&images, const ConvertParam &texture_params={}) |
| Converts a vector of simplified textures into the in-game format. | |
| bool | nnl::texture::IsOfType (BufferView buffer) |
| Tests if the provided file is a texture container. | |
| TextureContainer | nnl::texture::Import (BufferView buffer) |
| Parses a binary file and converts it to a structured texture container. | |
| Buffer | nnl::texture::Export (const TextureContainer &texture_container) |
| Converts a texture container to its binary file representation. | |
Variables | |
| constexpr unsigned int | nnl::texture::kMinDimension = 1 |
| Minimum allowed width and height of a texture in pixels. | |
| constexpr unsigned int | nnl::texture::kMinByteBufferWidth = 16 |
| Minimum width of a texture buffer in bytes (as expected by the GE). The actual pixel width can be smaller than this. | |
| constexpr unsigned int | nnl::texture::kMaxDimension = 1024 |
| Maximum allowed width and height of a texture in pixels. | |
| constexpr std::size_t | nnl::texture::kMaxMipMapLvl = 7 |
| The maximum number of mipmap levels that can be used. | |
| constexpr std::size_t | nnl::texture::kMaxTextureLvl = 1 + kMaxMipMapLvl |
| The maximum number of texture levels. | |
| struct nnl::texture::TextureData |
Structure representing image data of a texture.
It can be used to represent both the main texture level and its mipmaps.
Public Attributes | |
| u16 | width = 0 |
| Width of the texture in pixels. It must be a power of 2. | |
| u16 | height = 0 |
| u16 | buffer_width = 0 |
| Buffer | bitmap_buffer |
| Raw bitmap data. Its interpretation depends on the texture_format. | |
| Buffer nnl::texture::TextureData::bitmap_buffer |
Raw bitmap data. Its interpretation depends on the texture_format.
| u16 nnl::texture::TextureData::buffer_width = 0 |
Width of the bitmap_buffer in pixels. It must be greater than or equal to the width. The buffer width in bytes must be a multiple of 16. For example, in a CLUT4 texture, this value must be at least 32 pixels.
| u16 nnl::texture::TextureData::height = 0 |
Height of the texture in pixels. It generally should be a power of 2. However, it may not always be the case for UI textures.
| u16 nnl::texture::TextureData::width = 0 |
Width of the texture in pixels. It must be a power of 2.
| struct nnl::texture::Texture |
Structure representing a texture.
This struct encapsulates all the necessary information for a texture. It can store both the main texture level and its mipmaps.
Public Attributes | |
| Buffer | clut_buffer |
| utl::static_vector< TextureData, kMaxTextureLvl > | texture_data |
| TextureFormat | texture_format = TextureFormat::kCLUT8 |
| Format of the texture data. | |
| bool | swizzled = true |
| TextureFilter | min_filter = TextureFilter::kLinearMipmapNearest |
| Minification filter method for texture sampling. | |
| TextureFilter | mag_filter = TextureFilter::kLinear |
| ClutFormat | clut_format = ClutFormat::kRGBA8888 |
| Format of the CLUT data. | |
| Buffer nnl::texture::Texture::clut_buffer |
Color Look Up Table. It's used when texture_format is set to one of the CLUT formats.
| ClutFormat nnl::texture::Texture::clut_format = ClutFormat::kRGBA8888 |
Format of the CLUT data.
| TextureFilter nnl::texture::Texture::mag_filter = TextureFilter::kLinear |
Magnification filter method for texture sampling: kLinear or kNearest.
| TextureFilter nnl::texture::Texture::min_filter = TextureFilter::kLinearMipmapNearest |
Minification filter method for texture sampling.
| bool nnl::texture::Texture::swizzled = true |
Indicates whether the texture data is reorganized for more efficient use by the GE
| utl::static_vector<TextureData, kMaxTextureLvl> nnl::texture::Texture::texture_data |
Stores various levels of the texture. Index 0 contains the full-resolution base texture, with subsequent indices storing mipmaps. Limited to 8 levels in total.
| TextureFormat nnl::texture::Texture::texture_format = TextureFormat::kCLUT8 |
Format of the texture data.
| struct nnl::texture::ConvertParam |
Structure to hold parameters for texture conversion.
This structure encapsulates various parameters that control the behavior of texture conversion from a simplified representation to the in-game format.
Public Attributes | |
| TextureFormat | texture_format = TextureFormat::kCLUT8 |
| The format the texture will be converted to. | |
| ClutFormat | clut_format = ClutFormat::kRGBA8888 |
| bool | clut_dither = true |
| unsigned int | max_mipmap_lvl = kMaxMipMapLvl |
| The maximum number of mipmap levels to generate. | |
| bool | gen_small_mipmap = false |
| unsigned int | max_width_height = kMaxDimension / 2 |
| bool | swizzle = true |
| bool nnl::texture::ConvertParam::clut_dither = true |
Whether dithering should be applied to the texture if a CLUT format is used. This may give an illusion of a greater color variety.
| ClutFormat nnl::texture::ConvertParam::clut_format = ClutFormat::kRGBA8888 |
The format the color lookup table will use (if texture_format uses it).
| bool nnl::texture::ConvertParam::gen_small_mipmap = false |
Whether to generate mipmaps with width that is smaller than the minimum buffer width.
| unsigned int nnl::texture::ConvertParam::max_mipmap_lvl = kMaxMipMapLvl |
The maximum number of mipmap levels to generate.
| unsigned int nnl::texture::ConvertParam::max_width_height = kMaxDimension / 2 |
Maximum dimensions for the texture; larger textures will be resized.
| bool nnl::texture::ConvertParam::swizzle = true |
Whether to reorganize the texture data for more efficient use.
| TextureFormat nnl::texture::ConvertParam::texture_format = TextureFormat::kCLUT8 |
The format the texture will be converted to.
| using nnl::texture::TextureContainer = std::vector<Texture> |
Type alias for a container of textures.
|
strong |
Enumeration of color formats used in Color Lookup Tables (CLUT).
|
strong |
Enumeration of texture filtering methods.
This enum defines various texture filtering methods that can be applied when rendering textures larger or smaller than their original size.
The filtering methods include options that can be used for both magnification and minification, as well as mipmapping.
These values map directly to what the GE expects.
|
strong |
Enumeration of texture formats.
This enum defines the various texture formats that can be used to store texture data. The values correspond to what is expected by the GE. Technically, there are a few more formats available, but they are not used by the games and are rare in general.
| std::vector< STexture > nnl::texture::Convert | ( | const TextureContainer & | texture_container, |
| bool | mipmaps = false ) |
Converts a container of textures to a simplified representation.
This function takes a TextureContainer containing multiple in-game textures and converts each texture into a simplified representation.
| texture_container | The input container holding the textures to be converted. |
| mipmaps | A flag indicating whether mipmaps should be extracted as well. |
| TextureContainer nnl::texture::Convert | ( | std::vector< STexture > && | images, |
| const ConvertParam & | texture_params = {} ) |
Converts a vector of simplified textures into the in-game format.
This function takes a vector of STexture images and converts them into a TextureContainer, applying the specified conversion parameters.
| images | A vector of STexture objects representing the textures to be converted. |
| texture_params | A ConvertParam object specifying the conversion settings for each texture. |
|
nodiscard |
Converts a texture container to its binary file representation.
This function takes a TextureContainer object and converts it into the binary format.
| texture_container | The TextureContainer object to be converted. |
| TextureContainer nnl::texture::Import | ( | BufferView | buffer | ) |
Parses a binary file and converts it to a structured texture container.
This function takes a binary representation of a texture container, parses its contents, and converts them into a TextureContainer vector for easier access and manipulation.
| buffer | The binary file to be processed. |
| bool nnl::texture::IsOfType | ( | BufferView | buffer | ) |
Tests if the provided file is a texture container.
This function takes a file buffer and checks whether it corresponds to the in-game texture container format.
| buffer | The file buffer to be tested. |
|
constexpr |
Maximum allowed width and height of a texture in pixels.
The GE supports a maximum width of only 512 pixels. However, emulators can handle textures up to 1024 pixels in width and height.
|
constexpr |
The maximum number of mipmap levels that can be used.
|
constexpr |
The maximum number of texture levels.
|
constexpr |
Minimum width of a texture buffer in bytes (as expected by the GE). The actual pixel width can be smaller than this.
|
constexpr |
Minimum allowed width and height of a texture in pixels.