struct Light {
glm::vec4 position;
glm::vec4 color;
glm::vec4 attenuation;
};
struct UBO {
// View and projection matrix
glm::mat4 view;
glm::mat4 proj;
// Fog
glm::vec4 skyColor;
float density;
float gradient;
// Clipping plane
glm::vec4 clippingPlane;
// Lights
Light lights[4];
};
Vulkan API:
The UBO struct is updated each frame and then passed to a vertex shader each over a Uniform Buffer. The rendered image has wrong colors because the light-array is not passed properly.
Vertex shader binding:
layout (binding = 1) uniform UBO {
// View and projection matrix
mat4 view;
mat4 proj;
// Fog
vec4 skyColor;
float density;
float gradient;
// Clipping plane
vec4 clippingPlane;
// Lights
Light lights[4];
} ubo;
Do I need to align the data somehow?