Changeset 14ff67c in opengl-game for texture.vert


Ignore:
Timestamp:
May 24, 2018, 2:35:35 AM (7 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
4f3262f
Parents:
e165b85
Message:

Use uniform buffers to store model matrices and add constants to toggle FPS display and vsync.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • texture.vert

    re165b85 r14ff67c  
    11#version 410
    22
    3 uniform mat4 model, view, proj;
     3#define MAX_NUM_OBJECTS 1024
     4
     5uniform mat4 view, proj;
     6
     7layout (std140) uniform models {
     8  mat4 model_mats[MAX_NUM_OBJECTS];
     9};
    410
    511layout(location = 0) in vec3 vertex_position;
    612layout(location = 1) in vec2 vt;
    713layout(location = 2) in vec3 vertex_normal;
     14layout(location = 3) in uint ubo_index;
    815
    916out vec2 texture_coordinates;
     
    1421
    1522void main() {
    16   position_eye = vec3(view * model * vec4(vertex_position, 1.0));
    17   normal_eye = vec3(view * model * vec4 (vertex_normal, 0.0));
     23  position_eye = vec3(view * model_mats[ubo_index] * vec4(vertex_position, 1.0));
     24  normal_eye = vec3(view * model_mats[ubo_index] * vec4 (vertex_normal, 0.0));
    1825  texture_coordinates = vt;
    1926  light_position_eye = vec3(view * vec4(light_position_world, 1.0));
Note: See TracChangeset for help on using the changeset viewer.