NSUNI/NSLAR Library a250670
Loading...
Searching...
No Matches
vertexde.hpp File Reference

Contains functions that facilitate conversion of vertex data. More...

Go to the source code of this file.

Classes

struct  nnl::vertexde::VertexLayout
 Structure representing the layout of a vertex. More...

Namespaces

namespace  nnl
namespace  nnl::vertexde
 Contains functions that facilitate conversion of vertex data.
namespace  nnl::vertexde::fmt_code
 This namespace defines constants that represent fundamental format codes.
namespace  nnl::vertexde::fmt_shift
 This namespace contains constants representing shift values that are applied to format codes to create the vertex format constants.
namespace  nnl::vertexde::fmt_mask
 This namespace contains constants representing bit masks for parts of the vertex format.
namespace  nnl::vertexde::fmt
 This namespace contains constants and functions for defining the vertex format.

Functions

constexpr u32 nnl::vertexde::fmt::kWeightNum (u32 weight_num)
 Generates a constant that encodes the number of weights.
constexpr u32 nnl::vertexde::fmt::kMorphNum (u32 morph_num)
 Generates a constant that encodes the number of morph targets.
std::vector< SVertexnnl::vertexde::Decode (BufferView vertex_buffer, u32 vertex_format, std::array< u16, 8 > bone_indices={0})
 Extracts vertex data from a buffer and converts it to a simple representation.
Buffer nnl::vertexde::Encode (const std::vector< SVertex > &vertices, u32 vertex_format, std::array< u16, 8 > bone_indices={0})
 Converts vertex data from a simple representation to a binary vertex buffer.
u32 nnl::vertexde::GetThrough (u32 vertex_format)
 Retrieves the Through Mode status from the vertex format.
u32 nnl::vertexde::GetWeightFormat (u32 vertex_format)
 Retrieves the weight format code from the vertex format.
u32 nnl::vertexde::GetWeightSize (u32 vertex_format)
 Retrieves the byte size of a weight component from the vertex format.
u32 nnl::vertexde::GetWeightNum (u32 vertex_format)
 Retrieves the number of weight components from the vertex format.
u32 nnl::vertexde::GetUVFormat (u32 vertex_format)
 Retrieves the UV format code from the vertex format.
u32 nnl::vertexde::GetUVSize (u32 vertex_format)
 Retrieves the byte size of a UV component from the vertex format.
u32 nnl::vertexde::GetUVNum (u32 vertex_format)
 Retrieves the number of UV components.
u32 nnl::vertexde::GetColorFormat (u32 vertex_format)
 Retrieves the color format code from the vertex format.
u32 nnl::vertexde::GetColorSize (u32 vertex_format)
 Retrieves the byte size of a vertex color from the vertex format.
u32 nnl::vertexde::GetColorNum (u32 vertex_format)
 Retrieves the number of colors.
u32 nnl::vertexde::GetNormalFormat (u32 vertex_format)
 Retrieves the normal format code from the vertex format.
u32 nnl::vertexde::GetNormalSize (u32 vertex_format)
 Retrieves the byte size of a normal component from the vertex format.
u32 nnl::vertexde::GetNormalNum (u32 vertex_format)
 Retrieves the number of normal components from the vertex format.
u32 nnl::vertexde::GetPositionFormat (u32 vertex_format)
 Retrieves the position format code from the vertex format.
u32 nnl::vertexde::GetPositionSize (u32 vertex_format)
 Retrieves the byte size of a position component from the vertex format.
u32 nnl::vertexde::GetPositionNum (u32 vertex_format)
 Retrieves the number of position components.
u32 nnl::vertexde::GetMorphNum (u32 vertex_format)
 Retrieves the number of morph targets from the vertex format.
u32 nnl::vertexde::GetIndexFormat (u32 vertex_format)
 Retrieves the index format code from the vertex format.
u32 nnl::vertexde::GetIndexSize (u32 vertex_format)
 Retrieves the byte size of a single index from the vertex format.
bool nnl::vertexde::HasWeights (u32 vertex_format)
 Checks if the vertex format includes weight information.
