~vladh/peony

peony/src_shaders/water_depth.vert -rw-r--r-- 686 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
/*
  Peony Game Engine
  Copyright (C) 2020 Vlad-Stefan Harbuz <vlad@vladh.net>
  All rights reserved.
*/

uniform mat4 model_matrix;

layout (location = 0) in vec3 position;
layout (location = 1) in vec3 normal;
layout (location = 2) in vec2 tex_coords;

out BLOCK {
  vec4 world_position;
} vs_out;

void main() {
  vec3 prelim_world_position = vec3(model_matrix * vec4(position, 1.0));
  vec3 water_lf_position = water_make_position(prelim_world_position.xz);
  vs_out.world_position = vec4(water_lf_position, 1.0);

  // NOTE: The water is only affected by sunlight.
  mat4 shadow_transform = shadowmap_2d_transforms[0];

  gl_Position = shadow_transform * vs_out.world_position;
}