Merge branch 'raysan5:master' into pure
This commit is contained in:
commit
6b23824289
|
|
@ -50,7 +50,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||
| [raylib-matte](https://github.com/jcorks/raylib-matte) | 4.6-dev | [Matte](https://github.com/jcorks/matte) | **???** |
|
||||
| [Raylib.nelua](https://github.com/AuzFox/Raylib.nelua) | **5.0** | [nelua](https://nelua.io) | Zlib |
|
||||
| [raylib-bindings](https://github.com/vaiorabbit/raylib-bindings) | 5.6-dev | [Ruby](https://www.ruby-lang.org/en) | Zlib |
|
||||
| [naylib](https://github.com/planetis-m/naylib) | **5.1-dev** | [Nim](https://nim-lang.org) | MIT |
|
||||
| [naylib](https://github.com/planetis-m/naylib) | **5.6-dev** | [Nim](https://nim-lang.org) | MIT |
|
||||
| [node-raylib](https://github.com/RobLoach/node-raylib) | 4.5 | [Node.js](https://nodejs.org/en) | Zlib |
|
||||
| [raylib-odin](https://github.com/odin-lang/Odin/tree/master/vendor/raylib) | **5.5** | [Odin](https://odin-lang.org) | BSD-3Clause |
|
||||
| [raylib_odin_bindings](https://github.com/Deathbat2190/raylib_odin_bindings) | 4.0-dev | [Odin](https://odin-lang.org) | MIT |
|
||||
|
|
@ -69,6 +69,7 @@ Some people ported raylib to other languages in the form of bindings or wrappers
|
|||
| [raylibr](https://github.com/jeroenjanssens/raylibr) | 4.0 | [R](https://www.r-project.org) | MIT |
|
||||
| [raylib-ffi](https://github.com/ewpratten/raylib-ffi) | 5.5 | [Rust](https://www.rust-lang.org) | GPLv3 |
|
||||
| [raylib-rs](https://github.com/raylib-rs/raylib-rs) | **5.5** | [Rust](https://www.rust-lang.org) | Zlib |
|
||||
| [raylib-ruby](https://github.com/wilsonsilva/raylib-ruby) | 4.5 | [Ruby](https://www.ruby-lang.org) | Zlib |
|
||||
| [Relib](https://github.com/RedCubeDev-ByteSpace/Relib) | 3.5 | [ReCT](https://github.com/RedCubeDev-ByteSpace/ReCT) | **???** |
|
||||
| [racket-raylib](https://github.com/eutro/racket-raylib) | 4.0 | [Racket](https://racket-lang.org) | MIT/Apache-2.0 |
|
||||
| [raylib-swift](https://github.com/STREGAsGate/Raylib) | 4.0 | [Swift](https://swift.org) | MIT |
|
||||
|
|
|
|||
2
LICENSE
2
LICENSE
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
|
||||
This software is provided "as-is", without any express or implied warranty. In no event
|
||||
will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
24
build.zig
24
build.zig
|
|
@ -13,9 +13,9 @@ comptime {
|
|||
|
||||
fn setDesktopPlatform(raylib: *std.Build.Step.Compile, platform: PlatformBackend) void {
|
||||
switch (platform) {
|
||||
.glfw => raylib.defineCMacro("PLATFORM_DESKTOP_GLFW", null),
|
||||
.rgfw => raylib.defineCMacro("PLATFORM_DESKTOP_RGFW", null),
|
||||
.sdl => raylib.defineCMacro("PLATFORM_DESKTOP_SDL", null),
|
||||
.glfw => raylib.root_module.addCMacro("PLATFORM_DESKTOP_GLFW", ""),
|
||||
.rgfw => raylib.root_module.addCMacro("PLATFORM_DESKTOP_RGFW", ""),
|
||||
.sdl => raylib.root_module.addCMacro("PLATFORM_DESKTOP_SDL", ""),
|
||||
else => {},
|
||||
}
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
|||
}
|
||||
|
||||
if (options.opengl_version != .auto) {
|
||||
raylib.defineCMacro(options.opengl_version.toCMacroStr(), null);
|
||||
raylib.root_module.addCMacro(options.opengl_version.toCMacroStr(), "");
|
||||
}
|
||||
|
||||
raylib.addIncludePath(b.path("src/platforms"));
|
||||
|
|
@ -191,7 +191,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
|||
try c_source_files.append("src/rglfw.c");
|
||||
|
||||
if (options.linux_display_backend == .X11 or options.linux_display_backend == .Both) {
|
||||
raylib.defineCMacro("_GLFW_X11", null);
|
||||
raylib.root_module.addCMacro("_GLFW_X11", "");
|
||||
raylib.linkSystemLibrary("GLX");
|
||||
raylib.linkSystemLibrary("X11");
|
||||
raylib.linkSystemLibrary("Xcursor");
|
||||
|
|
@ -211,7 +211,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
|||
, .{});
|
||||
@panic("`wayland-scanner` not found");
|
||||
};
|
||||
raylib.defineCMacro("_GLFW_WAYLAND", null);
|
||||
raylib.root_module.addCMacro("_GLFW_WAYLAND", "");
|
||||
raylib.linkSystemLibrary("EGL");
|
||||
raylib.linkSystemLibrary("wayland-client");
|
||||
raylib.linkSystemLibrary("xkbcommon");
|
||||
|
|
@ -230,16 +230,16 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
|||
} else {
|
||||
if (options.opengl_version == .auto) {
|
||||
raylib.linkSystemLibrary("GLESv2");
|
||||
raylib.defineCMacro("GRAPHICS_API_OPENGL_ES2", null);
|
||||
raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES2", "");
|
||||
}
|
||||
|
||||
raylib.linkSystemLibrary("EGL");
|
||||
raylib.linkSystemLibrary("gbm");
|
||||
raylib.linkSystemLibrary2("libdrm", .{ .use_pkg_config = .force });
|
||||
|
||||
raylib.defineCMacro("PLATFORM_DRM", null);
|
||||
raylib.defineCMacro("EGL_NO_X11", null);
|
||||
raylib.defineCMacro("DEFAULT_BATCH_BUFFER_ELEMENT", "2048");
|
||||
raylib.root_module.addCMacro("PLATFORM_DRM", "");
|
||||
raylib.root_module.addCMacro("EGL_NO_X11", "");
|
||||
raylib.root_module.addCMacro("DEFAULT_BATCH_BUFFER_ELEMENT", "");
|
||||
}
|
||||
},
|
||||
.freebsd, .openbsd, .netbsd, .dragonfly => {
|
||||
|
|
@ -290,9 +290,9 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
|||
raylib.addIncludePath(dep.path("upstream/emscripten/cache/sysroot/include"));
|
||||
}
|
||||
|
||||
raylib.defineCMacro("PLATFORM_WEB", null);
|
||||
raylib.root_module.addCMacro("PLATFORM_WEB", "");
|
||||
if (options.opengl_version == .auto) {
|
||||
raylib.defineCMacro("GRAPHICS_API_OPENGL_ES2", null);
|
||||
raylib.root_module.addCMacro("GRAPHICS_API_OPENGL_ES2", "");
|
||||
}
|
||||
},
|
||||
else => {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
.dependencies = .{
|
||||
.xcode_frameworks = .{
|
||||
.url = "git+https://github.com/hexops/xcode-frameworks#a6bf82e032d4d9923ad5c222d466710fcc05f249",
|
||||
.hash = "12208da4dfcd9b53fb367375fb612ec73f38e53015f1ce6ae6d6e8437a637078e170",
|
||||
.url = "git+https://github.com/hexops/xcode-frameworks#9a45f3ac977fd25dff77e58c6de1870b6808c4a7",
|
||||
.hash = "122098b9174895f9708bc824b0f9e550c401892c40a900006459acf2cbf78acd99bb",
|
||||
.lazy = true,
|
||||
},
|
||||
.emsdk = .{
|
||||
|
|
|
|||
|
|
@ -69,6 +69,14 @@ elseif (${PLATFORM} MATCHES "Android")
|
|||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
list(APPEND raylib_sources ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
|
||||
# NOTE: We remove '-Wl,--no-undefined' (set by default) as it conflicts with '-Wl,-undefined,dynamic_lookup' needed
|
||||
# for compiling with the missing 'void main(void)' declaration in `android_main()`.
|
||||
# We also remove other unnecessary or problematic flags.
|
||||
|
||||
string(REPLACE "-Wl,--no-undefined -Qunused-arguments" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
string(REPLACE "-static-libstdc++" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -u ANativeActivity_onCreate -Wl,-undefined,dynamic_lookup")
|
||||
|
||||
find_library(OPENGL_LIBRARY OpenGL)
|
||||
|
|
|
|||
|
|
@ -124,7 +124,21 @@ endif ()
|
|||
# The rlgl_standalone example only targets desktop, without shared libraries.
|
||||
if (BUILD_SHARED_LIBS OR NOT ${PLATFORM} MATCHES "Desktop")
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/rlgl_standalone.c)
|
||||
endif()
|
||||
|
||||
# The audio examples fail to link if raylib is built without raudio
|
||||
if (NOT SUPPORT_MODULE_RAUDIO)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_mixed_processor.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_module_playing.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_music_stream.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_raw_stream.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_sound_loading.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_sound_multi.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/audio/audio_stream_effects.c)
|
||||
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/others/embedded_files_loading.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/textures/textures_sprite_button.c)
|
||||
list(REMOVE_ITEM example_sources ${CMAKE_CURRENT_SOURCE_DIR}/textures/textures_sprite_explosion.c)
|
||||
endif()
|
||||
|
||||
include_directories(BEFORE SYSTEM others/external/include)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
# > PLATFORM_ANDROID:
|
||||
# - Android (ARM, ARM64)
|
||||
#
|
||||
# Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
# Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
#
|
||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
||||
# will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# raylib makefile for Android project (APK building)
|
||||
#
|
||||
# Copyright (c) 2017-2024 Ramon Santamaria (@raysan5)
|
||||
# Copyright (c) 2017-2025 Ramon Santamaria (@raysan5)
|
||||
#
|
||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
||||
# will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# raylib makefile for Web platform
|
||||
#
|
||||
# Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
# Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
#
|
||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
||||
# will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.Build.Reso
|
|||
exe.linkSystemLibrary("gdi32");
|
||||
exe.linkSystemLibrary("opengl32");
|
||||
|
||||
exe.defineCMacro("PLATFORM_DESKTOP", null);
|
||||
exe.root_module.addCMacro("PLATFORM_DESKTOP", "");
|
||||
},
|
||||
.linux => {
|
||||
exe.linkSystemLibrary("GL");
|
||||
|
|
@ -55,7 +55,7 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.Build.Reso
|
|||
exe.linkSystemLibrary("m");
|
||||
exe.linkSystemLibrary("X11");
|
||||
|
||||
exe.defineCMacro("PLATFORM_DESKTOP", null);
|
||||
exe.root_module.addCMacro("PLATFORM_DESKTOP", "");
|
||||
},
|
||||
.macos => {
|
||||
exe.linkFramework("Foundation");
|
||||
|
|
@ -65,7 +65,7 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.Build.Reso
|
|||
exe.linkFramework("CoreVideo");
|
||||
exe.linkFramework("IOKit");
|
||||
|
||||
exe.defineCMacro("PLATFORM_DESKTOP", null);
|
||||
exe.root_module.addCMacro("PLATFORM_DESKTOP", "");
|
||||
},
|
||||
else => {
|
||||
@panic("Unsupported OS");
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ int main(void)
|
|||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// If anyone moves this frame, how far will they move based on the time since the last frame
|
||||
// this moves thigns at 10 world units per second, regardless of the actual FPS
|
||||
// this moves things at 10 world units per second, regardless of the actual FPS
|
||||
float offsetThisFrame = 10.0f*GetFrameTime();
|
||||
|
||||
// Move Player1 forward and backwards (no turning)
|
||||
|
|
@ -171,4 +171,4 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ BEGIN
|
|||
VALUE "FileDescription", "raylib example"
|
||||
VALUE "FileVersion", "1.0"
|
||||
VALUE "InternalName", "raylib-example"
|
||||
VALUE "LegalCopyright", "(c) 2024 raylib technologies (@raylibtech)"
|
||||
VALUE "LegalCopyright", "(c) 2025 raylib technologies (@raylibtech)"
|
||||
//VALUE "OriginalFilename", "raylib_app.exe"
|
||||
VALUE "ProductName", "raylib-example"
|
||||
VALUE "ProductVersion", "1.0"
|
||||
|
|
|
|||
|
|
@ -6,16 +6,19 @@
|
|||
in vec3 vertexPosition;
|
||||
in vec2 vertexTexCoord;
|
||||
in vec4 vertexColor;
|
||||
in vec3 vertexNormal;
|
||||
in vec4 vertexBoneIds;
|
||||
in vec4 vertexBoneWeights;
|
||||
|
||||
// Input uniform values
|
||||
uniform mat4 mvp;
|
||||
uniform mat4 matNormal;
|
||||
uniform mat4 boneMatrices[MAX_BONE_NUM];
|
||||
|
||||
// Output vertex attributes (to fragment shader)
|
||||
out vec2 fragTexCoord;
|
||||
out vec4 fragColor;
|
||||
out vec3 fragNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -29,9 +32,18 @@ void main()
|
|||
vertexBoneWeights.y*(boneMatrices[boneIndex1]*vec4(vertexPosition, 1.0)) +
|
||||
vertexBoneWeights.z*(boneMatrices[boneIndex2]*vec4(vertexPosition, 1.0)) +
|
||||
vertexBoneWeights.w*(boneMatrices[boneIndex3]*vec4(vertexPosition, 1.0));
|
||||
|
||||
|
||||
vec4 skinnedNormal =
|
||||
vertexBoneWeights.x*(boneMatrices[boneIndex0]*vec4(vertexNormal, 0.0)) +
|
||||
vertexBoneWeights.y*(boneMatrices[boneIndex1]*vec4(vertexNormal, 0.0)) +
|
||||
vertexBoneWeights.z*(boneMatrices[boneIndex2]*vec4(vertexNormal, 0.0)) +
|
||||
vertexBoneWeights.w*(boneMatrices[boneIndex3]*vec4(vertexNormal, 0.0));
|
||||
skinnedNormal.w = 0.0;
|
||||
|
||||
fragTexCoord = vertexTexCoord;
|
||||
fragColor = vertexColor;
|
||||
|
||||
fragNormal = normalize(vec3(matNormal*skinnedNormal));
|
||||
|
||||
gl_Position = mvp*skinnedPosition;
|
||||
}
|
||||
|
|
@ -54,102 +54,108 @@ uniform vec3 viewPos;
|
|||
uniform vec3 ambientColor;
|
||||
uniform float ambient;
|
||||
|
||||
// refl in range 0 to 1
|
||||
// returns base reflectivity to 1
|
||||
// incrase reflectivity when surface view at larger angle
|
||||
vec3 schlickFresnel(float hDotV,vec3 refl)
|
||||
// Reflectivity in range 0.0 to 1.0
|
||||
// NOTE: Reflectivity is increased when surface view at larger angle
|
||||
vec3 SchlickFresnel(float hDotV,vec3 refl)
|
||||
{
|
||||
return refl + (1.0 - refl) * pow(1.0 - hDotV,5.0);
|
||||
return refl + (1.0 - refl)*pow(1.0 - hDotV, 5.0);
|
||||
}
|
||||
|
||||
float ggxDistribution(float nDotH,float roughness)
|
||||
float GgxDistribution(float nDotH,float roughness)
|
||||
{
|
||||
float a = roughness * roughness * roughness * roughness;
|
||||
float d = nDotH * nDotH * (a - 1.0) + 1.0;
|
||||
d = PI * d * d;
|
||||
return a / max(d,0.0000001);
|
||||
float a = roughness*roughness*roughness*roughness;
|
||||
float d = nDotH*nDotH*(a - 1.0) + 1.0;
|
||||
d = PI*d*d;
|
||||
return (a/max(d,0.0000001));
|
||||
}
|
||||
|
||||
float geomSmith(float nDotV,float nDotL,float roughness)
|
||||
float GeomSmith(float nDotV,float nDotL,float roughness)
|
||||
{
|
||||
float r = roughness + 1.0;
|
||||
float k = r * r / 8.0;
|
||||
float ik = 1.0 - k;
|
||||
float ggx1 = nDotV / (nDotV * ik + k);
|
||||
float ggx2 = nDotL / (nDotL * ik + k);
|
||||
return ggx1 * ggx2;
|
||||
float r = roughness + 1.0;
|
||||
float k = r*r/8.0;
|
||||
float ik = 1.0 - k;
|
||||
float ggx1 = nDotV/(nDotV*ik + k);
|
||||
float ggx2 = nDotL/(nDotL*ik + k);
|
||||
return ggx1*ggx2;
|
||||
}
|
||||
|
||||
vec3 pbr(){
|
||||
vec3 albedo = texture2D(albedoMap,vec2(fragTexCoord.x*tiling.x+offset.x,fragTexCoord.y*tiling.y+offset.y)).rgb;
|
||||
albedo = vec3(albedoColor.x*albedo.x,albedoColor.y*albedo.y,albedoColor.z*albedo.z);
|
||||
float metallic = clamp(metallicValue,0.0,1.0);
|
||||
float roughness = clamp(roughnessValue,0.0,1.0);
|
||||
float ao = clamp(aoValue,0.0,1.0);
|
||||
if(useTexMRA == 1) {
|
||||
vec4 mra = texture2D(mraMap, vec2(fragTexCoord.x * tiling.x + offset.x, fragTexCoord.y * tiling.y + offset.y));
|
||||
metallic = clamp(mra.r+metallicValue,0.04,1.0);
|
||||
roughness = clamp(mra.g+roughnessValue,0.04,1.0);
|
||||
ao = (mra.b+aoValue)*0.5;
|
||||
}
|
||||
vec3 ComputePBR()
|
||||
{
|
||||
vec3 albedo = texture2D(albedoMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
|
||||
albedo = vec3(albedoColor.x*albedo.x, albedoColor.y*albedo.y, albedoColor.z*albedo.z);
|
||||
|
||||
float metallic = clamp(metallicValue, 0.0, 1.0);
|
||||
float roughness = clamp(roughnessValue, 0.0, 1.0);
|
||||
float ao = clamp(aoValue, 0.0, 1.0);
|
||||
|
||||
if (useTexMRA == 1)
|
||||
{
|
||||
vec4 mra = texture2D(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y));
|
||||
metallic = clamp(mra.r + metallicValue, 0.04, 1.0);
|
||||
roughness = clamp(mra.g + roughnessValue, 0.04, 1.0);
|
||||
ao = (mra.b + aoValue)*0.5;
|
||||
}
|
||||
|
||||
vec3 N = normalize(fragNormal);
|
||||
if (useTexNormal == 1)
|
||||
{
|
||||
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.y, fragTexCoord.y*tiling.y + offset.y)).rgb;
|
||||
N = normalize(N*2.0 - 1.0);
|
||||
N = normalize(N*TBN);
|
||||
}
|
||||
|
||||
vec3 V = normalize(viewPos - fragPosition);
|
||||
|
||||
vec3 N = normalize(fragNormal);
|
||||
if(useTexNormal == 1) {
|
||||
N = texture2D(normalMap, vec2(fragTexCoord.x * tiling.x + offset.y, fragTexCoord.y * tiling.y + offset.y)).rgb;
|
||||
N = normalize(N * 2.0 - 1.0);
|
||||
N = normalize(N * TBN);
|
||||
}
|
||||
vec3 emissive = vec3(0);
|
||||
emissive = (texture2D(emissiveMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb).g*emissiveColor.rgb*emissivePower*float(useTexEmissive);
|
||||
|
||||
// return N;//vec3(metallic,metallic,metallic);
|
||||
// If dia-electric use base reflectivity of 0.04 otherwise ut is a metal use albedo as base reflectivity
|
||||
vec3 baseRefl = mix(vec3(0.04), albedo.rgb, metallic);
|
||||
vec3 lightAccum = vec3(0.0); // Acumulate lighting lum
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
vec3 L = normalize(lights[i].position - fragPosition); // Compute light vector
|
||||
vec3 H = normalize(V + L); // Compute halfway bisecting vector
|
||||
float dist = length(lights[i].position - fragPosition); // Compute distance to light
|
||||
float attenuation = 1.0/(dist*dist*0.23); // Compute attenuation
|
||||
vec3 radiance = lights[i].color.rgb*lights[i].intensity*attenuation; // Compute input radiance, light energy comming in
|
||||
|
||||
// Cook-Torrance BRDF distribution function
|
||||
float nDotV = max(dot(N,V), 0.0000001);
|
||||
float nDotL = max(dot(N,L), 0.0000001);
|
||||
float hDotV = max(dot(H,V), 0.0);
|
||||
float nDotH = max(dot(N,H), 0.0);
|
||||
float D = GgxDistribution(nDotH, roughness); // Larger the more micro-facets aligned to H
|
||||
float G = GeomSmith(nDotV, nDotL, roughness); // Smaller the more micro-facets shadow
|
||||
vec3 F = SchlickFresnel(hDotV, baseRefl); // Fresnel proportion of specular reflectance
|
||||
|
||||
vec3 spec = (D*G*F)/(4.0*nDotV*nDotL);
|
||||
|
||||
vec3 V = normalize(viewPos - fragPosition);
|
||||
// Difuse and spec light can't be above 1.0
|
||||
// kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent
|
||||
vec3 kD = vec3(1.0) - F;
|
||||
|
||||
vec3 e = vec3(0);
|
||||
e = (texture2D(emissiveMap, vec2(fragTexCoord.x*tiling.x+offset.x, fragTexCoord.y*tiling.y+offset.y)).rgb).g * emissiveColor.rgb*emissivePower * float(useTexEmissive);
|
||||
|
||||
//return N;//vec3(metallic,metallic,metallic);
|
||||
//if dia-electric use base reflectivity of 0.04 otherwise ut is a metal use albedo as base reflectivity
|
||||
vec3 baseRefl = mix(vec3(0.04),albedo.rgb,metallic);
|
||||
vec3 Lo = vec3(0.0); // acumulate lighting lum
|
||||
|
||||
for(int i=0;i<4;++i){
|
||||
|
||||
vec3 L = normalize(lights[i].position - fragPosition); // calc light vector
|
||||
vec3 H = normalize(V + L); // calc halfway bisecting vector
|
||||
float dist = length(lights[i].position - fragPosition); // calc distance to light
|
||||
float attenuation = 1.0 / (dist * dist * 0.23); // calc attenuation
|
||||
vec3 radiance = lights[i].color.rgb * lights[i].intensity * attenuation; // calc input radiance,light energy comming in
|
||||
|
||||
//Cook-Torrance BRDF distribution function
|
||||
float nDotV = max(dot(N,V),0.0000001);
|
||||
float nDotL = max(dot(N,L),0.0000001);
|
||||
float hDotV = max(dot(H,V),0.0);
|
||||
float nDotH = max(dot(N,H),0.0);
|
||||
float D = ggxDistribution(nDotH,roughness); // larger the more micro-facets aligned to H
|
||||
float G = geomSmith(nDotV,nDotL,roughness); // smaller the more micro-facets shadow
|
||||
vec3 F = schlickFresnel(hDotV, baseRefl); // fresnel proportion of specular reflectance
|
||||
|
||||
vec3 spec = (D * G * F) / (4.0 * nDotV * nDotL);
|
||||
// difuse and spec light can't be above 1.0
|
||||
// kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent
|
||||
vec3 kD = vec3(1.0) - F;
|
||||
//mult kD by the inverse of metallnes , only non-metals should have diffuse light
|
||||
kD *= 1.0 - metallic;
|
||||
Lo += ((kD * albedo.rgb / PI + spec) * radiance * nDotL)*float(lights[i].enabled); // angle of light has impact on result
|
||||
}
|
||||
vec3 ambient_final = (ambientColor + albedo)* ambient * 0.5;
|
||||
return ambient_final+Lo*ao+e;
|
||||
// Mult kD by the inverse of metallnes, only non-metals should have diffuse light
|
||||
kD *= 1.0 - metallic;
|
||||
lightAccum += ((kD*albedo.rgb/PI + spec)*radiance*nDotL)*float(lights[i].enabled); // Angle of light has impact on result
|
||||
}
|
||||
|
||||
vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5;
|
||||
|
||||
return (ambientFinal + lightAccum*ao + emissive);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 color = pbr();
|
||||
|
||||
//HDR tonemapping
|
||||
color = pow(color,color + vec3(1.0));
|
||||
//gamma correction
|
||||
color = pow(color,vec3(1.0/2.2));
|
||||
vec3 color = ComputePBR();
|
||||
|
||||
gl_FragColor = vec4(color,1.0);
|
||||
|
||||
// HDR tonemapping
|
||||
color = pow(color, color + vec3(1.0));
|
||||
|
||||
// Gamma correction
|
||||
color = pow(color, vec3(1.0/2.2));
|
||||
|
||||
gl_FragColor = vec4(color,1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,17 +26,17 @@ const float normalOffset = 0.1;
|
|||
// https://github.com/glslify/glsl-inverse
|
||||
mat3 inverse(mat3 m)
|
||||
{
|
||||
float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
|
||||
float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];
|
||||
float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];
|
||||
float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
|
||||
float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];
|
||||
float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];
|
||||
|
||||
float b01 = a22*a11 - a12*a21;
|
||||
float b11 = -a22*a10 + a12*a20;
|
||||
float b21 = a21*a10 - a11*a20;
|
||||
float b01 = a22*a11 - a12*a21;
|
||||
float b11 = -a22*a10 + a12*a20;
|
||||
float b21 = a21*a10 - a11*a20;
|
||||
|
||||
float det = a00*b01 + a01*b11 + a02*b21;
|
||||
float det = a00*b01 + a01*b11 + a02*b21;
|
||||
|
||||
return mat3(b01, (-a22*a01 + a02*a21), (a12*a01 - a02*a11),
|
||||
return mat3(b01, (-a22*a01 + a02*a21), (a12*a01 - a02*a11),
|
||||
b11, (a22*a00 - a02*a20), (-a12*a00 + a02*a10),
|
||||
b21, (-a21*a00 + a01*a20), (a11*a00 - a01*a10))/det;
|
||||
}
|
||||
|
|
@ -44,24 +44,23 @@ mat3 inverse(mat3 m)
|
|||
// https://github.com/glslify/glsl-transpose
|
||||
mat3 transpose(mat3 m)
|
||||
{
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
// calc binormal from vertex normal and tangent
|
||||
// Compute binormal from vertex normal and tangent
|
||||
vec3 vertexBinormal = cross(vertexNormal, vertexTangent);
|
||||
// calc fragment normal based on normal transformations
|
||||
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
||||
// calc fragment position based on model transformations
|
||||
|
||||
// Compute fragment normal based on normal transformations
|
||||
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
||||
|
||||
// Compute fragment position based on model transformations
|
||||
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
|
||||
|
||||
fragTexCoord = vertexTexCoord*2.0;
|
||||
|
||||
fragNormal = normalize(normalMatrix*vertexNormal);
|
||||
vec3 fragTangent = normalize(normalMatrix*vertexTangent);
|
||||
fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal)*fragNormal);
|
||||
|
|
@ -71,5 +70,5 @@ void main()
|
|||
TBN = transpose(mat3(fragTangent, fragBinormal, fragNormal));
|
||||
|
||||
// Calculate final vertex position
|
||||
gl_Position = mvp * vec4(vertexPosition, 1.0);
|
||||
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ varying vec3 fragNormal;
|
|||
varying vec4 shadowPos;
|
||||
varying mat3 TBN;
|
||||
|
||||
|
||||
// Input uniform values
|
||||
uniform int numOfLights;
|
||||
uniform sampler2D albedoMap;
|
||||
|
|
@ -53,102 +52,108 @@ uniform vec3 viewPos;
|
|||
uniform vec3 ambientColor;
|
||||
uniform float ambient;
|
||||
|
||||
// refl in range 0 to 1
|
||||
// returns base reflectivity to 1
|
||||
// incrase reflectivity when surface view at larger angle
|
||||
vec3 schlickFresnel(float hDotV,vec3 refl)
|
||||
// Reflectivity in range 0.0 to 1.0
|
||||
// NOTE: Reflectivity is increased when surface view at larger angle
|
||||
vec3 SchlickFresnel(float hDotV,vec3 refl)
|
||||
{
|
||||
return refl + (1.0 - refl) * pow(1.0 - hDotV,5.0);
|
||||
return refl + (1.0 - refl)*pow(1.0 - hDotV, 5.0);
|
||||
}
|
||||
|
||||
float ggxDistribution(float nDotH,float roughness)
|
||||
float GgxDistribution(float nDotH,float roughness)
|
||||
{
|
||||
float a = roughness * roughness * roughness * roughness;
|
||||
float d = nDotH * nDotH * (a - 1.0) + 1.0;
|
||||
d = PI * d * d;
|
||||
return a / max(d,0.0000001);
|
||||
float a = roughness*roughness*roughness*roughness;
|
||||
float d = nDotH*nDotH*(a - 1.0) + 1.0;
|
||||
d = PI*d*d;
|
||||
return (a/max(d,0.0000001));
|
||||
}
|
||||
|
||||
float geomSmith(float nDotV,float nDotL,float roughness)
|
||||
float GeomSmith(float nDotV,float nDotL,float roughness)
|
||||
{
|
||||
float r = roughness + 1.0;
|
||||
float k = r * r / 8.0;
|
||||
float ik = 1.0 - k;
|
||||
float ggx1 = nDotV / (nDotV * ik + k);
|
||||
float ggx2 = nDotL / (nDotL * ik + k);
|
||||
return ggx1 * ggx2;
|
||||
float r = roughness + 1.0;
|
||||
float k = r*r/8.0;
|
||||
float ik = 1.0 - k;
|
||||
float ggx1 = nDotV/(nDotV*ik + k);
|
||||
float ggx2 = nDotL/(nDotL*ik + k);
|
||||
return ggx1*ggx2;
|
||||
}
|
||||
|
||||
vec3 pbr(){
|
||||
vec3 albedo = texture2D(albedoMap,vec2(fragTexCoord.x*tiling.x+offset.x,fragTexCoord.y*tiling.y+offset.y)).rgb;
|
||||
albedo = vec3(albedoColor.x*albedo.x,albedoColor.y*albedo.y,albedoColor.z*albedo.z);
|
||||
float metallic = clamp(metallicValue,0.0,1.0);
|
||||
float roughness = clamp(roughnessValue,0.0,1.0);
|
||||
float ao = clamp(aoValue,0.0,1.0);
|
||||
if(useTexMRA == 1) {
|
||||
vec4 mra = texture2D(mraMap, vec2(fragTexCoord.x * tiling.x + offset.x, fragTexCoord.y * tiling.y + offset.y));
|
||||
metallic = clamp(mra.r+metallicValue,0.04,1.0);
|
||||
roughness = clamp(mra.g+roughnessValue,0.04,1.0);
|
||||
ao = (mra.b+aoValue)*0.5;
|
||||
}
|
||||
vec3 ComputePBR()
|
||||
{
|
||||
vec3 albedo = texture2D(albedoMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb;
|
||||
albedo = vec3(albedoColor.x*albedo.x, albedoColor.y*albedo.y, albedoColor.z*albedo.z);
|
||||
|
||||
float metallic = clamp(metallicValue, 0.0, 1.0);
|
||||
float roughness = clamp(roughnessValue, 0.0, 1.0);
|
||||
float ao = clamp(aoValue, 0.0, 1.0);
|
||||
|
||||
if (useTexMRA == 1)
|
||||
{
|
||||
vec4 mra = texture2D(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y));
|
||||
metallic = clamp(mra.r + metallicValue, 0.04, 1.0);
|
||||
roughness = clamp(mra.g + roughnessValue, 0.04, 1.0);
|
||||
ao = (mra.b + aoValue)*0.5;
|
||||
}
|
||||
|
||||
vec3 N = normalize(fragNormal);
|
||||
if (useTexNormal == 1)
|
||||
{
|
||||
N = texture2D(normalMap, vec2(fragTexCoord.x*tiling.x + offset.y, fragTexCoord.y*tiling.y + offset.y)).rgb;
|
||||
N = normalize(N*2.0 - 1.0);
|
||||
N = normalize(N*TBN);
|
||||
}
|
||||
|
||||
vec3 V = normalize(viewPos - fragPosition);
|
||||
|
||||
vec3 N = normalize(fragNormal);
|
||||
if(useTexNormal == 1) {
|
||||
N = texture2D(normalMap, vec2(fragTexCoord.x * tiling.x + offset.y, fragTexCoord.y * tiling.y + offset.y)).rgb;
|
||||
N = normalize(N * 2.0 - 1.0);
|
||||
N = normalize(N * TBN);
|
||||
}
|
||||
vec3 emissive = vec3(0);
|
||||
emissive = (texture2D(emissiveMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb).g*emissiveColor.rgb*emissivePower*float(useTexEmissive);
|
||||
|
||||
// return N;//vec3(metallic,metallic,metallic);
|
||||
// If dia-electric use base reflectivity of 0.04 otherwise ut is a metal use albedo as base reflectivity
|
||||
vec3 baseRefl = mix(vec3(0.04), albedo.rgb, metallic);
|
||||
vec3 lightAccum = vec3(0.0); // Acumulate lighting lum
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
vec3 L = normalize(lights[i].position - fragPosition); // Compute light vector
|
||||
vec3 H = normalize(V + L); // Compute halfway bisecting vector
|
||||
float dist = length(lights[i].position - fragPosition); // Compute distance to light
|
||||
float attenuation = 1.0/(dist*dist*0.23); // Compute attenuation
|
||||
vec3 radiance = lights[i].color.rgb*lights[i].intensity*attenuation; // Compute input radiance, light energy comming in
|
||||
|
||||
// Cook-Torrance BRDF distribution function
|
||||
float nDotV = max(dot(N,V), 0.0000001);
|
||||
float nDotL = max(dot(N,L), 0.0000001);
|
||||
float hDotV = max(dot(H,V), 0.0);
|
||||
float nDotH = max(dot(N,H), 0.0);
|
||||
float D = GgxDistribution(nDotH, roughness); // Larger the more micro-facets aligned to H
|
||||
float G = GeomSmith(nDotV, nDotL, roughness); // Smaller the more micro-facets shadow
|
||||
vec3 F = SchlickFresnel(hDotV, baseRefl); // Fresnel proportion of specular reflectance
|
||||
|
||||
vec3 spec = (D*G*F)/(4.0*nDotV*nDotL);
|
||||
|
||||
vec3 V = normalize(viewPos - fragPosition);
|
||||
// Difuse and spec light can't be above 1.0
|
||||
// kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent
|
||||
vec3 kD = vec3(1.0) - F;
|
||||
|
||||
vec3 e = vec3(0);
|
||||
e = (texture2D(emissiveMap, vec2(fragTexCoord.x*tiling.x+offset.x, fragTexCoord.y*tiling.y+offset.y)).rgb).g * emissiveColor.rgb*emissivePower * float(useTexEmissive);
|
||||
|
||||
//return N;//vec3(metallic,metallic,metallic);
|
||||
//if dia-electric use base reflectivity of 0.04 otherwise ut is a metal use albedo as base reflectivity
|
||||
vec3 baseRefl = mix(vec3(0.04),albedo.rgb,metallic);
|
||||
vec3 Lo = vec3(0.0); // acumulate lighting lum
|
||||
|
||||
for(int i=0;i<numOfLights;++i){
|
||||
|
||||
vec3 L = normalize(lights[i].position - fragPosition); // calc light vector
|
||||
vec3 H = normalize(V + L); // calc halfway bisecting vector
|
||||
float dist = length(lights[i].position - fragPosition); // calc distance to light
|
||||
float attenuation = 1.0 / (dist * dist * 0.23); // calc attenuation
|
||||
vec3 radiance = lights[i].color.rgb * lights[i].intensity * attenuation; // calc input radiance,light energy comming in
|
||||
|
||||
//Cook-Torrance BRDF distribution function
|
||||
float nDotV = max(dot(N,V),0.0000001);
|
||||
float nDotL = max(dot(N,L),0.0000001);
|
||||
float hDotV = max(dot(H,V),0.0);
|
||||
float nDotH = max(dot(N,H),0.0);
|
||||
float D = ggxDistribution(nDotH,roughness); // larger the more micro-facets aligned to H
|
||||
float G = geomSmith(nDotV,nDotL,roughness); // smaller the more micro-facets shadow
|
||||
vec3 F = schlickFresnel(hDotV, baseRefl); // fresnel proportion of specular reflectance
|
||||
|
||||
vec3 spec = (D * G * F) / (4.0 * nDotV * nDotL);
|
||||
// difuse and spec light can't be above 1.0
|
||||
// kD = 1.0 - kS diffuse component is equal 1.0 - spec comonent
|
||||
vec3 kD = vec3(1.0) - F;
|
||||
//mult kD by the inverse of metallnes , only non-metals should have diffuse light
|
||||
kD *= 1.0 - metallic;
|
||||
Lo += ((kD * albedo.rgb / PI + spec) * radiance * nDotL)*float(lights[i].enabled); // angle of light has impact on result
|
||||
}
|
||||
vec3 ambient_final = (ambientColor + albedo)* ambient * 0.5;
|
||||
return ambient_final+Lo*ao+e;
|
||||
// Mult kD by the inverse of metallnes, only non-metals should have diffuse light
|
||||
kD *= 1.0 - metallic;
|
||||
lightAccum += ((kD*albedo.rgb/PI + spec)*radiance*nDotL)*float(lights[i].enabled); // Angle of light has impact on result
|
||||
}
|
||||
|
||||
vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5;
|
||||
|
||||
return (ambientFinal + lightAccum*ao + emissive);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 color = pbr();
|
||||
|
||||
//HDR tonemapping
|
||||
color = pow(color,color + vec3(1.0));
|
||||
//gamma correction
|
||||
color = pow(color,vec3(1.0/2.2));
|
||||
vec3 color = ComputePBR();
|
||||
|
||||
gl_FragColor = vec4(color,1.0);
|
||||
|
||||
// HDR tonemapping
|
||||
color = pow(color, color + vec3(1.0));
|
||||
|
||||
// Gamma correction
|
||||
color = pow(color, vec3(1.0/2.2));
|
||||
|
||||
gl_FragColor = vec4(color,1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#version 120
|
||||
|
||||
// Input vertex attributes
|
||||
attribute vec3 vertexPosition;
|
||||
attribute vec2 vertexTexCoord;
|
||||
attribute vec3 vertexNormal;
|
||||
attribute vec3 vertexTangent;
|
||||
attribute vec4 vertexColor;
|
||||
attribute vec3 vertexPosition;
|
||||
attribute vec2 vertexTexCoord;
|
||||
attribute vec3 vertexNormal;
|
||||
attribute vec3 vertexTangent;
|
||||
attribute vec4 vertexColor;
|
||||
|
||||
// Input uniform values
|
||||
uniform mat4 mvp;
|
||||
|
|
@ -26,17 +26,17 @@ const float normalOffset = 0.1;
|
|||
// https://github.com/glslify/glsl-inverse
|
||||
mat3 inverse(mat3 m)
|
||||
{
|
||||
float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
|
||||
float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];
|
||||
float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];
|
||||
float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
|
||||
float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];
|
||||
float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];
|
||||
|
||||
float b01 = a22*a11 - a12*a21;
|
||||
float b11 = -a22*a10 + a12*a20;
|
||||
float b21 = a21*a10 - a11*a20;
|
||||
float b01 = a22*a11 - a12*a21;
|
||||
float b11 = -a22*a10 + a12*a20;
|
||||
float b21 = a21*a10 - a11*a20;
|
||||
|
||||
float det = a00*b01 + a01*b11 + a02*b21;
|
||||
float det = a00*b01 + a01*b11 + a02*b21;
|
||||
|
||||
return mat3(b01, (-a22*a01 + a02*a21), (a12*a01 - a02*a11),
|
||||
return mat3(b01, (-a22*a01 + a02*a21), (a12*a01 - a02*a11),
|
||||
b11, (a22*a00 - a02*a20), (-a12*a00 + a02*a10),
|
||||
b21, (-a21*a00 + a01*a20), (a11*a00 - a01*a10))/det;
|
||||
}
|
||||
|
|
@ -44,24 +44,23 @@ mat3 inverse(mat3 m)
|
|||
// https://github.com/glslify/glsl-transpose
|
||||
mat3 transpose(mat3 m)
|
||||
{
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
return mat3(m[0][0], m[1][0], m[2][0],
|
||||
m[0][1], m[1][1], m[2][1],
|
||||
m[0][2], m[1][2], m[2][2]);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
// calc binormal from vertex normal and tangent
|
||||
// Compute binormal from vertex normal and tangent
|
||||
vec3 vertexBinormal = cross(vertexNormal, vertexTangent);
|
||||
// calc fragment normal based on normal transformations
|
||||
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
||||
// calc fragment position based on model transformations
|
||||
|
||||
// Compute fragment normal based on normal transformations
|
||||
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
||||
|
||||
// Compute fragment position based on model transformations
|
||||
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
|
||||
|
||||
fragTexCoord = vertexTexCoord*2.0;
|
||||
|
||||
fragNormal = normalize(normalMatrix*vertexNormal);
|
||||
vec3 fragTangent = normalize(normalMatrix*vertexTangent);
|
||||
fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal)*fragNormal);
|
||||
|
|
@ -71,5 +70,5 @@ void main()
|
|||
TBN = transpose(mat3(fragTangent, fragBinormal, fragNormal));
|
||||
|
||||
// Calculate final vertex position
|
||||
gl_Position = mvp * vec4(vertexPosition, 1.0);
|
||||
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
||||
}
|
||||
|
|
@ -64,16 +64,16 @@ vec3 SchlickFresnel(float hDotV,vec3 refl)
|
|||
|
||||
float GgxDistribution(float nDotH,float roughness)
|
||||
{
|
||||
float a = roughness * roughness * roughness * roughness;
|
||||
float d = nDotH * nDotH * (a - 1.0) + 1.0;
|
||||
d = PI * d * d;
|
||||
return a / max(d,0.0000001);
|
||||
float a = roughness*roughness*roughness*roughness;
|
||||
float d = nDotH*nDotH*(a - 1.0) + 1.0;
|
||||
d = PI*d*d;
|
||||
return (a/max(d,0.0000001));
|
||||
}
|
||||
|
||||
float GeomSmith(float nDotV,float nDotL,float roughness)
|
||||
{
|
||||
float r = roughness + 1.0;
|
||||
float k = r*r / 8.0;
|
||||
float k = r*r/8.0;
|
||||
float ik = 1.0 - k;
|
||||
float ggx1 = nDotV/(nDotV*ik + k);
|
||||
float ggx2 = nDotL/(nDotL*ik + k);
|
||||
|
|
@ -91,7 +91,7 @@ vec3 ComputePBR()
|
|||
|
||||
if (useTexMRA == 1)
|
||||
{
|
||||
vec4 mra = texture(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y))*useTexMRA;
|
||||
vec4 mra = texture(mraMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y));
|
||||
metallic = clamp(mra.r + metallicValue, 0.04, 1.0);
|
||||
roughness = clamp(mra.g + roughnessValue, 0.04, 1.0);
|
||||
ao = (mra.b + aoValue)*0.5;
|
||||
|
|
@ -108,10 +108,10 @@ vec3 ComputePBR()
|
|||
vec3 V = normalize(viewPos - fragPosition);
|
||||
|
||||
vec3 emissive = vec3(0);
|
||||
emissive = (texture(emissiveMap, vec2(fragTexCoord.x*tiling.x+offset.x, fragTexCoord.y*tiling.y+offset.y)).rgb).g * emissiveColor.rgb*emissivePower * useTexEmissive;
|
||||
emissive = (texture(emissiveMap, vec2(fragTexCoord.x*tiling.x + offset.x, fragTexCoord.y*tiling.y + offset.y)).rgb).g*emissiveColor.rgb*emissivePower*useTexEmissive;
|
||||
|
||||
// return N;//vec3(metallic,metallic,metallic);
|
||||
// if dia-electric use base reflectivity of 0.04 otherwise ut is a metal use albedo as base reflectivity
|
||||
// If dia-electric use base reflectivity of 0.04 otherwise ut is a metal use albedo as base reflectivity
|
||||
vec3 baseRefl = mix(vec3(0.04), albedo.rgb, metallic);
|
||||
vec3 lightAccum = vec3(0.0); // Acumulate lighting lum
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ vec3 ComputePBR()
|
|||
|
||||
vec3 ambientFinal = (ambientColor + albedo)*ambient*0.5;
|
||||
|
||||
return ambientFinal + lightAccum*ao + emissive;
|
||||
return (ambientFinal + lightAccum*ao + emissive);
|
||||
}
|
||||
|
||||
void main()
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ void main()
|
|||
{
|
||||
// Compute binormal from vertex normal and tangent
|
||||
vec3 vertexBinormal = cross(vertexNormal, vertexTangent);
|
||||
|
||||
|
||||
// Compute fragment normal based on normal transformations
|
||||
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
||||
|
||||
|
||||
// Compute fragment position based on model transformations
|
||||
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0f));
|
||||
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
|
||||
|
||||
fragTexCoord = vertexTexCoord*2.0;
|
||||
fragNormal = normalize(normalMatrix*vertexNormal);
|
||||
|
|
|
|||
|
|
@ -134,14 +134,15 @@ int main(void)
|
|||
}
|
||||
|
||||
// Now we initialize the sampler2D uniform's in the deferred shader.
|
||||
// We do this by setting the uniform's value to the color channel slot we earlier
|
||||
// bound our textures to.
|
||||
// We do this by setting the uniform's values to the texture units that
|
||||
// we later bind our g-buffer textures to.
|
||||
rlEnableShader(deferredShader.id);
|
||||
|
||||
rlSetUniformSampler(rlGetLocationUniform(deferredShader.id, "gPosition"), 0);
|
||||
rlSetUniformSampler(rlGetLocationUniform(deferredShader.id, "gNormal"), 1);
|
||||
rlSetUniformSampler(rlGetLocationUniform(deferredShader.id, "gAlbedoSpec"), 2);
|
||||
|
||||
int texUnitPosition = 0;
|
||||
int texUnitNormal = 1;
|
||||
int texUnitAlbedoSpec = 2;
|
||||
SetShaderValue(deferredShader, rlGetLocationUniform(deferredShader.id, "gPosition"), &texUnitPosition, RL_SHADER_UNIFORM_SAMPLER2D);
|
||||
SetShaderValue(deferredShader, rlGetLocationUniform(deferredShader.id, "gNormal"), &texUnitNormal, RL_SHADER_UNIFORM_SAMPLER2D);
|
||||
SetShaderValue(deferredShader, rlGetLocationUniform(deferredShader.id, "gAlbedoSpec"), &texUnitAlbedoSpec, RL_SHADER_UNIFORM_SAMPLER2D);
|
||||
rlDisableShader();
|
||||
|
||||
// Assign out lighting shader to model
|
||||
|
|
@ -208,11 +209,10 @@ int main(void)
|
|||
// Draw
|
||||
// ---------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(RAYWHITE);
|
||||
|
||||
|
||||
// Draw to the geometry buffer by first activating it
|
||||
rlEnableFramebuffer(gBuffer.framebuffer);
|
||||
rlClearColor(0, 0, 0, 0);
|
||||
rlClearScreenBuffers(); // Clear color and depth buffer
|
||||
|
||||
rlDisableColorBlend();
|
||||
|
|
@ -246,14 +246,14 @@ int main(void)
|
|||
BeginMode3D(camera);
|
||||
rlDisableColorBlend();
|
||||
rlEnableShader(deferredShader.id);
|
||||
// Activate our g-buffer textures
|
||||
// These will now be bound to the sampler2D uniforms `gPosition`, `gNormal`,
|
||||
// Bind our g-buffer textures
|
||||
// We are binding them to locations that we earlier set in sampler2D uniforms `gPosition`, `gNormal`,
|
||||
// and `gAlbedoSpec`
|
||||
rlActiveTextureSlot(0);
|
||||
rlActiveTextureSlot(texUnitPosition);
|
||||
rlEnableTexture(gBuffer.positionTexture);
|
||||
rlActiveTextureSlot(1);
|
||||
rlActiveTextureSlot(texUnitNormal);
|
||||
rlEnableTexture(gBuffer.normalTexture);
|
||||
rlActiveTextureSlot(2);
|
||||
rlActiveTextureSlot(texUnitAlbedoSpec);
|
||||
rlEnableTexture(gBuffer.albedoSpecTexture);
|
||||
|
||||
// Finally, we draw a fullscreen quad to our default framebuffer
|
||||
|
|
@ -269,8 +269,8 @@ int main(void)
|
|||
rlBlitFramebuffer(0, 0, screenWidth, screenHeight, 0, 0, screenWidth, screenHeight, 0x00000100); // GL_DEPTH_BUFFER_BIT
|
||||
rlDisableFramebuffer();
|
||||
|
||||
// Since our shader is now done and disabled, we can draw our lights in default
|
||||
// forward rendering
|
||||
// Since our shader is now done and disabled, we can draw spheres
|
||||
// that represent light positions in default forward rendering
|
||||
BeginMode3D(camera);
|
||||
rlEnableShader(rlGetShaderIdDefault());
|
||||
for(int i = 0; i < MAX_LIGHTS; i++)
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ int main(void)
|
|||
DrawGrid(10, 2.0f);
|
||||
|
||||
// Use a shader to handle the depth buffer issue with transparent textures
|
||||
// NOTE: more info at https://bedroomcoders.co.uk/raylib-billboards-advanced-use/
|
||||
// NOTE: more info at https://bedroomcoders.co.uk/posts/198
|
||||
BeginShaderMode(alphaDiscard);
|
||||
|
||||
// Draw the 3D text above the red cube
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2021-2024 Ramon Santamaria (@raysan5)
|
||||
Copyright (c) 2021-2025 Ramon Santamaria (@raysan5)
|
||||
|
||||
This software is provided "as-is", without any express or implied warranty. In no event
|
||||
will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Check `raylib_parser.c` for details about those structs.
|
|||
// //
|
||||
// more info and bugs-report: github.com/raysan5/raylib/parser //
|
||||
// //
|
||||
// Copyright (c) 2021-2024 Ramon Santamaria (@raysan5) //
|
||||
// Copyright (c) 2021-2025 Ramon Santamaria (@raysan5) //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
|||
|
|
@ -9675,10 +9675,10 @@
|
|||
{
|
||||
"name": "TextJoin",
|
||||
"description": "Join text strings with delimiter",
|
||||
"returnType": "const char *",
|
||||
"returnType": "char *",
|
||||
"params": [
|
||||
{
|
||||
"type": "const char **",
|
||||
"type": "char **",
|
||||
"name": "textList"
|
||||
},
|
||||
{
|
||||
|
|
@ -9694,7 +9694,7 @@
|
|||
{
|
||||
"name": "TextSplit",
|
||||
"description": "Split text into multiple strings",
|
||||
"returnType": "const char **",
|
||||
"returnType": "char **",
|
||||
"params": [
|
||||
{
|
||||
"type": "const char *",
|
||||
|
|
@ -9747,7 +9747,7 @@
|
|||
{
|
||||
"name": "TextToUpper",
|
||||
"description": "Get upper case version of provided string",
|
||||
"returnType": "const char *",
|
||||
"returnType": "char *",
|
||||
"params": [
|
||||
{
|
||||
"type": "const char *",
|
||||
|
|
@ -9758,7 +9758,7 @@
|
|||
{
|
||||
"name": "TextToLower",
|
||||
"description": "Get lower case version of provided string",
|
||||
"returnType": "const char *",
|
||||
"returnType": "char *",
|
||||
"params": [
|
||||
{
|
||||
"type": "const char *",
|
||||
|
|
@ -9769,7 +9769,7 @@
|
|||
{
|
||||
"name": "TextToPascal",
|
||||
"description": "Get Pascal case notation version of provided string",
|
||||
"returnType": "const char *",
|
||||
"returnType": "char *",
|
||||
"params": [
|
||||
{
|
||||
"type": "const char *",
|
||||
|
|
@ -9780,7 +9780,7 @@
|
|||
{
|
||||
"name": "TextToSnake",
|
||||
"description": "Get Snake case notation version of provided string",
|
||||
"returnType": "const char *",
|
||||
"returnType": "char *",
|
||||
"params": [
|
||||
{
|
||||
"type": "const char *",
|
||||
|
|
@ -9791,7 +9791,7 @@
|
|||
{
|
||||
"name": "TextToCamel",
|
||||
"description": "Get Camel case notation version of provided string",
|
||||
"returnType": "const char *",
|
||||
"returnType": "char *",
|
||||
"params": [
|
||||
{
|
||||
"type": "const char *",
|
||||
|
|
|
|||
|
|
@ -6891,9 +6891,9 @@ return {
|
|||
{
|
||||
name = "TextJoin",
|
||||
description = "Join text strings with delimiter",
|
||||
returnType = "const char *",
|
||||
returnType = "char *",
|
||||
params = {
|
||||
{type = "const char **", name = "textList"},
|
||||
{type = "char **", name = "textList"},
|
||||
{type = "int", name = "count"},
|
||||
{type = "const char *", name = "delimiter"}
|
||||
}
|
||||
|
|
@ -6901,7 +6901,7 @@ return {
|
|||
{
|
||||
name = "TextSplit",
|
||||
description = "Split text into multiple strings",
|
||||
returnType = "const char **",
|
||||
returnType = "char **",
|
||||
params = {
|
||||
{type = "const char *", name = "text"},
|
||||
{type = "char", name = "delimiter"},
|
||||
|
|
@ -6930,7 +6930,7 @@ return {
|
|||
{
|
||||
name = "TextToUpper",
|
||||
description = "Get upper case version of provided string",
|
||||
returnType = "const char *",
|
||||
returnType = "char *",
|
||||
params = {
|
||||
{type = "const char *", name = "text"}
|
||||
}
|
||||
|
|
@ -6938,7 +6938,7 @@ return {
|
|||
{
|
||||
name = "TextToLower",
|
||||
description = "Get lower case version of provided string",
|
||||
returnType = "const char *",
|
||||
returnType = "char *",
|
||||
params = {
|
||||
{type = "const char *", name = "text"}
|
||||
}
|
||||
|
|
@ -6946,7 +6946,7 @@ return {
|
|||
{
|
||||
name = "TextToPascal",
|
||||
description = "Get Pascal case notation version of provided string",
|
||||
returnType = "const char *",
|
||||
returnType = "char *",
|
||||
params = {
|
||||
{type = "const char *", name = "text"}
|
||||
}
|
||||
|
|
@ -6954,7 +6954,7 @@ return {
|
|||
{
|
||||
name = "TextToSnake",
|
||||
description = "Get Snake case notation version of provided string",
|
||||
returnType = "const char *",
|
||||
returnType = "char *",
|
||||
params = {
|
||||
{type = "const char *", name = "text"}
|
||||
}
|
||||
|
|
@ -6962,7 +6962,7 @@ return {
|
|||
{
|
||||
name = "TextToCamel",
|
||||
description = "Get Camel case notation version of provided string",
|
||||
returnType = "const char *",
|
||||
returnType = "char *",
|
||||
params = {
|
||||
{type = "const char *", name = "text"}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3704,14 +3704,14 @@ Function 429: TextInsert() (3 input parameters)
|
|||
Param[3]: position (type: int)
|
||||
Function 430: TextJoin() (3 input parameters)
|
||||
Name: TextJoin
|
||||
Return type: const char *
|
||||
Return type: char *
|
||||
Description: Join text strings with delimiter
|
||||
Param[1]: textList (type: const char **)
|
||||
Param[1]: textList (type: char **)
|
||||
Param[2]: count (type: int)
|
||||
Param[3]: delimiter (type: const char *)
|
||||
Function 431: TextSplit() (3 input parameters)
|
||||
Name: TextSplit
|
||||
Return type: const char **
|
||||
Return type: char **
|
||||
Description: Split text into multiple strings
|
||||
Param[1]: text (type: const char *)
|
||||
Param[2]: delimiter (type: char)
|
||||
|
|
@ -3731,27 +3731,27 @@ Function 433: TextFindIndex() (2 input parameters)
|
|||
Param[2]: find (type: const char *)
|
||||
Function 434: TextToUpper() (1 input parameters)
|
||||
Name: TextToUpper
|
||||
Return type: const char *
|
||||
Return type: char *
|
||||
Description: Get upper case version of provided string
|
||||
Param[1]: text (type: const char *)
|
||||
Function 435: TextToLower() (1 input parameters)
|
||||
Name: TextToLower
|
||||
Return type: const char *
|
||||
Return type: char *
|
||||
Description: Get lower case version of provided string
|
||||
Param[1]: text (type: const char *)
|
||||
Function 436: TextToPascal() (1 input parameters)
|
||||
Name: TextToPascal
|
||||
Return type: const char *
|
||||
Return type: char *
|
||||
Description: Get Pascal case notation version of provided string
|
||||
Param[1]: text (type: const char *)
|
||||
Function 437: TextToSnake() (1 input parameters)
|
||||
Name: TextToSnake
|
||||
Return type: const char *
|
||||
Return type: char *
|
||||
Description: Get Snake case notation version of provided string
|
||||
Param[1]: text (type: const char *)
|
||||
Function 438: TextToCamel() (1 input parameters)
|
||||
Name: TextToCamel
|
||||
Return type: const char *
|
||||
Return type: char *
|
||||
Description: Get Camel case notation version of provided string
|
||||
Param[1]: text (type: const char *)
|
||||
Function 439: TextToInteger() (1 input parameters)
|
||||
|
|
|
|||
|
|
@ -2453,12 +2453,12 @@
|
|||
<Param type="const char *" name="insert" desc="" />
|
||||
<Param type="int" name="position" desc="" />
|
||||
</Function>
|
||||
<Function name="TextJoin" retType="const char *" paramCount="3" desc="Join text strings with delimiter">
|
||||
<Param type="const char **" name="textList" desc="" />
|
||||
<Function name="TextJoin" retType="char *" paramCount="3" desc="Join text strings with delimiter">
|
||||
<Param type="char **" name="textList" desc="" />
|
||||
<Param type="int" name="count" desc="" />
|
||||
<Param type="const char *" name="delimiter" desc="" />
|
||||
</Function>
|
||||
<Function name="TextSplit" retType="const char **" paramCount="3" desc="Split text into multiple strings">
|
||||
<Function name="TextSplit" retType="char **" paramCount="3" desc="Split text into multiple strings">
|
||||
<Param type="const char *" name="text" desc="" />
|
||||
<Param type="char" name="delimiter" desc="" />
|
||||
<Param type="int *" name="count" desc="" />
|
||||
|
|
@ -2472,19 +2472,19 @@
|
|||
<Param type="const char *" name="text" desc="" />
|
||||
<Param type="const char *" name="find" desc="" />
|
||||
</Function>
|
||||
<Function name="TextToUpper" retType="const char *" paramCount="1" desc="Get upper case version of provided string">
|
||||
<Function name="TextToUpper" retType="char *" paramCount="1" desc="Get upper case version of provided string">
|
||||
<Param type="const char *" name="text" desc="" />
|
||||
</Function>
|
||||
<Function name="TextToLower" retType="const char *" paramCount="1" desc="Get lower case version of provided string">
|
||||
<Function name="TextToLower" retType="char *" paramCount="1" desc="Get lower case version of provided string">
|
||||
<Param type="const char *" name="text" desc="" />
|
||||
</Function>
|
||||
<Function name="TextToPascal" retType="const char *" paramCount="1" desc="Get Pascal case notation version of provided string">
|
||||
<Function name="TextToPascal" retType="char *" paramCount="1" desc="Get Pascal case notation version of provided string">
|
||||
<Param type="const char *" name="text" desc="" />
|
||||
</Function>
|
||||
<Function name="TextToSnake" retType="const char *" paramCount="1" desc="Get Snake case notation version of provided string">
|
||||
<Function name="TextToSnake" retType="char *" paramCount="1" desc="Get Snake case notation version of provided string">
|
||||
<Param type="const char *" name="text" desc="" />
|
||||
</Function>
|
||||
<Function name="TextToCamel" retType="const char *" paramCount="1" desc="Get Camel case notation version of provided string">
|
||||
<Function name="TextToCamel" retType="char *" paramCount="1" desc="Get Camel case notation version of provided string">
|
||||
<Param type="const char *" name="text" desc="" />
|
||||
</Function>
|
||||
<Function name="TextToInteger" retType="int" paramCount="1" desc="Get integer value from text">
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
raylib-parser is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||
BSD-like license that allows static linking with closed source software:
|
||||
|
||||
Copyright (c) 2021-2024 Ramon Santamaria (@raysan5)
|
||||
Copyright (c) 2021-2025 Ramon Santamaria (@raysan5)
|
||||
|
||||
**********************************************************************************************/
|
||||
|
||||
|
|
@ -1084,7 +1084,7 @@ static void ShowCommandLineInfo(void)
|
|||
printf("// //\n");
|
||||
printf("// more info and bugs-report: github.com/raysan5/raylib/parser //\n");
|
||||
printf("// //\n");
|
||||
printf("// Copyright (c) 2021-2024 Ramon Santamaria (@raysan5) //\n");
|
||||
printf("// Copyright (c) 2021-2025 Ramon Santamaria (@raysan5) //\n");
|
||||
printf("// //\n");
|
||||
printf("//////////////////////////////////////////////////////////////////////////////////\n\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -302,6 +302,76 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_android.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_desktop_glfw.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_desktop_rgfw.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_desktop_sdl.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_drm.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_template.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_web.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\raudio.c" />
|
||||
<ClCompile Include="..\..\..\src\rcore.c" />
|
||||
<ClCompile Include="..\..\..\src\rmodels.c" />
|
||||
|
|
|
|||
120
projects/VS2022/raylib/raylib.vcxproj.filters
Normal file
120
projects/VS2022/raylib/raylib.vcxproj.filters
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\src\raudio.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\rcore.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\rglfw.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\rmodels.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\rshapes.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\rtext.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\rtextures.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\utils.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_android.c">
|
||||
<Filter>Source Files\Platform Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_desktop_glfw.c">
|
||||
<Filter>Source Files\Platform Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_desktop_rgfw.c">
|
||||
<Filter>Source Files\Platform Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_desktop_sdl.c">
|
||||
<Filter>Source Files\Platform Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_drm.c">
|
||||
<Filter>Source Files\Platform Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_template.c">
|
||||
<Filter>Source Files\Platform Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\src\platforms\rcore_web.c">
|
||||
<Filter>Source Files\Platform Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\src\external\cgltf.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\external\glad.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\external\jar_mod.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\external\jar_xm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\external\miniaudio.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\raylib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\raymath.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\rcamera.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\rgestures.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\rlgl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\external\stb_image.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\external\stb_image_resize.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\external\stb_image_write.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\external\stb_rect_pack.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\external\stb_truetype.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\external\stb_vorbis.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\src\utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\..\src\raylib.dll.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{88e8d1f8-5c93-4f9e-a856-819a1f82a387}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{cba93591-3674-4384-9325-bc0ae2d72b9b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Platform Files">
|
||||
<UniqueIdentifier>{d18433d7-0e5c-40d7-a39d-e0f11f80d183}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
# Many thanks to Milan Nikolic (@gen2brain) for implementing Android platform pipeline.
|
||||
# Many thanks to Emanuele Petriglia for his contribution on GNU/Linux pipeline.
|
||||
#
|
||||
# Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
# Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
#
|
||||
# This software is provided "as-is", without any express or implied warranty. In no event
|
||||
# will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2018-2024 Ahmad Fatoum & Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2018-2025 Ahmad Fatoum & Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5) and contributors
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5) and contributors
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5) and contributors
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5) and contributors
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -223,11 +223,9 @@ void ToggleBorderlessWindowed(void)
|
|||
if (!wasOnFullscreen) CORE.Window.previousPosition = CORE.Window.position;
|
||||
CORE.Window.previousScreen = CORE.Window.screen;
|
||||
|
||||
// Set undecorated and topmost modes and flags
|
||||
// Set undecorated flag
|
||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_FALSE);
|
||||
CORE.Window.flags |= FLAG_WINDOW_UNDECORATED;
|
||||
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_TRUE);
|
||||
CORE.Window.flags |= FLAG_WINDOW_TOPMOST;
|
||||
|
||||
// Get monitor position and size
|
||||
int monitorPosX = 0;
|
||||
|
|
@ -247,9 +245,7 @@ void ToggleBorderlessWindowed(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
// Remove topmost and undecorated modes and flags
|
||||
glfwSetWindowAttrib(platform.handle, GLFW_FLOATING, GLFW_FALSE);
|
||||
CORE.Window.flags &= ~FLAG_WINDOW_TOPMOST;
|
||||
// Remove undecorated flag
|
||||
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE);
|
||||
CORE.Window.flags &= ~FLAG_WINDOW_UNDECORATED;
|
||||
|
||||
|
|
@ -1021,6 +1017,9 @@ void EnableCursor(void)
|
|||
// Disables cursor (lock cursor)
|
||||
void DisableCursor(void)
|
||||
{
|
||||
// Reset mouse position within the window area before disabling cursor
|
||||
SetMousePosition(CORE.Window.screen.width, CORE.Window.screen.height);
|
||||
|
||||
glfwSetInputMode(platform.handle, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
|
||||
// Set cursor position in the middle
|
||||
|
|
@ -1248,12 +1247,13 @@ void PollInputEvents(void)
|
|||
|
||||
CORE.Window.resizedLastFrame = false;
|
||||
|
||||
if (CORE.Window.eventWaiting) glfwWaitEvents(); // Wait for in input events before continue (drawing is paused)
|
||||
if ((CORE.Window.eventWaiting) || (IsWindowState(FLAG_WINDOW_MINIMIZED) && !IsWindowState(FLAG_WINDOW_ALWAYS_RUN)))
|
||||
{
|
||||
glfwWaitEvents(); // Wait for in input events before continue (drawing is paused)
|
||||
CORE.Time.previous = GetTime();
|
||||
}
|
||||
else glfwPollEvents(); // Poll input events: keyboard/mouse/window events (callbacks) -> Update keys state
|
||||
|
||||
// While window minimized, stop loop execution
|
||||
while (IsWindowState(FLAG_WINDOW_MINIMIZED) && !IsWindowState(FLAG_WINDOW_ALWAYS_RUN)) glfwWaitEvents();
|
||||
|
||||
CORE.Window.shouldClose = glfwWindowShouldClose(platform.handle);
|
||||
|
||||
// Reset close status for next frame
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5), Colleague Riley and contributors
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5), Colleague Riley and contributors
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5) and contributors
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5) and contributors
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -571,7 +571,7 @@ void SetWindowState(unsigned int flags)
|
|||
}
|
||||
if (flags & FLAG_WINDOW_ALWAYS_RUN)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "SetWindowState() - FLAG_WINDOW_ALWAYS_RUN is not supported on PLATFORM_DESKTOP_SDL");
|
||||
CORE.Window.flags |= FLAG_WINDOW_ALWAYS_RUN;
|
||||
}
|
||||
if (flags & FLAG_WINDOW_TRANSPARENT)
|
||||
{
|
||||
|
|
@ -658,7 +658,7 @@ void ClearWindowState(unsigned int flags)
|
|||
}
|
||||
if (flags & FLAG_WINDOW_ALWAYS_RUN)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "ClearWindowState() - FLAG_WINDOW_ALWAYS_RUN is not supported on PLATFORM_DESKTOP_SDL");
|
||||
CORE.Window.flags &= ~FLAG_WINDOW_ALWAYS_RUN;
|
||||
}
|
||||
if (flags & FLAG_WINDOW_TRANSPARENT)
|
||||
{
|
||||
|
|
@ -1378,6 +1378,12 @@ void PollInputEvents(void)
|
|||
|
||||
CORE.Window.resizedLastFrame = false;
|
||||
|
||||
if ((CORE.Window.eventWaiting) || (((CORE.Window.flags & FLAG_WINDOW_MINIMIZED) > 0) && ((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) == 0)))
|
||||
{
|
||||
SDL_WaitEvent(NULL);
|
||||
CORE.Time.previous = GetTime();
|
||||
}
|
||||
|
||||
SDL_Event event = { 0 };
|
||||
while (SDL_PollEvent(&event) != 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5) and contributors
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5) and contributors
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5) and contributors
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5) and contributors
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5) and contributors
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5) and contributors
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -133,6 +133,7 @@ static void CursorEnterCallback(GLFWwindow *window, int enter);
|
|||
static EM_BOOL EmscriptenFullscreenChangeCallback(int eventType, const EmscriptenFullscreenChangeEvent *event, void *userData);
|
||||
// static EM_BOOL EmscriptenWindowResizedCallback(int eventType, const EmscriptenUiEvent *event, void *userData);
|
||||
static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *event, void *userData);
|
||||
static EM_BOOL EmscriptenFocusCallback(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData);
|
||||
|
||||
// Emscripten input callback events
|
||||
static EM_BOOL EmscriptenMouseMoveCallback(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData);
|
||||
|
|
@ -1369,6 +1370,10 @@ int InitPlatform(void)
|
|||
// Support gamepad events (not provided by GLFW3 on emscripten)
|
||||
emscripten_set_gamepadconnected_callback(NULL, 1, EmscriptenGamepadCallback);
|
||||
emscripten_set_gamepaddisconnected_callback(NULL, 1, EmscriptenGamepadCallback);
|
||||
|
||||
// Support focus events
|
||||
emscripten_set_blur_callback("#canvas", platform.handle, 1, EmscriptenFocusCallback);
|
||||
emscripten_set_focus_callback("#canvas", platform.handle, 1, EmscriptenFocusCallback);
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// Initialize timing system
|
||||
|
|
@ -1732,6 +1737,18 @@ static EM_BOOL EmscriptenGamepadCallback(int eventType, const EmscriptenGamepadE
|
|||
return 1; // The event was consumed by the callback handler
|
||||
}
|
||||
|
||||
static EM_BOOL EmscriptenFocusCallback(int eventType, const EmscriptenFocusEvent *focusEvent, void *userData)
|
||||
{
|
||||
EM_BOOL consumed = 1;
|
||||
switch (eventType)
|
||||
{
|
||||
case EMSCRIPTEN_EVENT_BLUR: WindowFocusCallback(userData, 0); break;
|
||||
case EMSCRIPTEN_EVENT_FOCUS: WindowFocusCallback(userData, 1); break;
|
||||
default: consumed = 0; break;
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
// Register touch input events
|
||||
static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData)
|
||||
{
|
||||
|
|
@ -1795,7 +1812,23 @@ static EM_BOOL EmscriptenTouchCallback(int eventType, const EmscriptenTouchEvent
|
|||
|
||||
if (eventType == EMSCRIPTEN_EVENT_TOUCHEND)
|
||||
{
|
||||
CORE.Input.Touch.pointCount--;
|
||||
// Identify the EMSCRIPTEN_EVENT_TOUCHEND and remove it from the list
|
||||
for (int i = 0; i < CORE.Input.Touch.pointCount; i++)
|
||||
{
|
||||
if (touchEvent->touches[i].isChanged)
|
||||
{
|
||||
// Move all touch points one position up
|
||||
for (int j = i; j < CORE.Input.Touch.pointCount - 1; j++)
|
||||
{
|
||||
CORE.Input.Touch.pointId[j] = CORE.Input.Touch.pointId[j + 1];
|
||||
CORE.Input.Touch.position[j] = CORE.Input.Touch.position[j + 1];
|
||||
}
|
||||
// Decrease touch points count to remove the last one
|
||||
CORE.Input.Touch.pointCount--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Clamp pointCount to avoid negative values
|
||||
if (CORE.Input.Touch.pointCount < 0) CORE.Input.Touch.pointCount = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -1125,7 +1125,7 @@ bool ExportWaveAsCode(Wave wave, const char *fileName)
|
|||
byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// feedback and support: ray[at]raylib.com //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2018-2024 Ramon Santamaria (@raysan5) //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2018-2025 Ramon Santamaria (@raysan5) //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "//////////////////////////////////////////////////////////////////////////////////\n\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ BEGIN
|
|||
VALUE "FileDescription", "raylib dynamic library (www.raylib.com)"
|
||||
VALUE "FileVersion", "5.5.0"
|
||||
VALUE "InternalName", "raylib.dll"
|
||||
VALUE "LegalCopyright", "(c) 2024 Ramon Santamaria (@raysan5)"
|
||||
VALUE "LegalCopyright", "(c) 2025 Ramon Santamaria (@raysan5)"
|
||||
VALUE "OriginalFilename", "raylib.dll"
|
||||
VALUE "ProductName", "raylib"
|
||||
VALUE "ProductVersion", "5.5.0"
|
||||
|
|
|
|||
Binary file not shown.
16
src/raylib.h
16
src/raylib.h
|
|
@ -63,7 +63,7 @@
|
|||
* raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
|
||||
* BSD-like license that allows static linking with closed source software:
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -1510,15 +1510,15 @@ RLAPI const char *TextFormat(const char *text, ...);
|
|||
RLAPI const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
|
||||
RLAPI char *TextReplace(const char *text, const char *replace, const char *by); // Replace text string (WARNING: memory must be freed!)
|
||||
RLAPI char *TextInsert(const char *text, const char *insert, int position); // Insert text in a position (WARNING: memory must be freed!)
|
||||
RLAPI const char *TextJoin(const char **textList, int count, const char *delimiter); // Join text strings with delimiter
|
||||
RLAPI const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
|
||||
RLAPI char *TextJoin(char **textList, int count, const char *delimiter); // Join text strings with delimiter
|
||||
RLAPI char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
|
||||
RLAPI void TextAppend(char *text, const char *append, int *position); // Append text at specific position and move cursor!
|
||||
RLAPI int TextFindIndex(const char *text, const char *find); // Find first text occurrence within a string
|
||||
RLAPI const char *TextToUpper(const char *text); // Get upper case version of provided string
|
||||
RLAPI const char *TextToLower(const char *text); // Get lower case version of provided string
|
||||
RLAPI const char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
|
||||
RLAPI const char *TextToSnake(const char *text); // Get Snake case notation version of provided string
|
||||
RLAPI const char *TextToCamel(const char *text); // Get Camel case notation version of provided string
|
||||
RLAPI char *TextToUpper(const char *text); // Get upper case version of provided string
|
||||
RLAPI char *TextToLower(const char *text); // Get lower case version of provided string
|
||||
RLAPI char *TextToPascal(const char *text); // Get Pascal case notation version of provided string
|
||||
RLAPI char *TextToSnake(const char *text); // Get Snake case notation version of provided string
|
||||
RLAPI char *TextToCamel(const char *text); // Get Camel case notation version of provided string
|
||||
|
||||
RLAPI int TextToInteger(const char *text); // Get integer value from text
|
||||
RLAPI float TextToFloat(const char *text); // Get float value from text
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ BEGIN
|
|||
VALUE "FileDescription", "raylib application (www.raylib.com)"
|
||||
VALUE "FileVersion", "5.5.0"
|
||||
VALUE "InternalName", "raylib"
|
||||
VALUE "LegalCopyright", "(c) 2024 Ramon Santamaria (@raysan5)"
|
||||
VALUE "LegalCopyright", "(c) 2025 Ramon Santamaria (@raysan5)"
|
||||
VALUE "OriginalFilename", "raylib"
|
||||
VALUE "ProductName", "raylib app"
|
||||
VALUE "ProductVersion", "5.5.0"
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -32,7 +32,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2015-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2015-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2022-2024 Christoph Wagner (@Crydsch) & Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2022-2025 Christoph Wagner (@Crydsch) & Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
11
src/rcore.c
11
src/rcore.c
|
|
@ -70,7 +70,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5) and contributors
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5) and contributors
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -1326,9 +1326,10 @@ Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
|||
|
||||
shader.id = rlLoadShaderCode(vsCode, fsCode);
|
||||
|
||||
// After shader loading, we TRY to set default location names
|
||||
if (shader.id > 0)
|
||||
if (shader.id == rlGetShaderIdDefault()) shader.locs = rlGetShaderLocsDefault();
|
||||
else if (shader.id > 0)
|
||||
{
|
||||
// After custom shader loading, we TRY to set default location names
|
||||
// Default shader attribute locations have been binded before linking:
|
||||
// vertex position location = 0
|
||||
// vertex texcoord location = 1
|
||||
|
|
@ -1930,7 +1931,7 @@ bool IsFileExtension(const char *fileName, const char *ext)
|
|||
{
|
||||
#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_TEXT_MANIPULATION)
|
||||
int extCount = 0;
|
||||
const char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext
|
||||
char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext
|
||||
|
||||
char fileExtLower[MAX_FILE_EXTENSION_LENGTH + 1] = { 0 };
|
||||
strncpy(fileExtLower, TextToLower(fileExt), MAX_FILE_EXTENSION_LENGTH); // WARNING: Module required: rtext
|
||||
|
|
@ -2999,7 +3000,7 @@ bool ExportAutomationEventList(AutomationEventList list, const char *fileName)
|
|||
byteCount += sprintf(txtData + byteCount, "# more info and bugs-report: github.com/raysan5/raylib\n");
|
||||
byteCount += sprintf(txtData + byteCount, "# feedback and support: ray[at]raylib.com\n");
|
||||
byteCount += sprintf(txtData + byteCount, "#\n");
|
||||
byteCount += sprintf(txtData + byteCount, "# Copyright (c) 2023-2024 Ramon Santamaria (@raysan5)\n");
|
||||
byteCount += sprintf(txtData + byteCount, "# Copyright (c) 2023-2025 Ramon Santamaria (@raysan5)\n");
|
||||
byteCount += sprintf(txtData + byteCount, "#\n\n");
|
||||
|
||||
// Add events data
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2014-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2017-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2017-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
36
src/rlgl.h
36
src/rlgl.h
|
|
@ -10,7 +10,7 @@
|
|||
* When choosing an OpenGL backend different than OpenGL 1.1, some internal buffer are
|
||||
* initialized on rlglInit() to accumulate vertex data
|
||||
*
|
||||
* When an internal state change is required all the stored vertex data is renderer in batch,
|
||||
* When an internal state change is required all the stored vertex data is rendered in batch,
|
||||
* additionally, rlDrawRenderBatchActive() could be called to force flushing of the batch
|
||||
*
|
||||
* Some resources are also loaded for convenience, here the complete list:
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2014-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -3666,29 +3666,37 @@ void *rlReadTexturePixels(unsigned int id, int width, int height, int format)
|
|||
// Read screen pixel data (color buffer)
|
||||
unsigned char *rlReadScreenPixels(int width, int height)
|
||||
{
|
||||
unsigned char *screenData = (unsigned char *)RL_CALLOC(width*height*4, sizeof(unsigned char));
|
||||
unsigned char *imgData = (unsigned char *)RL_CALLOC(width*height*4, sizeof(unsigned char));
|
||||
|
||||
// NOTE 1: glReadPixels returns image flipped vertically -> (0,0) is the bottom left corner of the framebuffer
|
||||
// NOTE 2: We are getting alpha channel! Be careful, it can be transparent if not cleared properly!
|
||||
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, screenData);
|
||||
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, imgData);
|
||||
|
||||
// Flip image vertically!
|
||||
unsigned char *imgData = (unsigned char *)RL_MALLOC(width*height*4*sizeof(unsigned char));
|
||||
|
||||
for (int y = height - 1; y >= 0; y--)
|
||||
// NOTE: Alpha value has already been applied to RGB in framebuffer, we don't need it!
|
||||
for (int y = height - 1; y >= height / 2; y--)
|
||||
{
|
||||
for (int x = 0; x < (width*4); x++)
|
||||
for (int x = 0; x < (width*4); x += 4)
|
||||
{
|
||||
imgData[((height - 1) - y)*width*4 + x] = screenData[(y*width*4) + x]; // Flip line
|
||||
size_t s = ((height - 1) - y)*width*4 + x;
|
||||
size_t e = y*width*4 + x;
|
||||
|
||||
// Set alpha component value to 255 (no trasparent image retrieval)
|
||||
// NOTE: Alpha value has already been applied to RGB in framebuffer, we don't need it!
|
||||
if (((x + 1)%4) == 0) imgData[((height - 1) - y)*width*4 + x] = 255;
|
||||
unsigned char r = imgData[s];
|
||||
unsigned char g = imgData[s+1];
|
||||
unsigned char b = imgData[s+2];
|
||||
|
||||
imgData[s] = imgData[e];
|
||||
imgData[s+1] = imgData[e+1];
|
||||
imgData[s+2] = imgData[e+2];
|
||||
imgData[s+3] = 255; // Set alpha component value to 255 (no trasparent image retrieval)
|
||||
|
||||
imgData[e] = r;
|
||||
imgData[e+1] = g;
|
||||
imgData[e+2] = b;
|
||||
imgData[e+3] = 255; // Ditto
|
||||
}
|
||||
}
|
||||
|
||||
RL_FREE(screenData);
|
||||
|
||||
return imgData; // NOTE: image data should be freed
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -1960,7 +1960,7 @@ bool ExportMesh(Mesh mesh, const char *fileName)
|
|||
byteCount += sprintf(txtData + byteCount, "# // more info and bugs-report: github.com/raysan5/raylib //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "# // feedback and support: ray[at]raylib.com //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "# // //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "# // Copyright (c) 2018-2024 Ramon Santamaria (@raysan5) //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "# // Copyright (c) 2018-2025 Ramon Santamaria (@raysan5) //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "# // //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "# //////////////////////////////////////////////////////////////////////////////////\n\n");
|
||||
byteCount += sprintf(txtData + byteCount, "# Vertex Count: %i\n", mesh.vertexCount);
|
||||
|
|
@ -4570,12 +4570,14 @@ static Model LoadIQM(const char *fileName)
|
|||
if (memcmp(iqmHeader->magic, IQM_MAGIC, sizeof(IQM_MAGIC)) != 0)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "MODEL: [%s] IQM file is not a valid model", fileName);
|
||||
UnloadFileData(fileData);
|
||||
return model;
|
||||
}
|
||||
|
||||
if (iqmHeader->version != IQM_VERSION)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "MODEL: [%s] IQM file version not supported (%i)", fileName, iqmHeader->version);
|
||||
UnloadFileData(fileData);
|
||||
return model;
|
||||
}
|
||||
|
||||
|
|
@ -4891,12 +4893,14 @@ static ModelAnimation *LoadModelAnimationsIQM(const char *fileName, int *animCou
|
|||
if (memcmp(iqmHeader->magic, IQM_MAGIC, sizeof(IQM_MAGIC)) != 0)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "MODEL: [%s] IQM file is not a valid model", fileName);
|
||||
UnloadFileData(fileData);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (iqmHeader->version != IQM_VERSION)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "MODEL: [%s] IQM file version not supported (%i)", fileName, iqmHeader->version);
|
||||
UnloadFileData(fileData);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -807,22 +807,25 @@ void DrawRectangleGradientEx(Rectangle rec, Color topLeft, Color bottomLeft, Col
|
|||
// but it solves another issue: https://github.com/raysan5/raylib/issues/3884
|
||||
void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
|
||||
{
|
||||
Matrix mat = rlGetMatrixModelview();
|
||||
float zoomFactor = 0.5f/mat.m0;
|
||||
Matrix mat = rlGetMatrixTransform();
|
||||
float xOffset = 0.5f/mat.m0;
|
||||
float yOffset = 0.5f/mat.m5;
|
||||
|
||||
rlBegin(RL_LINES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
rlVertex2f((float)posX - zoomFactor, (float)posY);
|
||||
rlVertex2f((float)posX + (float)width + zoomFactor, (float)posY);
|
||||
rlVertex2f((float)posX + xOffset, (float)posY + yOffset);
|
||||
rlVertex2f((float)posX + (float)width - xOffset, (float)posY + yOffset);
|
||||
|
||||
rlVertex2f((float)posX + (float)width, (float)posY - zoomFactor);
|
||||
rlVertex2f((float)posX + (float)width, (float)posY + (float)height + zoomFactor);
|
||||
rlVertex2f((float)posX + (float)width - xOffset, (float)posY + yOffset);
|
||||
rlVertex2f((float)posX + (float)width - xOffset, (float)posY + (float)height - yOffset);
|
||||
|
||||
rlVertex2f((float)posX + (float)width + zoomFactor, (float)posY + (float)height);
|
||||
rlVertex2f((float)posX - zoomFactor, (float)posY + (float)height);
|
||||
rlVertex2f((float)posX + (float)width - xOffset, (float)posY + (float)height - yOffset);
|
||||
rlVertex2f((float)posX + xOffset, (float)posY + (float)height - yOffset);
|
||||
|
||||
rlVertex2f((float)posX, (float)posY + (float)height + zoomFactor);
|
||||
rlVertex2f((float)posX, (float)posY - zoomFactor);
|
||||
rlVertex2f((float)posX + xOffset, (float)posY + (float)height - yOffset);
|
||||
rlVertex2f((float)posX + xOffset, (float)posY + yOffset);
|
||||
rlEnd();
|
||||
|
||||
/*
|
||||
// Previous implementation, it has issues... but it does not require view matrix...
|
||||
#if defined(SUPPORT_QUADS_DRAW_MODE)
|
||||
|
|
@ -845,7 +848,7 @@ void DrawRectangleLines(int posX, int posY, int width, int height, Color color)
|
|||
rlVertex2f((float)posX + 1, (float)posY + (float)height);
|
||||
rlVertex2f((float)posX + 1, (float)posY + 1);
|
||||
rlEnd();
|
||||
//#endif
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
@ -1160,18 +1163,29 @@ void DrawRectangleRoundedLinesEx(Rectangle rec, float roundness, int segments, f
|
|||
P5 ================== P4
|
||||
*/
|
||||
const Vector2 point[16] = {
|
||||
{(float)rec.x + innerRadius, rec.y - lineThick}, {(float)(rec.x + rec.width) - innerRadius, rec.y - lineThick}, { rec.x + rec.width + lineThick, (float)rec.y + innerRadius }, // PO, P1, P2
|
||||
{rec.x + rec.width + lineThick, (float)(rec.y + rec.height) - innerRadius}, {(float)(rec.x + rec.width) - innerRadius, rec.y + rec.height + lineThick}, // P3, P4
|
||||
{(float)rec.x + innerRadius, rec.y + rec.height + lineThick}, { rec.x - lineThick, (float)(rec.y + rec.height) - innerRadius}, {rec.x - lineThick, (float)rec.y + innerRadius}, // P5, P6, P7
|
||||
{(float)rec.x + innerRadius, rec.y}, {(float)(rec.x + rec.width) - innerRadius, rec.y}, // P8, P9
|
||||
{ rec.x + rec.width, (float)rec.y + innerRadius }, {rec.x + rec.width, (float)(rec.y + rec.height) - innerRadius}, // P10, P11
|
||||
{(float)(rec.x + rec.width) - innerRadius, rec.y + rec.height}, {(float)rec.x + innerRadius, rec.y + rec.height}, // P12, P13
|
||||
{ rec.x, (float)(rec.y + rec.height) - innerRadius}, {rec.x, (float)rec.y + innerRadius} // P14, P15
|
||||
{(float)rec.x + innerRadius + 0.5f, rec.y - lineThick + 0.5f},
|
||||
{(float)(rec.x + rec.width) - innerRadius - 0.5f, rec.y - lineThick + 0.5f},
|
||||
{rec.x + rec.width + lineThick - 0.5f, (float)rec.y + innerRadius + 0.5f}, // PO, P1, P2
|
||||
{rec.x + rec.width + lineThick - 0.5f, (float)(rec.y + rec.height) - innerRadius - 0.5f},
|
||||
{(float)(rec.x + rec.width) - innerRadius - 0.5f, rec.y + rec.height + lineThick - 0.5f}, // P3, P4
|
||||
{(float)rec.x + innerRadius + 0.5f, rec.y + rec.height + lineThick - 0.5f},
|
||||
{rec.x - lineThick + 0.5f, (float)(rec.y + rec.height) - innerRadius - 0.5f},
|
||||
{rec.x - lineThick + 0.5f, (float)rec.y + innerRadius + 0.5f}, // P5, P6, P7
|
||||
{(float)rec.x + innerRadius + 0.5f, rec.y + 0.5f},
|
||||
{(float)(rec.x + rec.width) - innerRadius - 0.5f, rec.y + 0.5f}, // P8, P9
|
||||
{rec.x + rec.width - 0.5f, (float)rec.y + innerRadius + 0.5f},
|
||||
{rec.x + rec.width - 0.5f, (float)(rec.y + rec.height) - innerRadius - 0.5f}, // P10, P11
|
||||
{(float)(rec.x + rec.width) - innerRadius - 0.5f, rec.y + rec.height - 0.5f},
|
||||
{(float)rec.x + innerRadius + 0.5f, rec.y + rec.height - 0.5f}, // P12, P13
|
||||
{rec.x + 0.5f, (float)(rec.y + rec.height) - innerRadius - 0.5f},
|
||||
{rec.x + 0.5f, (float)rec.y + innerRadius + 0.5f} // P14, P15
|
||||
};
|
||||
|
||||
const Vector2 centers[4] = {
|
||||
{(float)rec.x + innerRadius, (float)rec.y + innerRadius}, {(float)(rec.x + rec.width) - innerRadius, (float)rec.y + innerRadius}, // P16, P17
|
||||
{(float)(rec.x + rec.width) - innerRadius, (float)(rec.y + rec.height) - innerRadius}, {(float)rec.x + innerRadius, (float)(rec.y + rec.height) - innerRadius} // P18, P19
|
||||
{(float)rec.x + innerRadius + 0.5f, (float)rec.y + innerRadius + 0.5f},
|
||||
{(float)(rec.x + rec.width) - innerRadius - 0.5f, (float)rec.y + innerRadius + 0.5f}, // P16, P17
|
||||
{(float)(rec.x + rec.width) - innerRadius - 0.5f, (float)(rec.y + rec.height) - innerRadius - 0.5f},
|
||||
{(float)rec.x + innerRadius + 0.5f, (float)(rec.y + rec.height) - innerRadius - 0.5f} // P18, P19
|
||||
};
|
||||
|
||||
const float angles[4] = { 180.0f, 270.0f, 0.0f, 90.0f };
|
||||
|
|
|
|||
24
src/rtext.c
24
src/rtext.c
|
|
@ -34,7 +34,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -247,8 +247,8 @@ extern void LoadFontDefault(void)
|
|||
// we must consider data as little-endian order (alpha + gray)
|
||||
((unsigned short *)imFont.data)[i + j] = 0xffff;
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
((unsigned char *)imFont.data)[(i + j)*sizeof(short)] = 0xFF;
|
||||
((unsigned char *)imFont.data)[(i + j)*sizeof(short) + 1] = 0x00;
|
||||
}
|
||||
|
|
@ -989,7 +989,7 @@ bool ExportFontAsCode(Font font, const char *fileName)
|
|||
byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// feedback and support: ray[at]raylib.com //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2018-2024 Ramon Santamaria (@raysan5) //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2018-2025 Ramon Santamaria (@raysan5) //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// ---------------------------------------------------------------------------------- //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
|
|
@ -1629,7 +1629,7 @@ char *TextInsert(const char *text, const char *insert, int position)
|
|||
|
||||
// Join text strings with delimiter
|
||||
// REQUIRES: memset(), memcpy()
|
||||
const char *TextJoin(const char **textList, int count, const char *delimiter)
|
||||
char *TextJoin(char **textList, int count, const char *delimiter)
|
||||
{
|
||||
static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
|
||||
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
||||
|
|
@ -1663,7 +1663,7 @@ const char *TextJoin(const char **textList, int count, const char *delimiter)
|
|||
|
||||
// Split string into multiple strings
|
||||
// REQUIRES: memset()
|
||||
const char **TextSplit(const char *text, char delimiter, int *count)
|
||||
char **TextSplit(const char *text, char delimiter, int *count)
|
||||
{
|
||||
// NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter)
|
||||
// inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated,
|
||||
|
|
@ -1671,7 +1671,7 @@ const char **TextSplit(const char *text, char delimiter, int *count)
|
|||
// 1. Maximum number of possible split strings is set by MAX_TEXTSPLIT_COUNT
|
||||
// 2. Maximum size of text to split is MAX_TEXT_BUFFER_LENGTH
|
||||
|
||||
static const char *result[MAX_TEXTSPLIT_COUNT] = { NULL };
|
||||
static char *result[MAX_TEXTSPLIT_COUNT] = { NULL };
|
||||
static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
|
||||
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
||||
|
||||
|
|
@ -1727,7 +1727,7 @@ int TextFindIndex(const char *text, const char *find)
|
|||
// Get upper case version of provided string
|
||||
// WARNING: Limited functionality, only basic characters set
|
||||
// TODO: Support UTF-8 diacritics to upper-case, check codepoints
|
||||
const char *TextToUpper(const char *text)
|
||||
char *TextToUpper(const char *text)
|
||||
{
|
||||
static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
|
||||
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
||||
|
|
@ -1746,7 +1746,7 @@ const char *TextToUpper(const char *text)
|
|||
|
||||
// Get lower case version of provided string
|
||||
// WARNING: Limited functionality, only basic characters set
|
||||
const char *TextToLower(const char *text)
|
||||
char *TextToLower(const char *text)
|
||||
{
|
||||
static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
|
||||
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
||||
|
|
@ -1765,7 +1765,7 @@ const char *TextToLower(const char *text)
|
|||
|
||||
// Get Pascal case notation version of provided string
|
||||
// WARNING: Limited functionality, only basic characters set
|
||||
const char *TextToPascal(const char *text)
|
||||
char *TextToPascal(const char *text)
|
||||
{
|
||||
static char buffer[MAX_TEXT_BUFFER_LENGTH] = { 0 };
|
||||
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
||||
|
|
@ -1793,7 +1793,7 @@ const char *TextToPascal(const char *text)
|
|||
|
||||
// Get snake case notation version of provided string
|
||||
// WARNING: Limited functionality, only basic characters set
|
||||
const char *TextToSnake(const char *text)
|
||||
char *TextToSnake(const char *text)
|
||||
{
|
||||
static char buffer[MAX_TEXT_BUFFER_LENGTH] = {0};
|
||||
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
||||
|
|
@ -1821,7 +1821,7 @@ const char *TextToSnake(const char *text)
|
|||
|
||||
// Get Camel case notation version of provided string
|
||||
// WARNING: Limited functionality, only basic characters set
|
||||
const char *TextToCamel(const char *text)
|
||||
char *TextToCamel(const char *text)
|
||||
{
|
||||
static char buffer[MAX_TEXT_BUFFER_LENGTH] = {0};
|
||||
memset(buffer, 0, MAX_TEXT_BUFFER_LENGTH);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -761,7 +761,7 @@ bool ExportImageAsCode(Image image, const char *fileName)
|
|||
byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// feedback and support: ray[at]raylib.com //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2018-2024 Ramon Santamaria (@raysan5) //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2018-2025 Ramon Santamaria (@raysan5) //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2014-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
@ -308,7 +308,7 @@ bool ExportDataAsCode(const unsigned char *data, int dataSize, const char *fileN
|
|||
byteCount += sprintf(txtData + byteCount, "// more info and bugs-report: github.com/raysan5/raylib //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// feedback and support: ray[at]raylib.com //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2022-2024 Ramon Santamaria (@raysan5) //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// Copyright (c) 2022-2025 Ramon Santamaria (@raysan5) //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "// //\n");
|
||||
byteCount += sprintf(txtData + byteCount, "////////////////////////////////////////////////////////////////////////////////////////\n\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* LICENSE: zlib/libpng
|
||||
*
|
||||
* Copyright (c) 2014-2024 Ramon Santamaria (@raysan5)
|
||||
* Copyright (c) 2014-2025 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* This software is provided "as-is", without any express or implied warranty. In no event
|
||||
* will the authors be held liable for any damages arising from the use of this software.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user