From 6719c3a1cd7c4cfd4f52d43857131e3c7f97cb4b Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 7 Apr 2021 09:39:41 +0200 Subject: [PATCH 1/6] REVIEWED: OpenGL 2.1 compilation --- src/rlgl.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/rlgl.h b/src/rlgl.h index 865476dd0..bc40ad010 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -118,6 +118,8 @@ #endif #endif +// OpenGL 2.1 uses most of OpenGL 3.3 Core functionality +// WARNING: Specific parts are checked with #if defines #if defined(GRAPHICS_API_OPENGL_21) #define GRAPHICS_API_OPENGL_33 #endif @@ -666,10 +668,6 @@ RLAPI void rlLoadDrawQuad(void); // Load and draw a quad #endif #endif -#if defined(GRAPHICS_API_OPENGL_21) - #define GRAPHICS_API_OPENGL_33 // OpenGL 2.1 uses mostly OpenGL 3.3 Core functionality -#endif - #if defined(GRAPHICS_API_OPENGL_33) #if defined(__APPLE__) #include // OpenGL 3 library for OSX @@ -1891,8 +1889,7 @@ int rlGetVersion(void) #else return OPENGL_21; #endif -#endif -#if defined(GRAPHICS_API_OPENGL_33) +#elif defined(GRAPHICS_API_OPENGL_33) return OPENGL_33; #endif #if defined(GRAPHICS_API_OPENGL_ES2) @@ -3689,8 +3686,7 @@ static void rlLoadShaderDefault(void) "attribute vec4 vertexColor; \n" "varying vec2 fragTexCoord; \n" "varying vec4 fragColor; \n" -#endif -#if defined(GRAPHICS_API_OPENGL_33) +#elif defined(GRAPHICS_API_OPENGL_33) "#version 330 \n" "in vec3 vertexPosition; \n" "in vec2 vertexTexCoord; \n" @@ -3718,8 +3714,7 @@ static void rlLoadShaderDefault(void) #if defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21) "varying vec2 fragTexCoord; \n" "varying vec4 fragColor; \n" -#endif -#if defined(GRAPHICS_API_OPENGL_33) +#elif defined(GRAPHICS_API_OPENGL_33) "#version 330 \n" "in vec2 fragTexCoord; \n" "in vec4 fragColor; \n" @@ -3732,8 +3727,7 @@ static void rlLoadShaderDefault(void) #if defined(GRAPHICS_API_OPENGL_ES2) || defined(GRAPHICS_API_OPENGL_21) " vec4 texelColor = texture2D(texture0, fragTexCoord); \n" // NOTE: texture2D() is deprecated on OpenGL 3.3 and ES 3.0 " gl_FragColor = texelColor*colDiffuse*fragColor; \n" -#endif -#if defined(GRAPHICS_API_OPENGL_33) +#elif defined(GRAPHICS_API_OPENGL_33) " vec4 texelColor = texture(texture0, fragTexCoord); \n" " finalColor = texelColor*colDiffuse*fragColor; \n" #endif From ed96bc64412e01392026230d817d6fb316cd4035 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 7 Apr 2021 12:24:43 +0200 Subject: [PATCH 2/6] Update core_vr_simulator.c --- examples/core/core_vr_simulator.c | 33 ++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c index 091b2fc90..2f69f7c15 100644 --- a/examples/core/core_vr_simulator.c +++ b/examples/core/core_vr_simulator.c @@ -2,7 +2,7 @@ * * raylib [core] example - VR Simulator (Oculus Rift CV1 parameters) * -* This example has been created using raylib 3.6-dev (www.raylib.com) +* This example has been created using raylib 3.7 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * * Copyright (c) 2017-2021 Ramon Santamaria (@raysan5) @@ -40,7 +40,8 @@ int main(void) .interpupillaryDistance = 0.07f, // IPD (distance between pupils) in meters // NOTE: CV1 uses a Fresnel-hybrid-asymmetric lenses with specific distortion compute shaders - // Following parameters are an approximation to distortion stereo rendering but results differ from actual device + // Following parameters are an approximation to distortion stereo rendering + // but results differ from actual device .lensDistortionValues[0] = 1.0f, // Lens distortion constant parameter 0 .lensDistortionValues[1] = 0.22f, // Lens distortion constant parameter 1 .lensDistortionValues[2] = 0.24f, // Lens distortion constant parameter 2 @@ -58,15 +59,23 @@ int main(void) Shader distortion = LoadShader(0, TextFormat("resources/distortion%i.fs", GLSL_VERSION)); // Update distortion shader with lens and distortion-scale parameters - SetShaderValue(distortion, GetShaderLocation(distortion, "leftLensCenter"), config.leftLensCenter, SHADER_UNIFORM_VEC2); - SetShaderValue(distortion, GetShaderLocation(distortion, "rightLensCenter"), config.rightLensCenter, SHADER_UNIFORM_VEC2); - SetShaderValue(distortion, GetShaderLocation(distortion, "leftScreenCenter"), config.leftScreenCenter, SHADER_UNIFORM_VEC2); - SetShaderValue(distortion, GetShaderLocation(distortion, "rightScreenCenter"), config.rightScreenCenter, SHADER_UNIFORM_VEC2); + SetShaderValue(distortion, GetShaderLocation(distortion, "leftLensCenter"), + config.leftLensCenter, SHADER_UNIFORM_VEC2); + SetShaderValue(distortion, GetShaderLocation(distortion, "rightLensCenter"), + config.rightLensCenter, SHADER_UNIFORM_VEC2); + SetShaderValue(distortion, GetShaderLocation(distortion, "leftScreenCenter"), + config.leftScreenCenter, SHADER_UNIFORM_VEC2); + SetShaderValue(distortion, GetShaderLocation(distortion, "rightScreenCenter"), + config.rightScreenCenter, SHADER_UNIFORM_VEC2); - SetShaderValue(distortion, GetShaderLocation(distortion, "scale"), config.scale, SHADER_UNIFORM_VEC2); - SetShaderValue(distortion, GetShaderLocation(distortion, "scaleIn"), config.scaleIn, SHADER_UNIFORM_VEC2); - SetShaderValue(distortion, GetShaderLocation(distortion, "deviceWarpParam"), device.lensDistortionValues, SHADER_UNIFORM_VEC4); - SetShaderValue(distortion, GetShaderLocation(distortion, "chromaAbParam"), device.chromaAbCorrection, SHADER_UNIFORM_VEC4); + SetShaderValue(distortion, GetShaderLocation(distortion, "scale"), + config.scale, SHADER_UNIFORM_VEC2); + SetShaderValue(distortion, GetShaderLocation(distortion, "scaleIn"), + config.scaleIn, SHADER_UNIFORM_VEC2); + SetShaderValue(distortion, GetShaderLocation(distortion, "deviceWarpParam"), + device.lensDistortionValues, SHADER_UNIFORM_VEC4); + SetShaderValue(distortion, GetShaderLocation(distortion, "chromaAbParam"), + device.chromaAbCorrection, SHADER_UNIFORM_VEC4); // Initialize framebuffer for stereo rendering // NOTE: Screen size should match HMD aspect ratio @@ -108,7 +117,6 @@ int main(void) DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED); DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON); - DrawGrid(40, 1.0f); EndMode3D(); @@ -116,7 +124,8 @@ int main(void) EndTextureMode(); BeginShaderMode(distortion); - DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE); + DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, + (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE); EndShaderMode(); DrawFPS(10, 10); From bdc5686e4cd8c38eab9185c998da2d8cd26ae048 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 7 Apr 2021 12:25:04 +0200 Subject: [PATCH 3/6] Update shaders_julia_set.c --- examples/shaders/shaders_julia_set.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/shaders/shaders_julia_set.c b/examples/shaders/shaders_julia_set.c index 68b5958aa..754513678 100644 --- a/examples/shaders/shaders_julia_set.c +++ b/examples/shaders/shaders_julia_set.c @@ -42,7 +42,7 @@ int main(void) const int screenWidth = 800; const int screenHeight = 450; - SetConfigFlags(FLAG_WINDOW_HIGHDPI); + //SetConfigFlags(FLAG_WINDOW_HIGHDPI); InitWindow(screenWidth, screenHeight, "raylib [shaders] example - julia sets"); // Load julia set shader @@ -165,7 +165,7 @@ int main(void) BeginShaderMode(shader); // WARNING: If FLAG_WINDOW_HIGHDPI is enabled, HighDPI monitor scaling should be considered // when rendering the RenderTexture2D to fit in the HighDPI scaled Window - DrawTextureEx(target.texture, (Vector2){ 0.0f, 0.0f }, 0.0f, GetWindowScaleDPI().x, WHITE); + DrawTextureEx(target.texture, (Vector2){ 0.0f, 0.0f }, 0.0f, 1.0f, WHITE); EndShaderMode(); if (showControls) From bafa13f207baa2ad8f75c71f57930aa02f67740c Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 7 Apr 2021 12:27:11 +0200 Subject: [PATCH 4/6] Update core_vr_simulator.c --- examples/core/core_vr_simulator.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c index 2f69f7c15..62ed88426 100644 --- a/examples/core/core_vr_simulator.c +++ b/examples/core/core_vr_simulator.c @@ -39,9 +39,8 @@ int main(void) .lensSeparationDistance = 0.07f, // Lens separation distance in meters .interpupillaryDistance = 0.07f, // IPD (distance between pupils) in meters - // NOTE: CV1 uses a Fresnel-hybrid-asymmetric lenses with specific distortion compute shaders - // Following parameters are an approximation to distortion stereo rendering - // but results differ from actual device + // NOTE: CV1 uses fresnel-hybrid-asymmetric lenses with specific compute shaders + // Following parameters are just an approximation to CV1 distortion stereo rendering .lensDistortionValues[0] = 1.0f, // Lens distortion constant parameter 0 .lensDistortionValues[1] = 0.22f, // Lens distortion constant parameter 1 .lensDistortionValues[2] = 0.24f, // Lens distortion constant parameter 2 @@ -85,9 +84,9 @@ int main(void) Camera camera = { 0 }; camera.position = (Vector3){ 5.0f, 2.0f, 5.0f }; // Camera position camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point - camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target) + camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector camera.fovy = 60.0f; // Camera field-of-view Y - camera.projection = CAMERA_PERSPECTIVE; // Camera type + camera.projection = CAMERA_PERSPECTIVE; // Camera type Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; From 45c964c1e610913c6ba92d7b0e69e577e4080fce Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 7 Apr 2021 12:30:45 +0200 Subject: [PATCH 5/6] Update core_vr_simulator.c --- examples/core/core_vr_simulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c index 62ed88426..b57e1f7fd 100644 --- a/examples/core/core_vr_simulator.c +++ b/examples/core/core_vr_simulator.c @@ -123,7 +123,7 @@ int main(void) EndTextureMode(); BeginShaderMode(distortion); - DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, + DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE); EndShaderMode(); From 15ee2806320e99ea55ddc3bf84703718f1bb7b46 Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 8 Apr 2021 00:06:41 +0200 Subject: [PATCH 6/6] Update CHANGELOG -WIP- --- CHANGELOG | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index ea02b3e17..5e2828a32 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,63 @@ changelog --------- -Current Release: raylib 3.5.0 (25 December 2020) +Current Release: raylib 3.7.0 (xx April 2021) + +------------------------------------------------------------------------- +Release: raylib 3.7 (xx April 2021) +------------------------------------------------------------------------- +KEY CHANGES: + - [core] REDESIGNED: VR simulator -> fbo/shader exposed to user + - [rlgl] REDESIGNED: More abstraction + - [rlgl] REVIEWED: Instancing and stereo rendering + - [utils] ADDED: File access callbacks system + - [*] RENAMED: enums values renamed for consistency + +Detailed changes: +[core] ADDED: LoadVrStereoConfig() +[core] ADDED: UnloadVrStereoConfig() +[core] ADDED: BeginVrStereoMode() +[core] ADDED: EndVrStereoMode() +[core] ADDED: GetCurrentMonitor() +[core] ADDED: SetGamepadMappings(), update SDL_GameControllerDB +[core] RENAMED: LoadShaderCode() to LoadShaderFromMemory() +[core] RENAMED: SetMatrixProjection() to rlSetMatrixProjection() +[core] RENAMED: SetMatrixModelview() to rlSetMatrixModelview() +[core] RENAMED: GetMatrixModelview() to rlGetMatrixModelview() +[core] RENAMED: GetMatrixProjection() to rlGetMatrixProjection() +[core] RENAMED: GetShaderDefault() to rlGetShaderDefault() +[core] RENAMED: GetTextureDefault() to rlGetTextureDefault() +[core] REMOVED: GetShapesTexture() +[core] REMOVED: GetShapesTextureRec() +[core] REMOVED: GetMouseCursor() +[core] REMOVED: SetTraceLogExit() +[core] REDESIGNED: GetFileExtension(), includes the .dot +[core] REDESIGNED: IsFileExtension(), includes the .dot +[shapes] REDESIGNED: void SetShapesTexture(Texture2D texture, Rectangle source); +[shapes] ADDED: DrawLineBezierQuad() +[shapes] REDESIGNED: DrawCircleSector(), to use float params +[shapes] REDESIGNED: DrawCircleSectorLines(), to use float params +[shapes] REDESIGNED: DrawRing(), to use float params +[shapes] REDESIGNED: DrawRingLines(), to use float params +[shapes] ADDED: CheckCollisionLines() +[textures] ADDED: DrawTexturePoly() +[text] REDESIGNED: DrawFPS() +[models] ADDED: UploadMesh() +[models] ADDED: DrawMesh() +[models] ADDED: DrawMeshInstanced() +[models] ADDED: UnloadModelAnimations() +[models] ADDED: GenMeshDefault() +[models] REMOVED: DrawGizmo() +[models] REMOVED: LoadMeshes() +[models] REMOVED: MeshNormalsSmooth() +[audio] ADDED: LoadMusicStreamFromMemory() +[auido] REVIEWED: jar_xm library +[utils] ADDED: SetLoadFileDataCallback() +[utils] ADDED: SetSaveFileDataCallback() +[utils] ADDED: SetLoadFileTextCallback() +[utils] ADDED: SetSaveFileTextCallback() +[examples] ADDED: +[*] renamed some functions parameters for consistency ------------------------------------------------------------------------- Release: raylib 3.5 - 7th Anniversary Edition (25 December 2020)