-
Notifications
You must be signed in to change notification settings - Fork 89
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
39b0244
commit 1a4879c
Showing
10 changed files
with
485 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,5 @@ | ||
The following textures are made by Reiner Prokein and can be found on [http://www.reinerstilesets.de/new-textures-billboard-grass/]: | ||
- grass_flower_blue.png | ||
- grass_flower.png | ||
- grass.png | ||
- grass2.png |
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,36 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: http://lwjgl.org/license.php | ||
*/ | ||
#version 110 | ||
|
||
uniform sampler2D tex0; | ||
uniform sampler2D tex1; | ||
uniform sampler2D tex2; | ||
uniform sampler2D tex3; | ||
|
||
varying vec2 texCoordVarying; | ||
varying float yVarying; | ||
varying vec3 normalVarying; | ||
varying float texIndexVarying; | ||
|
||
const vec3 LIGHT_DIR = normalize(vec3(0.1, 1, 0.1)); | ||
|
||
void main(void) { | ||
vec3 n = normalize(normalVarying); | ||
float dot = max(0.0, dot(LIGHT_DIR, n)); | ||
vec4 col; | ||
int texIndexVaryingI = int(texIndexVarying); | ||
if (texIndexVaryingI == 0) | ||
col = texture2D(tex0, texCoordVarying); | ||
else if (texIndexVaryingI == 1) | ||
col = texture2D(tex1, texCoordVarying); | ||
else if (texIndexVaryingI == 2) | ||
col = texture2D(tex2, texCoordVarying); | ||
else | ||
col = texture2D(tex3, texCoordVarying); | ||
col.rgb *= yVarying; | ||
if (col.a < 0.8) | ||
discard; | ||
gl_FragColor = vec4(col.rgb * dot, col.a); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,35 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: http://lwjgl.org/license.php | ||
*/ | ||
#version 110 | ||
#extension GL_NV_non_square_matrices : enable | ||
|
||
attribute vec3 position; | ||
attribute vec2 texCoord; | ||
attribute vec2 displacement; | ||
attribute vec4 worldPosition; | ||
attribute vec4 rotation; | ||
|
||
uniform mat4 vpMatrix; | ||
|
||
varying vec2 texCoordVarying; | ||
varying float yVarying; | ||
varying vec3 normalVarying; | ||
varying float texIndexVarying; | ||
|
||
void main(void) { | ||
texCoordVarying = texCoord; | ||
texIndexVarying = worldPosition.w * worldPosition.w * 4.0; | ||
yVarying = position.y; | ||
vec3 spos = position; | ||
spos.y *= worldPosition.z; | ||
vec2 pos = spos.xz; | ||
mat2x2 rot = mat2x2(rotation.x, rotation.y, rotation.z, rotation.w); | ||
pos = rot * pos; | ||
pos += displacement * yVarying; | ||
pos += worldPosition.xy; | ||
normalVarying = vec3(0.0, 1.0, 0.0); | ||
normalVarying.xz += displacement * yVarying; | ||
gl_Position = vpMatrix * vec4(pos.x, spos.y, pos.y, 1.0); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,9 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: http://lwjgl.org/license.php | ||
*/ | ||
#version 110 | ||
|
||
void main(void) { | ||
gl_FragColor = vec4(0.2, 0.2, 0.13, 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,19 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: http://lwjgl.org/license.php | ||
*/ | ||
#version 110 | ||
|
||
attribute vec2 position; | ||
|
||
uniform mat4 vpMatrix; | ||
uniform float groundSize; | ||
|
||
varying vec2 texCoordVarying; | ||
|
||
void main(void) { | ||
texCoordVarying = position * groundSize; | ||
vec2 pos = position * 2.0 - vec2(1.0, 1.0); | ||
pos *= groundSize; | ||
gl_Position = vpMatrix * vec4(pos.x, 0.0, pos.y, 1.0); | ||
} |
Oops, something went wrong.