4 Commits

Author SHA1 Message Date
Ray
bb28d7fd0e Update normalmap.fs 2025-09-21 20:37:01 +02:00
Ray
363855ec3e Update rexm.c 2025-09-21 20:21:42 +02:00
Ray
8ada37d967 Update depth_write.fs 2025-09-21 13:28:30 +02:00
Ray
e7cfd3d4a3 Update depth_render.fs 2025-09-21 13:28:27 +02:00
4 changed files with 19 additions and 16 deletions

View File

@ -1,5 +1,7 @@
#version 100 #version 100
precision mediump float;
// Input vertex attributes (from vertex shader) // Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
@ -14,8 +16,7 @@ void main()
{ {
// Handle potential Y-flipping // Handle potential Y-flipping
vec2 texCoord = fragTexCoord; vec2 texCoord = fragTexCoord;
if (flipY) if (flipY) texCoord.y = 1.0 - texCoord.y;
texCoord.y = 1.0 - texCoord.y;
// Sample depth texture // Sample depth texture
float depth = texture2D(depthTexture, texCoord).r; float depth = texture2D(depthTexture, texCoord).r;
@ -25,4 +26,4 @@ void main()
// Output final color // Output final color
gl_FragColor = vec4(vec3(linearDepth), 1.0); gl_FragColor = vec4(vec3(linearDepth), 1.0);
} }

View File

@ -1,11 +1,13 @@
#version 100 #version 100
#extension GL_EXT_frag_depth : enable #extension GL_EXT_frag_depth : enable
precision mediump float; precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord; varying vec2 fragTexCoord;
varying vec4 fragColor; varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 colDiffuse; uniform vec4 colDiffuse;
@ -15,4 +17,4 @@ void main()
gl_FragColor = texelColor*colDiffuse*fragColor; gl_FragColor = texelColor*colDiffuse*fragColor;
gl_FragDepthEXT = 1.0 - gl_FragCoord.z; gl_FragDepthEXT = 1.0 - gl_FragCoord.z;
} }

View File

@ -23,20 +23,20 @@ uniform float specularExponent;
void main() void main()
{ {
vec4 texelColor = texture(texture0, vec2(fragTexCoord.x, fragTexCoord.y)); vec4 texelColor = texture2D(texture0, vec2(fragTexCoord.x, fragTexCoord.y));
vec3 specular = vec3(0.0); vec3 specular = vec3(0.0);
vec3 viewDir = normalize(viewPos - fragPosition); vec3 viewDir = normalize(viewPos - fragPosition);
vec3 lightDir = normalize(lightPos - fragPosition); vec3 lightDir = normalize(lightPos - fragPosition);
vec3 normal; vec3 normal = vec3(0.0);
if (useNormalMap) if (useNormalMap)
{ {
normal = texture(normalMap, vec2(fragTexCoord.x, fragTexCoord.y)).rgb; normal = texture2D(normalMap, vec2(fragTexCoord.x, fragTexCoord.y)).rgb;
//Transform normal values to the range -1.0 ... 1.0 // Transform normal values to the range -1.0 ... 1.0
normal = normalize(normal*2.0 - 1.0); normal = normalize(normal*2.0 - 1.0);
//Transform the normal from tangent-space to world-space for lighting calculation // Transform the normal from tangent-space to world-space for lighting calculation
normal = normalize(normal*TBN); normal = normalize(normal*TBN);
} }
else else
@ -56,7 +56,7 @@ void main()
specular += specCo; specular += specCo;
finalColor = (texelColor*((tint + vec4(specular, 1.0))*vec4(lightDot, 1.0))); vec4 finalColor = (texelColor*((tint + vec4(specular, 1.0))*vec4(lightDot, 1.0)));
finalColor += texelColor*(vec4(1.0, 1.0, 1.0, 1.0)/40.0)*tint; finalColor += texelColor*(vec4(1.0, 1.0, 1.0, 1.0)/40.0)*tint;
// Gamma correction // Gamma correction

View File

@ -939,22 +939,22 @@ int main(int argc, char *argv[])
UnloadImage(imScreenshot); UnloadImage(imScreenshot);
// Validate: raylib/examples/Makefile -> Example listed? // Validate: raylib/examples/Makefile -> Example listed?
if (FileTextFind(TextFormat("%s/Makefile", exBasePath), exInfo->name) == -1) exInfo->status |= VALID_NOT_IN_MAKEFILE; if (FileTextFindIndex(TextFormat("%s/Makefile", exBasePath), exInfo->name) == -1) exInfo->status |= VALID_NOT_IN_MAKEFILE;
// Validate: raylib/examples/Makefile.Web -> Example listed? // Validate: raylib/examples/Makefile.Web -> Example listed?
if (FileTextFind(TextFormat("%s/Makefile.Web", exBasePath), exInfo->name) == -1) exInfo->status |= VALID_NOT_IN_MAKEFILE_WEB; if (FileTextFindIndex(TextFormat("%s/Makefile.Web", exBasePath), exInfo->name) == -1) exInfo->status |= VALID_NOT_IN_MAKEFILE_WEB;
// Validate: raylib/examples/README.md -> Example listed? // Validate: raylib/examples/README.md -> Example listed?
if (FileTextFind(TextFormat("%s/README.md", exBasePath), exInfo->name) == -1) exInfo->status |= VALID_NOT_IN_README; if (FileTextFindIndex(TextFormat("%s/README.md", exBasePath), exInfo->name) == -1) exInfo->status |= VALID_NOT_IN_README;
// Validate: raylib.com/common/examples.js -> Example listed? // Validate: raylib.com/common/examples.js -> Example listed?
if (FileTextFind(TextFormat("%s/../common/examples.js", exWebPath), exInfo->name + TextFindIndex(exInfo->name, "_") + 1) == -1) exInfo->status |= VALID_NOT_IN_JS; if (FileTextFindIndex(TextFormat("%s/../common/examples.js", exWebPath), exInfo->name + TextFindIndex(exInfo->name, "_") + 1) == -1) exInfo->status |= VALID_NOT_IN_JS;
// Validate: raylib/projects/VS2022/examples/<category>_example_name.vcxproj -> File exists? // Validate: raylib/projects/VS2022/examples/<category>_example_name.vcxproj -> File exists?
if (!FileExists(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exInfo->name))) exInfo->status |= VALID_MISSING_VCXPROJ; if (!FileExists(TextFormat("%s/../projects/VS2022/examples/%s.vcxproj", exBasePath, exInfo->name))) exInfo->status |= VALID_MISSING_VCXPROJ;
// Validate: raylib/projects/VS2022/raylib.sln -> Example listed? // Validate: raylib/projects/VS2022/raylib.sln -> Example listed?
if (FileTextFind(TextFormat("%s/../projects/VS2022/raylib.sln", exBasePath), exInfo->name) == -1) exInfo->status |= VALID_NOT_IN_VCXSOL; if (FileTextFindIndex(TextFormat("%s/../projects/VS2022/raylib.sln", exBasePath), exInfo->name) == -1) exInfo->status |= VALID_NOT_IN_VCXSOL;
// Validate: raylib/examples/<category>/resources/.. -> Example resources available? // Validate: raylib/examples/<category>/resources/.. -> Example resources available?
// Scan resources used in example to check for missing resource files // Scan resources used in example to check for missing resource files