Changeset 67527a5 in opengl-game for shaders/laser.vert


Ignore:
Timestamp:
Jun 21, 2021, 4:12:08 PM (3 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
27e580e
Parents:
b01b50c
git-author:
Dmitry Portnoy <dportnoy@…> (06/21/21 15:13:03)
git-committer:
Dmitry Portnoy <dportnoy@…> (06/21/21 16:12:08)
Message:

Switch all per-object buffers to be dynamic uniform buffers instead of shader storage buffers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • shaders/laser.vert

    rb01b50c r67527a5  
    88};
    99
    10 layout (binding = 0) uniform UniformBufferObject {
     10layout (binding = 0) uniform camera_block {
    1111   mat4 view;
    1212   mat4 proj;
     13} camera;
     14
     15layout(binding = 1) uniform ubo_block {
     16   Object objects[1024];
    1317} ubo;
    14 
    15 layout(binding = 1) readonly buffer StorageBufferObject {
    16    Object objects[];
    17 } sbo;
    1818
    1919layout(location = 0) in vec3 vertex_position;
     
    2525
    2626void main() {
    27    vec3 position_eye = vec3(ubo.view * sbo.objects[obj_index_vs].model * vec4(vertex_position, 1.0));
     27   vec3 position_eye = vec3(camera.view * ubo.objects[obj_index_vs].model * vec4(vertex_position, 1.0));
    2828
    2929   texcoords_fs = texcoords_vs;
    3030   obj_index_fs = obj_index_vs;
    3131
    32    if (sbo.objects[obj_index_vs].deleted) {
     32   if (ubo.objects[obj_index_vs].deleted) {
    3333      gl_Position = vec4(0.0, 0.0, 2.0, 1.0);
    3434   } else {
    35       gl_Position = ubo.proj * vec4(position_eye, 1.0);
     35      gl_Position = camera.proj * vec4(position_eye, 1.0);
    3636   }
    3737}
Note: See TracChangeset for help on using the changeset viewer.