github.com/cybriq/giocore@v0.0.7-0.20210703034601-cfb9cb5f3900/gpu/shaders/intersect.vert (about)

     1  #version 310 es
     2    
     3  // SPDX-License-Identifier: Unlicense OR MIT
     4  
     5  #extension GL_GOOGLE_include_directive : enable
     6  
     7  precision highp float;
     8  
     9  #include "common.h"
    10  
    11  layout(location = 0) in vec2 pos;
    12  layout(location = 1) in vec2 uv;
    13  
    14  layout(binding = 0) uniform Block {
    15  	vec4 uvTransform;
    16  	vec4 subUVTransform;
    17  } _block;
    18  
    19  layout(location = 0) out vec2 vUV;
    20  
    21  void main() {
    22    vec3 p = transform3x2(fboTransform, vec3(pos, 1.0));
    23    gl_Position = vec4(p, 1);
    24    vec3 uv3 = transform3x2(fboTextureTransform, vec3(uv, 1.0));
    25    vUV = uv3.xy*_block.subUVTransform.xy + _block.subUVTransform.zw;
    26    vUV = transform3x2(fboTextureTransform, vec3(vUV, 1.0)).xy;
    27    vUV = vUV*_block.uvTransform.xy + _block.uvTransform.zw;
    28  }