bool nnl::vertexde::HasUV (u32 vertex_format)
 Checks if the vertex format includes UV information.
bool nnl::vertexde::HasColor (u32 vertex_format)
 Checks if the vertex format includes color information.
bool nnl::vertexde::HasNormal (u32 vertex_format)
 Checks if the vertex format includes normal information.
bool nnl::vertexde::HasPosition (u32 vertex_format)
 Checks if the vertex format includes position information.
bool nnl::vertexde::IsIndexed (u32 vertex_format)
 Checks if the vertex format uses indexed drawing.
bool nnl::vertexde::IsThrough (u32 vertex_format)
 Checks if the vertex format uses Through Mode (2D drawing).
bool nnl::vertexde::Is8Indices (u32 vertex_format)
 Checks if the vertex format uses 8-bit indices.
bool nnl::vertexde::Is16Indices (u32 vertex_format)
 Checks if the vertex format uses 16-bit indices.
bool nnl::vertexde::Is8Weights (u32 vertex_format)
 Checks if the vertex format uses 8-bit weights.
bool nnl::vertexde::Is16Weights (u32 vertex_format)
 Checks if the vertex format uses 16-bit weights.
bool nnl::vertexde::Is32Weights (u32 vertex_format)
 Checks if the vertex format uses float weights.
bool nnl::vertexde::IsFixedWeights (u32 vertex_format)
 Checks if the vertex format uses fixed-point weights.
bool nnl::vertexde::Is8UV (u32 vertex_format)
 Checks if the vertex format uses 8-bit UVs.
bool nnl::vertexde::Is16UV (u32 vertex_format)
 Checks if the vertex format uses 16-bit UVs.
bool nnl::vertexde::Is32UV (u32 vertex_format)
 Checks if the vertex format uses float UVs.
bool nnl::vertexde::IsFixedUV (u32 vertex_format)
 Checks if the vertex format uses fixed-point UV components.
bool nnl::vertexde::Is565Color (u32 vertex_format)
 Checks if the vertex format uses 565 vertex colors.
bool nnl::vertexde::Is5551Color (u32 vertex_format)
 Checks if the vertex format uses 5551 vertex colors.
bool nnl::vertexde::Is4444Color (u32 vertex_format)
 Checks if the vertex format uses 4444 vertex colors.
bool nnl::vertexde::Is8888Color (u32 vertex_format)
 Checks if the vertex format uses 8888 vertex colors.
bool nnl::vertexde::Is8Normal (u32 vertex_format)
 Checks if the vertex format uses 8-bit normals.
bool nnl::vertexde::Is16Normal (u32 vertex_format)
 Checks if the vertex format uses 16-bit normal components.
bool nnl::vertexde::Is32Normal (u32 vertex_format)
 Checks if the vertex format uses float normals.
bool nnl::vertexde::IsFixedNormal (u32 vertex_format)
 Checks if the vertex format uses fixed-point normals.
bool nnl::vertexde::Is8Position (u32 vertex_format)
 Checks if the vertex format uses 8-bit positions.
bool nnl::vertexde::Is16Position (u32 vertex_format)
 Checks if the vertex format uses 16-bit positions.
bool nnl::vertexde::Is32Position (u32 vertex_format)
 Checks if the vertex format uses float positions.
bool nnl::vertexde::IsFixedPosition (u32 vertex_format)
 Checks if the vertex format uses fixed-point positions.
std::string nnl::vertexde::GetDescription (u32 vertex_format)
 Generates a textual description of the vertex format.
VertexLayout nnl::vertexde::GetLayout (u32 vertex_format)
 Retrieves the layout of a vertex based on its format.

Variables

constexpr u32 nnl::vertexde::fmt_code::k0 = 0
 no component
constexpr u32 nnl::vertexde::fmt_code::k8 = 1
 1 byte component
constexpr u32 nnl::vertexde::fmt_code::k16 = 2
 2 byte component
constexpr u32 nnl::vertexde::fmt_code::k32 = 3
 4 byte component
