-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only terrain tiles that might be visible for fullscreen viewport will cast shadows for now
- Loading branch information
1 parent
44f1bcc
commit 845b0f2
Showing
17 changed files
with
274 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"hash":2341155833246859277,"uid":"e91b1d720b676e23ccf1697af9fa436c"} | ||
{"hash":2415660123109180683,"uid":"e91b1d720b676e23ccf1697af9fa436c"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#version 450 | ||
#property height_map tex2d | ||
|
||
#stage vertex | ||
#include "engine/shaders/common/constants.glsl" | ||
#include "engine/shaders/deferred_geometry/terrain_uniform.glsl" | ||
|
||
layout(location = VERTEX_ATTR_INDEX_POS) in vec2 position; | ||
|
||
uniform sampler2D height_map; | ||
|
||
vec4 calc_position() | ||
{ | ||
const float texel_size = 1.0 / (uniforms.terrain_side_verts + 2); | ||
const vec2 origin = vec2(1.5) * texel_size; | ||
const float border_scale_factor = (uniforms.terrain_side_verts - 1) / (uniforms.terrain_side_verts + 2); | ||
vec2 tex_coord = origin + position * border_scale_factor; | ||
float height_sample = texture(height_map, tex_coord).r; | ||
vec2 xy_pos = (position + uniforms.tile_offset) * uniforms.terrain_size * uniforms.tile_scale; | ||
return vec4(xy_pos.x, uniforms.height_origin + height_sample * uniforms.height_range, xy_pos.y, 1.0); | ||
} | ||
|
||
void main() | ||
{ | ||
gl_Position = uniforms.MVP * calc_position(); | ||
} | ||
|
||
#stage fragment | ||
|
||
void main() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"hash":10448652787744739778,"uid":"0e8c4babf498a0c3ea517de77fb54f72"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.