NSUNI/NSLAR Library a250670
Loading...
Searching...
No Matches
nnl::vertexde::fmt Namespace Reference

This namespace contains constants and functions for defining the vertex format. More...

Functions

constexpr u32 kWeightNum (u32 weight_num)
 Generates a constant that encodes the number of weights.
constexpr u32 kMorphNum (u32 morph_num)
 Generates a constant that encodes the number of morph targets.

Variables

constexpr u32 kUV8 = fmt_code::k8 << fmt_shift::kUV
 8-bit fixed-point texture coordinates (unsigned)
constexpr u32 kUV16 = fmt_code::k16 << fmt_shift::kUV
 16-bit fixed-point texture coordinates (unsigned)
constexpr u32 kUV32 = fmt_code::k32 << fmt_shift::kUV
 floating-point texture coordinates
constexpr u32 kColor565 = fmt_code::k565 << fmt_shift::kColor
 2-byte color format. No alpha channel.
constexpr u32 kColor5551 = fmt_code::k5551 << fmt_shift::kColor
 2-byte color format. 1 bit for the alpha channel.
constexpr u32 kColor4444 = fmt_code::k4444 << fmt_shift::kColor
 2-byte color format. 4 bits per channel.
constexpr u32 kColor8888 = fmt_code::k8888 << fmt_shift::kColor
 4-byte color format. 8 bits per channel.
constexpr u32 kNormal8 = fmt_code::k8 << fmt_shift::kNormal
 8-bit fixed-point vertex normal (signed).
constexpr u32 kNormal16 = fmt_code::k16 << fmt_shift::kNormal
 16-bit fixed-point vertex normal (signed).
constexpr u32 kNormal32 = fmt_code::k32 << fmt_shift::kNormal
 floating-point vertex normal.
constexpr u32 kPosition8 = fmt_code::k8 << fmt_shift::kPosition
 8-bit fixed-point vertex coordinates (signed).
constexpr u32 kPosition16 = fmt_code::k16 << fmt_shift::kPosition
 16-bit fixed-point vertex coordinates (signed).
constexpr u32 kPosition32 = fmt_code::k32 << fmt_shift::kPosition
 floating-point vertex coordinates.
constexpr u32 kWeight8 = fmt_code::k8 << fmt_shift::kWeight
 8-bit fixed-point bone weights (unsigned).
constexpr u32 kWeight16 = fmt_code::k16 << fmt_shift::kWeight
 16-bit fixed-point bone weights (unsigned).
constexpr u32 kWeight32 = fmt_code::k32 << fmt_shift::kWeight
 floating-point bone weights.
constexpr u32 kIndex8 = fmt_code::k8 << fmt_shift::kIndex
 unsigned 8-bit indices (in index buffers)
constexpr u32 kIndex16 = fmt_code::k16 << fmt_shift::kIndex
 unsigned 16-bit indices (in index buffers)
constexpr u32 kThrough = 1 << fmt_shift::kThrough
 Indicates whether the 2D drawing mode is used.

Detailed Description

This namespace contains constants and functions for defining the vertex format.

The constants in this namespace represent various formats for vertex attributes, and control the drawing modes. These constants should be combined together using bitwise OR to obtain the final vertex format value (which is stored in the lower 24 bits of a 32-bit variable).

See also
nnl::model::Model
nnl::model::GeCmd
nnl::utl::math::FloatToFixed
Note
Vertex positions must always be present in the vertex format.

Function Documentation

◆ kMorphNum()

u32 nnl::vertexde::fmt::kMorphNum ( u32 morph_num)
inlineconstexpr

Generates a constant that encodes the number of morph targets.

This function takes a number and returns a value that can be combined with the vertex format to specify the number of morph targets. A morph target is a set of various vertex attributes that represents a different state of the same vertex, rather than a different vertex entirely. There's always at least 1 "target".

Parameters
morph_numThe number of morph targets (1-8).
Returns
A constant representing the specified number of morph targets.
Note
The games do not have an animation system that controls morph targets. Essentially, morphing is not supported. However, since the PSP's Graphics Engine does support it, it's technically possible to encode multiple morph targets into vertex buffers (and insert additional commands into display lists to render such meshes). Furthermore, in theory, it should be possible to modify the games to enable support for these animations.

◆ kWeightNum()

u32 nnl::vertexde::fmt::kWeightNum ( u32 weight_num)
inlineconstexpr

Generates a constant that encodes the number of weights.

This function takes a number and returns a value that can be combined with the vertex format to specify the number of used weights.

