vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::MeshAsset Struct Reference

CPU-side geometry: indexed triangle mesh plus a cached local-space AABB. More...

#include <mesh_asset.h>

Inheritance diagram for Vkm::Engine::MeshAsset:
Vkm::Engine::Resource

Public Member Functions

Math::AABB bounds () const noexcept
 The local-space bounds as one box.
void computeAndSetBounds ()
 Compute the local-space AABB from vertex positions and store it in boundsMin / boundsMax.
void computeAndSetSkinRadius (const SkeletonAsset &rig)
 Compute how far a vertex sits from the bones that drive it and store it in skinRadius.
Public Member Functions inherited from Vkm::Engine::Resource
 Resource (const Resource &other)
 Duplicate other's contents and name, but not its identity.
const std::string & name () const noexcept
 Serializable identity; non-empty and unique within its type once added.
uint64_t uid () const noexcept
 Process-unique id stamped by add(); names the asset, not the slot it sits in.
uint64_t version () const noexcept
 Change counter the backend keys GPU re-uploads on; moved by commit().
bool isHidden () const noexcept
 Added by ResourceManager::addPrivate: not user-facing, not saved.
nlohmann::json & sourceJson ()
 Mutable source JSON, allocating a null document if there is none.
const nlohmann::json & sourceJson () const
 Const source JSON; asserts hasSource(), so guard the call with it.

Public Attributes

std::vector< SkinVertex > skin = {}
 Per-vertex rig binding: empty, or exactly vertices.size() long.
std::string skeleton = ""
 Name of the rig skin's indices address; empty when unskinned.
float skinRadius = 0.0f
 Largest distance from a vertex to any bone that influences it.
glm::vec3 boundsMin {0}
 Local space.
glm::vec3 boundsMax {0}
 Local space.
bool loading = false
 True while an async decode is in flight.

Detailed Description

CPU-side geometry: indexed triangle mesh plus a cached local-space AABB.

Member Function Documentation

◆ bounds()

Math::AABB Vkm::Engine::MeshAsset::bounds ( ) const
inlinenoexcept

The local-space bounds as one box.

Returns
The box spanning boundsMin to boundsMax.

◆ computeAndSetBounds()

void Vkm::Engine::MeshAsset::computeAndSetBounds ( )

Compute the local-space AABB from vertex positions and store it in boundsMin / boundsMax.

An empty mesh yields a zero-extent box at the origin.

◆ computeAndSetSkinRadius()

void Vkm::Engine::MeshAsset::computeAndSetSkinRadius ( const SkeletonAsset & rig)

Compute how far a vertex sits from the bones that drive it and store it in skinRadius.

Required after filling a skinned mesh: zero is a wrong box, not a small one (see VisibilitySystem). Zero when unskinned or the skin is not parallel.

Parameters
rigThe rig skin's bone indices address, for the bind-pose origins.

Member Data Documentation

◆ skin

std::vector<SkinVertex> Vkm::Engine::MeshAsset::skin = {}

Per-vertex rig binding: empty, or exactly vertices.size() long.

A mesh is skinned iff this is non-empty.

◆ skeleton

std::string Vkm::Engine::MeshAsset::skeleton = ""

Name of the rig skin's indices address; empty when unskinned.

A compatibility tag, not a dependency: the pose comes from whatever rig drives it. SkeletalAnimationSystem warns when the two names disagree.

◆ skinRadius

float Vkm::Engine::MeshAsset::skinRadius = 0.0f

Largest distance from a vertex to any bone that influences it.

What a bone-origin box is inflated by to contain the skin. Zero when unskinned.

◆ loading

bool Vkm::Engine::MeshAsset::loading = false

True while an async decode is in flight.

Cleared by AsyncLoaderSystem; until then the mesh is empty and draws nothing.


The documentation for this struct was generated from the following file: