|
NSUNI/NSLAR Library a250670
|
Classes | |
| struct | nnl::model::TriangleGroup |
| Represents a group of triangles associated with specific bones. More... | |
Macros | |
| #define | NNL_UVANIM_MAX_DUR 1000 |
| The maximum duration of a texture coordinate animation. | |
Enumerations | |
| enum | nnl::model::GeCmd : u32 { nnl::model::kReturn = 0x0B'00'00'00 , nnl::model::kSetVertexType = 0x12'00'00'00 , nnl::model::kSetBaseAddress = 0x10'00'00'00 , nnl::model::kSetVramAddress = 0x01'00'00'00 , nnl::model::kDrawPrimitives = 0x04'00'00'00 } |
| Enumeration of essential rendering commands for the library. More... | |
| enum | nnl::model::HumanoidRigTarget : BoneTarget |
| Enum representing parts of a generic humanoid rig. More... | |
Functions | |
| std::vector< STriangle > | nnl::model::ExtractTriangles (const SubMesh &submesh, bool skip_degenerate=true) |
| Extracts triangles from a given submesh. | |
| std::vector< TriangleGroup > | nnl::model::GroupTrianglesByBones (const std::vector< u32 > &indices, const std::vector< SVertex > &vertices, u32 max_num_triangles=std::numeric_limits< u16 >::max()/3, bool join_bone_sets=true) |
| Groups triangles by their associated bones. | |
| BBox | nnl::model::GenerateBBox (const SMesh &mesh, glm::mat4 transform=glm::mat4(1.0f)) |
| Generates an axis-aligned bounding box (AABB) for the given mesh. | |
| Mesh | nnl::model::Convert (SMesh &&smesh, const ConvertParam ¶m={}) |
| Converts a simplified representation of a mesh to the in-game format. | |
| SMesh | nnl::model::Convert (const Mesh &mesh) |
| Converts a mesh from the in-game format to a simplified representation. | |
| ConvertParam | nnl::model::GenerateConvertParam (const Mesh &mesh) |
| Generates a conversion parameter for SMesh to get a similar in-game Mesh when converting back to it. | |
| std::vector< ConvertParam > | nnl::model::GenerateConvertParam (const Model &model) |
| Generates a vector of conversion parameters for the entire model to achieve a similar in-game representation. | |
| std::vector< Bone > | nnl::model::Convert (const SSkeleton &skeleton) |
| Converts a skeleton represented as a tree into a vector of bones. | |
| void | nnl::model::SetBoneNames (SSkeleton &skeleton, const std::vector< std::map< BoneTarget, BoneIndex > > &bone_target_tables, bool is_character=true) |
| Assigns meaningful names to bones in a skeleton. | |
| std::vector< std::map< BoneTarget, BoneIndex > > | nnl::model::GenerateBoneTargetTables (const SSkeleton &skeleton) |
| Generates bone target tables from bone names of the skeleton. | |
| SSkeleton | nnl::model::Convert (const std::vector< Bone > &bones) |
| Converts a vector of bones into a simple tree-like skeleton representation. | |
| std::map< BoneIndex, glm::mat4 > | nnl::model::GenerateInverseMatrixBoneTable (const SModel &smodel) |
| Generates a map of bone indices and inverse matrices. | |
| UVAnimation | nnl::model::Convert (const SUVChannel &suv_anim_channel) |
| Converts a simple UV animation channel to an in-game UVAnimation config. | |
| SUVChannel | nnl::model::Convert (const UVAnimation &uv_anim) |
| Converts an in-game UVAnimation config to a simple UV animation channel. | |
| Material | nnl::model::Convert (const SMaterial &smat) |
| Converts SMaterial to Material. | |
| SMaterial | nnl::model::Convert (const Material &mat) |
| Converts Material to SMaterial. | |
Variables | |
| constexpr std::array< std::string_view, 30 > | nnl::model::bone_target_names |
| An array that associates a generic bone id with a name. | |
| struct nnl::model::TriangleGroup |
Represents a group of triangles associated with specific bones.
This type consists of unique bone IDs and a vector of triangle indices.
Public Attributes | |
| utl::StaticSet< BoneIndex, kMaxNumBonePerPrim > | bones |
| Unique bones. | |
| std::vector< u32 > | indices |
| Triangles associated with the bones. | |
| utl::StaticSet<BoneIndex, kMaxNumBonePerPrim> nnl::model::TriangleGroup::bones |
Unique bones.
| std::vector<u32> nnl::model::TriangleGroup::indices |
Triangles associated with the bones.
| #define NNL_UVANIM_MAX_DUR 1000 |
The maximum duration of a texture coordinate animation.
This macro defines the maximum duration of a UV animation when converted from the in-game format to a more generalized format. The default value typically allows for seamless looping of animations within that timeframe. However, it can be changed as needed.
| enum nnl::model::GeCmd : u32 |
Enumeration of essential rendering commands for the library.
This enum defines a few rendering commands used by the Graphics Engine (GE).
Each command is represented by a 32-bit value, where the first byte indicates the command, and the remaining bytes store its arguments.
| Enumerator | |
|---|---|
| kReturn | Marks the end of the display list. |
| kSetVertexType | Sets the vertex format. Indicates the rendering modes, the attributes used, their formats
|
| kSetBaseAddress | Sets the base address; The command must be present in a display list. Arguments are filled dynamically by the game engine. |
| kSetVramAddress | Sets the address for vertex data; The command must be present in a display list. Arguments are filled dynamically by the game engine. |
| kDrawPrimitives | Command to draw primitives based on the current vertex data. Expects a primitve type (8 bits) and a number of elements as its arguments (last 16 bits). Number of elements is a number of vertices or indices.
|
Enum representing parts of a generic humanoid rig.
This enum defines generic identifiers for different parts of a humanoid rig. These identifiers can be used by the games to access specific bones in a skeleton for procedural animation and effect attachment.
Converts a mesh from the in-game format to a simplified representation.
| mesh | The mesh to be converted |
Converts a vector of bones into a simple tree-like skeleton representation.
This function transforms a vector of Bone structures into an SSkeleton object, organizing the bones into a hierarchical structure.
| bones | A vector of Bone structures to be converted into a skeleton. |
| UVAnimation nnl::model::Convert | ( | const SUVChannel & | suv_anim_channel | ) |
Converts a simple UV animation channel to an in-game UVAnimation config.
| suv_anim_channel |
| SUVChannel nnl::model::Convert | ( | const UVAnimation & | uv_anim | ) |
Converts an in-game UVAnimation config to a simple UV animation channel.
| uv_anim |
| Mesh nnl::model::Convert | ( | SMesh && | smesh, |
| const ConvertParam & | param = {} ) |
Converts a simplified representation of a mesh to the in-game format.
| smesh | The source mesh to be converted. |
| param | The parameters that dictate how the conversion should be performed. |
| std::vector< STriangle > nnl::model::ExtractTriangles | ( | const SubMesh & | submesh, |
| bool | skip_degenerate = true ) |
Extracts triangles from a given submesh.
This function processes the given submesh, which can be in multiple formats, to extract its triangles into a simpler representation.
| submesh | The submesh from which to extract triangles. |
| skip_degenerate | A boolean flag indicating whether to skip 0 area triangles. |
Generates an axis-aligned bounding box (AABB) for the given mesh.
This function computes the bounding box, and applies the provided transformation matrix to it. The resulting bounding box is represented as a BBox object.
| mesh | The mesh for which to generate the bounding box. |
| transform | A transformation matrix to be applied to the bbox. |
| std::vector< std::map< BoneTarget, BoneIndex > > nnl::model::GenerateBoneTargetTables | ( | const SSkeleton & | skeleton | ) |
Generates bone target tables from bone names of the skeleton.
This function creates a vector of tables that associate bone targets with concrete bone indices based on the bone names of the provided SSkeleton.
| skeleton | The input SSkeleton from which the bone target tables will be generated. |
| ConvertParam nnl::model::GenerateConvertParam | ( | const Mesh & | mesh | ) |
Generates a conversion parameter for SMesh to get a similar in-game Mesh when converting back to it.
| mesh | The source mesh in the in-game format from which to generate conversion parameters. |
| std::vector< ConvertParam > nnl::model::GenerateConvertParam | ( | const Model & | model | ) |
Generates a vector of conversion parameters for the entire model to achieve a similar in-game representation.
This function attempts to create a collection of ConvertParam objects that would result in a similar in-game model when converting from a source model (SModel) back to the in-game format (Model).
| model | The source model from which to generate conversion parameters. |
| std::map< BoneIndex, glm::mat4 > nnl::model::GenerateInverseMatrixBoneTable | ( | const SModel & | smodel | ) |
Generates a map of bone indices and inverse matrices.
This function creates a map of bone indices and their corresponding inverse matrices. Note that an entry in this table can be omitted if there is no meshes attached to the corresponding bone.
| smodel | The input SModel containing meshes and a skeleton. |
| std::vector< TriangleGroup > nnl::model::GroupTrianglesByBones | ( | const std::vector< u32 > & | indices, |
| const std::vector< SVertex > & | vertices, | ||
| u32 | max_num_triangles = std::numeric_limits< u16 >::max()/3, | ||
| bool | join_bone_sets = true ) |
Groups triangles by their associated bones.
This function slices triangles into groups based on the bones that influence them. These groups are used to create SubMeshes.
| indices | A vector of triangle indices to be grouped. |
| vertices | A vector of vertices associated with the triangles. |
| join_bone_sets | Whether to join different bone sets into larger ones. This may reduce the number of draw calls but increase the size of an asset. |
| max_num_triangles | The maximum number of triangles allowed in a group. The choice of this number depends on the index type and the primitive type a SubMesh uses. |
| void nnl::model::SetBoneNames | ( | SSkeleton & | skeleton, |
| const std::vector< std::map< BoneTarget, BoneIndex > > & | bone_target_tables, | ||
| bool | is_character = true ) |
Assigns meaningful names to bones in a skeleton.
This function assigns more meaningful names to the bones in the provided SSkeleton based on the specified bone_target_tables.
The new names can also be used to recreate the source bone_target_tables.
| skeleton | An SSkeleton whose bones will be renamed. |
| bone_target_tables | Tables that associate bone targets with concrete bone indices. This information is used to determine the appropriate names for each bone. |
| is_character | A flag indicating whether to use a humanoid bone naming convention. If false, bone target names will consist of the prefix VFX followed by a target id. |
|
constexpr |
An array that associates a generic bone id with a name.