summaryrefslogtreecommitdiff
path: root/glsl/shader_3d.vert.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'glsl/shader_3d.vert.glsl')
-rw-r--r--glsl/shader_3d.vert.glsl18
1 files changed, 11 insertions, 7 deletions
diff --git a/glsl/shader_3d.vert.glsl b/glsl/shader_3d.vert.glsl
index 387ad00..29beea9 100644
--- a/glsl/shader_3d.vert.glsl
+++ b/glsl/shader_3d.vert.glsl
@@ -29,14 +29,18 @@ layout(location = 0) out DataTransferObject
vec3 normal;
} out_dto;
-layout(set = 0, binding = 0) uniform UBOViewProjection
+layout(set = 0, binding = 0) uniform UBOWorld
+{
+ vec4 ambient_light_color;
+} ubo_world;
+
+layout(set = 1, binding = 0) uniform UBOView
{
mat4 view;
mat4 proj;
- vec4 ambient_color;
-} ubo_view_projection;
+} ubo_view;
-layout(set = 1, binding = 0) uniform UBOModelInstance
+layout(set = 2, binding = 0) uniform UBOModelInstance
{
mat4 instances[128];
} ubo_model_instance;
@@ -45,9 +49,9 @@ void
main()
{
gl_Position =
- ubo_view_projection.proj * ubo_view_projection.view *
- ubo_model_instance.instances[gl_InstanceIndex] * vec4(in_position, 1.0);
- out_dto.frag_color = ubo_view_projection.ambient_color;
+ ubo_view.proj * ubo_view.view *
+ ubo_model_instance.instances[gl_InstanceIndex] * vec4(in_position, 1.0);
+ out_dto.frag_color = ubo_world.ambient_light_color;
out_dto.frag_texture_coord = in_texture_coord;
out_dto.normal = mat3(ubo_model_instance.instances[gl_InstanceIndex]) *
in_normal;