diff options
| author | Ray <[email protected]> | 2023-11-21 00:15:06 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2023-11-21 00:15:06 +0100 |
| commit | 4dae94821bc5c74af1887933ccbb719b11044879 (patch) | |
| tree | 66b30fe1a9ff58d84421576eba545965278ab1cb /examples/shaders | |
| parent | 299cd9b8305a2043c1d4934b1b1c574a204608d0 (diff) | |
| parent | 994c4f4bdf1f47f706447724b813c9304a66fb16 (diff) | |
| download | raylib-4dae94821bc5c74af1887933ccbb719b11044879.tar.gz raylib-4dae94821bc5c74af1887933ccbb719b11044879.zip | |
Merge branch 'master' of https://github.com/raysan5/raylib
Diffstat (limited to 'examples/shaders')
| -rw-r--r-- | examples/shaders/resources/shaders/glsl100/lightmap.fs | 22 | ||||
| -rw-r--r-- | examples/shaders/resources/shaders/glsl100/lightmap.vs | 31 | ||||
| -rw-r--r-- | examples/shaders/resources/shaders/glsl120/lightmap.fs | 20 | ||||
| -rw-r--r-- | examples/shaders/resources/shaders/glsl120/lightmap.vs | 31 | ||||
| -rw-r--r-- | examples/shaders/shaders_lightmap.c | 1 |
5 files changed, 104 insertions, 1 deletions
diff --git a/examples/shaders/resources/shaders/glsl100/lightmap.fs b/examples/shaders/resources/shaders/glsl100/lightmap.fs new file mode 100644 index 00000000..9f0bcd27 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl100/lightmap.fs @@ -0,0 +1,22 @@ +#version 100 + +precision mediump float; + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec2 fragTexCoord2; +varying vec3 fragPosition; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform sampler2D texture1; + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord); + vec4 texelColor2 = texture2D(texture1, fragTexCoord2); + + gl_FragColor = texelColor * texelColor2; +} diff --git a/examples/shaders/resources/shaders/glsl100/lightmap.vs b/examples/shaders/resources/shaders/glsl100/lightmap.vs new file mode 100644 index 00000000..f5d87b3e --- /dev/null +++ b/examples/shaders/resources/shaders/glsl100/lightmap.vs @@ -0,0 +1,31 @@ +#version 100 + +// Input vertex attributes +attribute vec3 vertexPosition; +attribute vec2 vertexTexCoord; +attribute vec2 vertexTexCoord2; +attribute vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; +uniform mat4 matModel; + +// Output vertex attributes (to fragment shader) +varying vec3 fragPosition; +varying vec2 fragTexCoord; +varying vec2 fragTexCoord2; +varying vec4 fragColor; + +// NOTE: Add here your custom variables + +void main() +{ + // Send vertex attributes to fragment shader + fragPosition = vec3(matModel*vec4(vertexPosition, 1.0)); + fragTexCoord = vertexTexCoord; + fragTexCoord2 = vertexTexCoord2; + fragColor = vertexColor; + + // Calculate final vertex position + gl_Position = mvp*vec4(vertexPosition, 1.0); +} diff --git a/examples/shaders/resources/shaders/glsl120/lightmap.fs b/examples/shaders/resources/shaders/glsl120/lightmap.fs new file mode 100644 index 00000000..93a0609e --- /dev/null +++ b/examples/shaders/resources/shaders/glsl120/lightmap.fs @@ -0,0 +1,20 @@ +#version 120 + +// Input vertex attributes (from vertex shader) +varying vec2 fragTexCoord; +varying vec2 fragTexCoord2; +varying vec3 fragPosition; +varying vec4 fragColor; + +// Input uniform values +uniform sampler2D texture0; +uniform sampler2D texture1; + +void main() +{ + // Texel color fetching from texture sampler + vec4 texelColor = texture2D(texture0, fragTexCoord); + vec4 texelColor2 = texture2D(texture1, fragTexCoord2); + + gl_FragColor = texelColor * texelColor2; +} diff --git a/examples/shaders/resources/shaders/glsl120/lightmap.vs b/examples/shaders/resources/shaders/glsl120/lightmap.vs new file mode 100644 index 00000000..9847b253 --- /dev/null +++ b/examples/shaders/resources/shaders/glsl120/lightmap.vs @@ -0,0 +1,31 @@ +#version 120 + +// Input vertex attributes +attribute vec3 vertexPosition; +attribute vec2 vertexTexCoord; +attribute vec2 vertexTexCoord2; +attribute vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; +uniform mat4 matModel; + +// Output vertex attributes (to fragment shader) +varying vec3 fragPosition; +varying vec2 fragTexCoord; +varying vec2 fragTexCoord2; +varying vec4 fragColor; + +// NOTE: Add here your custom variables + +void main() +{ + // Send vertex attributes to fragment shader + fragPosition = vec3(matModel*vec4(vertexPosition, 1.0)); + fragTexCoord = vertexTexCoord; + fragTexCoord2 = vertexTexCoord2; + fragColor = vertexColor; + + // Calculate final vertex position + gl_Position = mvp*vec4(vertexPosition, 1.0); +} diff --git a/examples/shaders/shaders_lightmap.c b/examples/shaders/shaders_lightmap.c index c5ed6094..445d81d2 100644 --- a/examples/shaders/shaders_lightmap.c +++ b/examples/shaders/shaders_lightmap.c @@ -170,4 +170,3 @@ int main(void) return 0; } - |
