Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimizes the integration of shaders and adds some minor changes and …
…new features. - Duplicate shader code is now placed in a separate GLSL file and included in each shader program during loading time - Adds new ShaderParameters class which simplifies setting shader parameters - Blocks are now affected by torchlight - Gel. cubes are now affected by torchlight - Adds vignette post processing effect which become more intense while dimming - Screen becomes now blurry when swimming - Gel. cubes now vary more in size - Optimizes the AI of Gel. cubes to be a bit more fun and less jumpy - And some more stuff I forgot to mention. ;)
- Loading branch information
Showing
25 changed files
with
428 additions
and
199 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
uniform float tick; | ||
|
||
varying vec3 normal; | ||
varying vec4 vertexWorldPos; | ||
|
||
void main() | ||
{ | ||
vec4 vertexPos = gl_ModelViewProjectionMatrix * gl_Vertex; | ||
gl_TexCoord[0] = gl_MultiTexCoord0; | ||
gl_FrontColor = gl_Color; | ||
|
||
vertexPos.y += cos(tick*0.25 + vertexPos.x * 0.25) * 0.2; | ||
vertexWorldPos = gl_ModelViewMatrix * gl_Vertex; | ||
normal = gl_NormalMatrix * gl_Normal; | ||
|
||
vertexPos.y += cos(tick*0.1 + vertexPos.x * 0.1) * sin(tick*0.1 + vertexPos.x * 0.1 + 0.483921) * 0.15; | ||
|
||
gl_Position = vertexPos; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/org/terasology/data/shaders/globalFunctionsFragIncl.glsl
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,18 @@ | ||
float light(vec3 normal, vec4 worldPos) { | ||
vec3 N = normalize(normal * ((gl_FrontFacing) ? 1.0 : -1.0)); | ||
vec3 L = normalize(-worldPos.xyz); | ||
|
||
return dot(N,L); | ||
} | ||
|
||
float torchlight(float light, vec4 worldPos) { | ||
return light * clamp(1.0 - (length(worldPos) / 16.0), 0.0, 1.0); | ||
} | ||
|
||
vec4 srgbToLinear(vec4 color) { | ||
return pow(color, vec4(1.0 / GAMMA)); | ||
} | ||
|
||
vec4 linearToSrgb(vec4 color) { | ||
return pow(color, vec4(GAMMA)); | ||
} |
Empty file.
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.