Changeset 67527a5 in opengl-game for shaders/model.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/model.vert

    rb01b50c r67527a5  
    66};
    77
    8 layout (binding = 0) uniform UniformBufferObject {
     8layout (binding = 0) uniform camera_block {
    99   mat4 view;
    1010   mat4 proj;
     11} camera;
     12
     13// TODO: Verify that I can actually store 1024 values here. They last time I checked, I think I could only store 1016 values
     14layout (binding = 1) uniform ubo_block {
     15        Object objects[1024];
    1116} ubo;
    12 
    13 layout(binding = 1) readonly buffer StorageBufferObject {
    14    Object objects[];
    15 } sbo;
    16 
    17 layout (binding = 2) uniform UboInstance {
    18         mat4 model;
    19 } uboInstance;
    2017
    2118layout(location = 0) in vec3 inPosition;
     
    3128void main() {
    3229   // Using 0.0 instead of 1.0 means translations won't effect the normal
    33    normal_eye = normalize(vec3(ubo.view * sbo.objects[obj_index].model * vec4(vertex_normal, 0.0)));
     30   normal_eye = normalize(vec3(camera.view * ubo.objects[obj_index].model * vec4(vertex_normal, 0.0)));
    3431
    3532   fragColor = inColor;
    3633   fragTexCoord = inTexCoord;
    3734
    38    gl_Position = ubo.proj * ubo.view * sbo.objects[obj_index].model * vec4(inPosition, 1.0);
     35   gl_Position = camera.proj * camera.view * ubo.objects[obj_index].model * vec4(inPosition, 1.0);
    3936}
Note: See TracChangeset for help on using the changeset viewer.