Change cofactor/normal matrix to mat3;

This means per-draw uniform data is 128 bytes now!
This commit is contained in:
bjorn 2023-04-27 20:22:31 -07:00
parent e9d61bd254
commit 6862b8c970
2 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ struct Camera {
struct Draw {
mat4 transform;
mat4 normalMatrix;
mat3 normalMatrix;
vec4 color;
};
@ -155,7 +155,7 @@ layout(location = 14) in vec3 Tangent;
#ifdef GL_VERTEX_SHADER
#define DrawID gl_BaseInstance
#define Transform Draws[DrawID].transform
#define NormalMatrix mat3(Draws[DrawID].normalMatrix)
#define NormalMatrix Draws[DrawID].normalMatrix
#define PassColor Draws[DrawID].color
#define ClipFromLocal (ViewProjection * Transform)
#define ClipFromWorld (ViewProjection)

View File

@ -173,7 +173,7 @@ struct Font {
typedef struct {
float transform[16];
float cofactor[16];
float cofactor[12];
float color[4];
} DrawData;
@ -4722,7 +4722,7 @@ static void bindBundles(Pass* pass, Draw* draw, Shader* shader) {
mat4_cofactor(cofactor);
memcpy(pass->drawData->transform, transform, 64);
memcpy(pass->drawData->cofactor, cofactor, 64);
memcpy(pass->drawData->cofactor, cofactor, 48);
memcpy(pass->drawData->color, pass->pipeline->color, 16);
pass->drawData++;
}