Changes between Version 3 and Version 4 of Ticket #9


Ignore:
Timestamp:
10/13/18 01:55:02 (6 years ago)
Author:
Hongtae Kim
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9 – Description

    v3 v4  
    1 ## VertexShader
     1== Vertex Shader
     2{{{#!glsl
     3#version 450
     4
     5#extension GL_ARB_separate_shader_objects : enable
     6#extension GL_ARB_shading_language_420pack : enable
     7
     8layout (location = 0) in vec4 inPos;
     9layout (location = 1) in vec2 inUV;
     10
     11struct Instance
     12{
     13        mat4 model;
     14        vec4 arrayIndex;
     15};
     16
     17layout (binding = 0) uniform UBO
     18{
     19        mat4 projection;
     20        mat4 view;
     21        Instance instance[8];
     22} ubo;
     23
     24layout (location = 0) out vec3 outUV;
     25
     26void main()
     27{
     28        outUV = vec3(inUV, ubo.instance[gl_InstanceIndex].arrayIndex.x);
     29        mat4 modelView = ubo.view * ubo.instance[gl_InstanceIndex].model;
     30        gl_Position = ubo.projection * modelView * inPos;
     31}
     32}}}
     33
     34== Fragment Shader
     35{{{#!glsl
     36#version 450
     37
     38#extension GL_ARB_separate_shader_objects : enable
     39#extension GL_ARB_shading_language_420pack : enable
     40
     41layout (binding = 1) uniform sampler2DArray samplerArray;
     42
     43layout (location = 0) in vec3 inUV;
     44
     45layout (location = 0) out vec4 outFragColor;
     46
     47void main()
     48{
     49        outFragColor = texture(samplerArray, inUV);
     50}
     51}}}