diff --git a/GL/draw.c b/GL/draw.c index 60013ab..2054932 100644 --- a/GL/draw.c +++ b/GL/draw.c @@ -1090,8 +1090,6 @@ static void light(SubmissionTarget* target) { VertexExtra* extra = aligned_vector_at(target->extras, 0); EyeSpaceData* eye_space = (EyeSpaceData*) eye_space_data->data; - mat_transform3(vertex->xyz, eye_space->xyz, target->count, sizeof(Vertex), sizeof(EyeSpaceData)); - _glMatrixLoadNormal(); mat_transform_normal3(extra->nxyz, eye_space->n, target->count, sizeof(VertexExtra), sizeof(EyeSpaceData)); diff --git a/GL/lighting.c b/GL/lighting.c index de0e15f..faca770 100644 --- a/GL/lighting.c +++ b/GL/lighting.c @@ -492,9 +492,9 @@ void _glPerformLighting(Vertex* vertices, EyeSpaceData* es, const uint32_t count data = es; for(j = 0; j < count; ++j, ++vertex, ++data) { /* Direction to vertex in eye space */ - float Vx = -data->xyz[0]; - float Vy = -data->xyz[1]; - float Vz = -data->xyz[2]; + float Vx = -vertex->xyz[0]; + float Vy = -vertex->xyz[1]; + float Vz = -vertex->xyz[2]; VEC3_NORMALIZE(Vx, Vy, Vz); const float Nx = data->n[0]; @@ -506,9 +506,9 @@ void _glPerformLighting(Vertex* vertices, EyeSpaceData* es, const uint32_t count continue; } - float Lx = LIGHTS[i].position[0] - data->xyz[0]; - float Ly = LIGHTS[i].position[1] - data->xyz[1]; - float Lz = LIGHTS[i].position[2] - data->xyz[2]; + float Lx = LIGHTS[i].position[0] - vertex->xyz[0]; + float Ly = LIGHTS[i].position[1] - vertex->xyz[1]; + float Lz = LIGHTS[i].position[2] - vertex->xyz[2]; if(LIGHTS[i].isDirectional) { float Hx = (Lx + 0); diff --git a/GL/private.h b/GL/private.h index ded524f..94a566e 100644 --- a/GL/private.h +++ b/GL/private.h @@ -354,9 +354,9 @@ GLboolean _glIsNormalizeEnabled(); GLboolean _glRecalcFastPath(); typedef struct { - float xyz[3]; // 12 bytes float n[3]; // 12 bytes - float finalColour[4]; //16 bytes (to 40) + float finalColour[4]; //28 bytes + uint32_t padding; // 32 bytes } EyeSpaceData; extern void _glPerformLighting(Vertex* vertices, EyeSpaceData *es, const uint32_t count);