Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::instance_vertex_data Struct Reference

GPU-friendly vertex data for instancing. More...

#include <batch_instance.h>

Public Member Functions

 instance_vertex_data ()=default
 Default constructor.
 
 instance_vertex_data (const batch_instance &instance)
 Constructor from batch instance.
 
void set_lod_param (float lod_param)
 Set the LOD parameter (stored in matrix[3][3])
 
auto get_lod_param () const -> float
 Get the LOD parameter (from matrix[3][3])
 
auto is_valid () const -> bool
 Check if the vertex data is valid.
 
auto to_string () const -> std::string
 Get string representation for debugging.
 

Static Public Member Functions

static auto packed_size () -> size_t
 

Public Attributes

math::mat4 world_matrix
 World transformation matrix with LOD parameter packed in [3][3] (i_data0, i_data1, i_data2, i_data3)
 

Detailed Description

GPU-friendly vertex data for instancing.

This structure matches the shader input layout and packs the instance data into a single 4x4 matrix for efficient copying. The LOD parameter is packed into the matrix[3][3] position (which is normally 1.0 for homogeneous coordinates). The matrix will be interpreted as 4 vec4 attributes (i_data0 through i_data3) by the shader.

Definition at line 66 of file batch_instance.h.

Constructor & Destructor Documentation

◆ instance_vertex_data() [1/2]

unravel::instance_vertex_data::instance_vertex_data ( )
default

Default constructor.

◆ instance_vertex_data() [2/2]

unravel::instance_vertex_data::instance_vertex_data ( const batch_instance & instance)
explicit

Constructor from batch instance.

Parameters
instanceThe batch instance to convert

Definition at line 53 of file batch_instance.cpp.

Member Function Documentation

◆ get_lod_param()

auto unravel::instance_vertex_data::get_lod_param ( ) const -> float

Get the LOD parameter (from matrix[3][3])

Returns
LOD parameter value

Definition at line 65 of file batch_instance.cpp.

◆ is_valid()

auto unravel::instance_vertex_data::is_valid ( ) const -> bool

Check if the vertex data is valid.

Returns
True if the data appears valid

Definition at line 70 of file batch_instance.cpp.

◆ packed_size()

static auto unravel::instance_vertex_data::packed_size ( ) -> size_t
inlinestatic

Definition at line 68 of file batch_instance.h.

◆ set_lod_param()

void unravel::instance_vertex_data::set_lod_param ( float lod_param)

Set the LOD parameter (stored in matrix[3][3])

Parameters
lod_paramLOD parameter value

Definition at line 60 of file batch_instance.cpp.

◆ to_string()

auto unravel::instance_vertex_data::to_string ( ) const -> std::string

Get string representation for debugging.

Returns
String representation of the vertex data

Definition at line 87 of file batch_instance.cpp.

Member Data Documentation

◆ world_matrix

math::mat4 unravel::instance_vertex_data::world_matrix

World transformation matrix with LOD parameter packed in [3][3] (i_data0, i_data1, i_data2, i_data3)

Definition at line 73 of file batch_instance.h.


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