render: pack HardwareVertex from 88 to 48 bytes
Colour as UBYTE4_NORM, normals as SHORT4_NORM (unit direction, the shader renormalises), bones as UBYTE4 and weights as USHORT4_NORM. Shader inputs keep their float/uint types, so the shaders are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
545cbb1e5d
commit
aaee4c8f70
@@ -7,12 +7,16 @@
|
||||
#include <memory>
|
||||
#include "RenderCommands3D.h"
|
||||
namespace ava2 {
|
||||
// 48-byte vertex; the GPU expands the packed fields to the same float/uint shader inputs.
|
||||
struct HardwareVertex {
|
||||
float position[4], color[4], uv[2];
|
||||
float normal[4]{};
|
||||
uint32_t bones[4]{};
|
||||
float weights[4]{};
|
||||
float position[4]; // FLOAT4 (raw-vertex batches may carry w != 1)
|
||||
uint8_t color[4]; // UBYTE4_NORM, RGBA
|
||||
float uv[2]; // FLOAT2
|
||||
int16_t normal[4]{}; // SHORT4_NORM, unit xyz; w=1 when the vertex has a normal
|
||||
uint8_t bones[4]{}; // UBYTE4 (palette holds at most 128 bones)
|
||||
uint16_t weights[4]{}; // USHORT4_NORM
|
||||
};
|
||||
static_assert(sizeof(HardwareVertex)==48);
|
||||
struct HardwareTransform {
|
||||
float world[16]{}, mvp[16]{};
|
||||
float diffuse[4]{}, ambient[4]{}, emissive[4]{};
|
||||
|
||||
Reference in New Issue
Block a user