summaryrefslogtreecommitdiff
path: root/glsl/shader_3d.vert.glsl
diff options
context:
space:
mode:
authorFrederico Linhares <fred@linhares.blue>2022-09-16 12:03:04 -0300
committerFrederico Linhares <fred@linhares.blue>2022-09-16 12:03:04 -0300
commit3d6ca447a7104c499e92fc954affdaf4bf011388 (patch)
treed759fbd39d3d66a2457ea92fc4eeb2c31b2cbe4f /glsl/shader_3d.vert.glsl
parent0d0868611389b8dded0c1dfef7a530a4b6e1f148 (diff)
feat Create View
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;