-
Notifications
You must be signed in to change notification settings - Fork 947
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in oak_tree_shadows (pull request #312)
Fix oak tree shadows Approved-by: Louise Poubel <[email protected]>
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
varying vec4 vertex_depth; | ||
|
||
uniform sampler2D tex; | ||
varying vec2 uv; | ||
|
||
void main() | ||
{ | ||
if (texture2D(tex, uv).a < 0.5) | ||
{ | ||
discard; | ||
} | ||
|
||
float depth = (vertex_depth.z) / vertex_depth.w; | ||
|
||
gl_FragColor = vec4(depth, depth, depth, 1.0); | ||
} |
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,16 @@ | ||
uniform mat4 world_view_proj_mat; | ||
uniform vec4 texel_offsets; | ||
|
||
varying vec4 vertex_depth; | ||
|
||
varying vec2 uv; | ||
|
||
void main() | ||
{ | ||
vertex_depth = world_view_proj_mat * gl_Vertex; | ||
gl_Position = vertex_depth; | ||
gl_Position.xy += texel_offsets.zw * gl_Position.w; | ||
|
||
uv = gl_MultiTexCoord0.xy; | ||
} | ||
|
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