Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3376d2e
commit ffd16e3
Showing
23 changed files
with
883 additions
and
30 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
uniform sampler2D baseTexture; | ||
uniform sampler2D normalTexture; | ||
uniform vec3 yawVec; | ||
|
||
void main (void) | ||
{ | ||
vec2 uv = gl_TexCoord[0].st; | ||
|
||
//texture sampling rate | ||
const float step = 1.0 / 256.0; | ||
float tl = texture2D(normalTexture, vec2(uv.x - step, uv.y + step)).r; | ||
float t = texture2D(normalTexture, vec2(uv.x - step, uv.y - step)).r; | ||
float tr = texture2D(normalTexture, vec2(uv.x + step, uv.y + step)).r; | ||
float r = texture2D(normalTexture, vec2(uv.x + step, uv.y)).r; | ||
float br = texture2D(normalTexture, vec2(uv.x + step, uv.y - step)).r; | ||
float b = texture2D(normalTexture, vec2(uv.x, uv.y - step)).r; | ||
float bl = texture2D(normalTexture, vec2(uv.x - step, uv.y - step)).r; | ||
float l = texture2D(normalTexture, vec2(uv.x - step, uv.y)).r; | ||
float dX = (tr + 2.0 * r + br) - (tl + 2.0 * l + bl); | ||
float dY = (bl + 2.0 * b + br) - (tl + 2.0 * t + tr); | ||
vec4 bump = vec4 (normalize(vec3 (dX, dY, 0.1)),1.0); | ||
float height = 2.0 * texture2D(normalTexture, vec2(uv.x, uv.y)).r - 1.0; | ||
vec4 base = texture2D(baseTexture, uv).rgba; | ||
vec3 L = normalize(vec3(0.0, 0.75, 1.0)); | ||
float specular = pow(clamp(dot(reflect(L, bump.xyz), yawVec), 0.0, 1.0), 1.0); | ||
float diffuse = dot(yawVec, bump.xyz); | ||
|
||
vec3 color = (1.1 * diffuse + 0.05 * height + 0.5 * specular) * base.rgb; | ||
vec4 col = vec4(color.rgb, base.a); | ||
col *= gl_Color; | ||
gl_FragColor = vec4(col.rgb, base.a); | ||
} |
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,11 @@ | ||
uniform mat4 mWorldViewProj; | ||
uniform mat4 mInvWorld; | ||
uniform mat4 mTransWorld; | ||
uniform mat4 mWorld; | ||
|
||
void main(void) | ||
{ | ||
gl_TexCoord[0] = gl_MultiTexCoord0; | ||
gl_Position = mWorldViewProj * gl_Vertex; | ||
gl_FrontColor = gl_BackColor = gl_Color; | ||
} |
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 |
---|---|---|
|
@@ -423,6 +423,7 @@ set(client_SRCS | |
main.cpp | ||
mapblock_mesh.cpp | ||
mesh.cpp | ||
minimap.cpp | ||
particles.cpp | ||
shader.cpp | ||
sky.cpp | ||
|
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.