source:
opengl-game/shaders/scene.vert@
a2f62d7
| Last change on this file since a2f62d7 was 6385d0f, checked in by , 6 years ago | |
|---|---|
|
|
| File size: 685 bytes | |
| Rev | Line | |
|---|---|---|
| [4befb76] | 1 | #version 450 |
| [de32fda] | 2 | #extension GL_ARB_separate_shader_objects : enable |
| 3 | ||
| [055750a] | 4 | struct Object { |
| [de32fda] | 5 | mat4 model; |
| [055750a] | 6 | }; |
| 7 | ||
| 8 | layout (binding = 0) uniform UniformBufferObject { | |
| [de32fda] | 9 | mat4 view; |
| 10 | mat4 proj; | |
| 11 | } ubo; | |
| [4befb76] | 12 | |
| [055750a] | 13 | layout(binding = 1) readonly buffer StorageBufferObject { |
| [6385d0f] | 14 | Object objects[]; |
| [055750a] | 15 | } sbo; |
| 16 | ||
| [adcd252] | 17 | layout(location = 0) in vec3 inPosition; |
| [80edd70] | 18 | layout(location = 1) in vec3 inColor; |
| [fba08f2] | 19 | layout(location = 2) in vec2 inTexCoord; |
| [5a1ace0] | 20 | layout(location = 3) in uint obj_index; |
| [4befb76] | 21 | |
| [80edd70] | 22 | layout(location = 0) out vec3 fragColor; |
| [fba08f2] | 23 | layout(location = 1) out vec2 fragTexCoord; |
| [4befb76] | 24 | |
| 25 | void main() { | |
| [f00ee54] | 26 | fragColor = inColor; |
| [fba08f2] | 27 | fragTexCoord = inTexCoord; |
| [f00ee54] | 28 | |
| [5a1ace0] | 29 | gl_Position = ubo.proj * ubo.view * sbo.objects[obj_index].model * vec4(inPosition, 1.0); |
| [f00ee54] | 30 | } |
Note:
See TracBrowser
for help on using the repository browser.
![(please configure the [header_logo] section in trac.ini)](/medieval/chrome/site/your_project_logo.png)