constexpr u32 nnl::vertexde::fmt_code::k565 = 4
 2 byte color
constexpr u32 nnl::vertexde::fmt_code::k5551 = 5
 2 byte color
constexpr u32 nnl::vertexde::fmt_code::k4444 = 6
 2 byte color
constexpr u32 nnl::vertexde::fmt_code::k8888 = 7
 4 byte color
constexpr u32 nnl::vertexde::fmt::kUV8 = fmt_code::k8 << fmt_shift::kUV
 8-bit fixed-point texture coordinates (unsigned)
constexpr u32 nnl::vertexde::fmt::kUV16 = fmt_code::k16 << fmt_shift::kUV
 16-bit fixed-point texture coordinates (unsigned)
constexpr u32 nnl::vertexde::fmt::kUV32 = fmt_code::k32 << fmt_shift::kUV
 floating-point texture coordinates
constexpr u32 nnl::vertexde::fmt::kColor565 = fmt_code::k565 << fmt_shift::kColor
 2-byte color format. No alpha channel.
constexpr u32 nnl::vertexde::fmt::kColor5551 = fmt_code::k5551 << fmt_shift::kColor
 2-byte color format. 1 bit for the alpha channel.
constexpr u32 nnl::vertexde::fmt::kColor4444 = fmt_code::k4444 << fmt_shift::kColor
 2-byte color format. 4 bits per channel.
constexpr u32 nnl::vertexde::fmt::kColor8888 = fmt_code::k8888 << fmt_shift::kColor
 4-byte color format. 8 bits per channel.
constexpr u32 nnl::vertexde::fmt::kNormal8 = fmt_code::k8 << fmt_shift::kNormal
 8-bit fixed-point vertex normal (signed).
constexpr u32 nnl::vertexde::fmt::kNormal16 = fmt_code::k16 << fmt_shift::kNormal
 16-bit fixed-point vertex normal (signed).
constexpr u32 nnl::vertexde::fmt::kNormal32 = fmt_code::k32 << fmt_shift::kNormal
 floating-point vertex normal.
constexpr u32 nnl::vertexde::fmt::kPosition8 = fmt_code::k8 << fmt_shift::kPosition
 8-bit fixed-point vertex coordinates (signed).
constexpr u32 nnl::vertexde::fmt::kPosition16 = fmt_code::k16 << fmt_shift::kPosition
 16-bit fixed-point vertex coordinates (signed).
constexpr u32 nnl::vertexde::fmt::kPosition32 = fmt_code::k32 << fmt_shift::kPosition
 floating-point vertex coordinates.
constexpr u32 nnl::vertexde::fmt::kWeight8 = fmt_code::k8 << fmt_shift::kWeight
 8-bit fixed-point bone weights (unsigned).
constexpr u32 nnl::vertexde::fmt::kWeight16 = fmt_code::k16 << fmt_shift::kWeight
 16-bit fixed-point bone weights (unsigned).
constexpr u32 nnl::vertexde::fmt::kWeight32 = fmt_code::k32 << fmt_shift::kWeight
 floating-point bone weights.
constexpr u32 nnl::vertexde::fmt::kIndex8 = fmt_code::k8 << fmt_shift::kIndex
 unsigned 8-bit indices (in index buffers)
constexpr u32 nnl::vertexde::fmt::kIndex16 = fmt_code::k16 << fmt_shift::kIndex
 unsigned 16-bit indices (in index buffers)
constexpr u32 nnl::vertexde::fmt::kThrough = 1 << fmt_shift::kThrough
 Indicates whether the 2D drawing mode is used.
constexpr std::array< u32, 8 > nnl::vertexde::format_sizes {0, 1, 2, 4, 2, 2, 2, 4}
 Maps format codes to attribute sizes.

Detailed Description

Contains functions that facilitate conversion of vertex data.

The vertexde namespace provides methods that enable conversion between a simple higher-level vertex representation and binary vertex buffers supported by the GE.

See also
nnl::vertexde::fmt
nnl::vertexde::Decode
nnl::vertexde::Encode
nnl::SVertex
nnl::model::Model