~vladh/peony

peony/src_shaders/water.geom -rw-r--r-- 639 bytes
7fc9922bVlad-Stefan Harbuz changes shaders namespace into class a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
  Peony Game Engine
  Copyright (C) 2020 Vlad-Stefan Harbuz <vlad@vladh.net>
  All rights reserved.
*/

#define N_VERTICES 3

layout (triangles) in;
layout (triangle_strip, max_vertices=N_VERTICES) out;

out BLOCK {
  vec3 world_position;
  vec3 normal;
  vec2 tex_coords;
} gs_in;

out BLOCK {
  vec3 world_position;
  vec3 normal;
  vec2 tex_coords;
} gs_out;

void main() {
  for (int idx = 0; idx < N_VERTICES; idx++) {
    gs_out.world_position = gs_in.world_position;
    gl_Position = gl_in[idx].gl_Position;
    gs_out.normal = gs_in.normal;
    gs_out.tex_coords = gs_in.tex_coords;

    EmitVertex();
  }

  EndPrimitive();
}