From 3d6ca447a7104c499e92fc954affdaf4bf011388 Mon Sep 17 00:00:00 2001 From: Frederico Linhares Date: Fri, 16 Sep 2022 12:03:04 -0300 Subject: feat Create View --- glsl/shader_3d.vert.glsl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'glsl/shader_3d.vert.glsl') 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; -- cgit v1.2.3