Parameters
weight_numThe number of weights (1-8).
Returns
A constant representing the specified number of weights.
Note
Ensure that weights are also enabled in the vertex format.
See also
nnl::vertexde::fmt::kWeight8
nnl::vertexde::fmt::kWeight16
nnl::vertexde::fmt::kWeight32

Variable Documentation

◆ kColor4444

u32 nnl::vertexde::fmt::kColor4444 = fmt_code::k4444 << fmt_shift::kColor
constexpr

2-byte color format. 4 bits per channel.

◆ kColor5551

u32 nnl::vertexde::fmt::kColor5551 = fmt_code::k5551 << fmt_shift::kColor
constexpr

2-byte color format. 1 bit for the alpha channel.

◆ kColor565

u32 nnl::vertexde::fmt::kColor565 = fmt_code::k565 << fmt_shift::kColor
constexpr

2-byte color format. No alpha channel.

◆ kColor8888

u32 nnl::vertexde::fmt::kColor8888 = fmt_code::k8888 << fmt_shift::kColor
constexpr

4-byte color format. 8 bits per channel.

◆ kIndex16

u32 nnl::vertexde::fmt::kIndex16 = fmt_code::k16 << fmt_shift::kIndex
constexpr

unsigned 16-bit indices (in index buffers)

This constant enables the use of index buffers for more efficient storage.

Note
Indices are not part of vertex attributes

◆ kIndex8

u32 nnl::vertexde::fmt::kIndex8 = fmt_code::k8 << fmt_shift::kIndex
constexpr

unsigned 8-bit indices (in index buffers)

This constant enables the use of index buffers for more efficient storage.

Note
Indices are not part of vertex attributes

◆ kNormal16

u32 nnl::vertexde::fmt::kNormal16 = fmt_code::k16 << fmt_shift::kNormal
constexpr

16-bit fixed-point vertex normal (signed).

◆ kNormal32

u32 nnl::vertexde::fmt::kNormal32 = fmt_code::k32 << fmt_shift::kNormal
constexpr

floating-point vertex normal.

◆ kNormal8

u32 nnl::vertexde::fmt::kNormal8 = fmt_code::k8 << fmt_shift::kNormal
constexpr

8-bit fixed-point vertex normal (signed).

◆ kPosition16

u32 nnl::vertexde::fmt::kPosition16 = fmt_code::k16 << fmt_shift::kPosition
constexpr

16-bit fixed-point vertex coordinates (signed).

◆ kPosition32

u32 nnl::vertexde::fmt::kPosition32 = fmt_code::k32 << fmt_shift::kPosition
constexpr

floating-point vertex coordinates.

◆ kPosition8

u32 nnl::vertexde::fmt::kPosition8 = fmt_code::k8 << fmt_shift::kPosition
constexpr

8-bit fixed-point vertex coordinates (signed).

◆ kThrough

u32 nnl::vertexde::fmt::kThrough = 1 << fmt_shift::kThrough
constexpr

Indicates whether the 2D drawing mode is used.

This constant enables the Through Mode, allowing vertices to bypass the 3D transformation pipeline and be drawn directly to the screen.

Note
Only positions, texture coordinates, and vertex colors are supported in this mode. These attributes should be encoded as 16-bit integers. See the official PSP SDK docs for more details.

◆ kUV16

u32 nnl::vertexde::fmt::kUV16 = fmt_code::k16 << fmt_shift::kUV
constexpr

16-bit fixed-point texture coordinates (unsigned)

◆ kUV32

u32 nnl::vertexde::fmt::kUV32 = fmt_code::k32 << fmt_shift::kUV
constexpr

floating-point texture coordinates

◆ kUV8

u32 nnl::vertexde::fmt::kUV8 = fmt_code::k8 << fmt_shift::kUV
constexpr

8-bit fixed-point texture coordinates (unsigned)

◆ kWeight16

u32 nnl::vertexde::fmt::kWeight16 = fmt_code::k16 << fmt_shift::kWeight
constexpr

16-bit fixed-point bone weights (unsigned).

See also
nnl::vertexde::fmt::kWeightNum

◆ kWeight32

u32 nnl::vertexde::fmt::kWeight32 = fmt_code::k32 << fmt_shift::kWeight
constexpr

floating-point bone weights.

See also
nnl::vertexde::fmt::kWeightNum

◆ kWeight8

u32 nnl::vertexde::fmt::kWeight8 = fmt_code::k8 << fmt_shift::kWeight
constexpr

8-bit fixed-point bone weights (unsigned).

See also
nnl::vertexde::fmt::kWeightNum