forked from raysan5/raylib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'raysan5:master' into pure
- Loading branch information
Showing
47 changed files
with
1,348 additions
and
357 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
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
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
18 changes: 18 additions & 0 deletions
18
examples/shaders/resources/shaders/glsl100/vertex_displacement.fs
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 @@ | ||
#version 100 | ||
|
||
precision mediump float; | ||
|
||
// Input vertex attributes (from fragment shader) | ||
varying vec2 fragTexCoord; | ||
varying float height; | ||
|
||
|
||
void main() | ||
{ | ||
vec4 darkblue = vec4(0.0, 0.13, 0.18, 1.0); | ||
vec4 lightblue = vec4(1.0, 1.0, 1.0, 1.0); | ||
// Interpolate between two colors based on height | ||
vec4 finalColor = mix(darkblue, lightblue, height); | ||
|
||
gl_FragColor = finalColor; | ||
} |
45 changes: 45 additions & 0 deletions
45
examples/shaders/resources/shaders/glsl100/vertex_displacement.vs
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,45 @@ | ||
#version 100 | ||
|
||
precision mediump float; | ||
|
||
attribute vec3 vertexPosition; | ||
attribute vec2 vertexTexCoord; | ||
attribute vec3 vertexNormal; | ||
attribute vec4 vertexColor; | ||
|
||
uniform mat4 mvp; | ||
uniform mat4 matModel; | ||
uniform mat4 matNormal; | ||
|
||
uniform float time; | ||
|
||
uniform sampler2D perlinNoiseMap; | ||
|
||
varying vec3 fragPosition; | ||
varying vec2 fragTexCoord; | ||
varying vec3 fragNormal; | ||
varying float height; | ||
|
||
void main() | ||
{ | ||
// Calculate animated texture coordinates based on time and vertex position | ||
vec2 animatedTexCoord = sin(vertexTexCoord + vec2(sin(time + vertexPosition.x * 0.1), cos(time + vertexPosition.z * 0.1)) * 0.3); | ||
|
||
// Normalize animated texture coordinates to range [0, 1] | ||
animatedTexCoord = animatedTexCoord * 0.5 + 0.5; | ||
|
||
// Fetch displacement from the perlin noise map | ||
float displacement = texture2D(perlinNoiseMap, animatedTexCoord).r * 7.0; // Amplified displacement | ||
|
||
// Displace vertex position | ||
vec3 displacedPosition = vertexPosition + vec3(0.0, displacement, 0.0); | ||
|
||
// Send vertex attributes to fragment shader | ||
fragPosition = vec3(matModel * vec4(displacedPosition, 1.0)); | ||
fragTexCoord = vertexTexCoord; | ||
fragNormal = normalize(vec3(matNormal * vec4(vertexNormal, 1.0))); | ||
height = displacedPosition.y * 0.2; // send height to fragment shader for coloring | ||
|
||
// Calculate final vertex position | ||
gl_Position = mvp * vec4(displacedPosition, 1.0); | ||
} |
Oops, something went wrong.