Merge pull request #1 from raysan5/master

update base
This commit is contained in:
Crydsch 2021-04-08 20:35:23 +02:00 committed by GitHub
commit a5384b1b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 30 deletions

View File

@ -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)

View File

@ -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)
@ -39,8 +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
@ -58,15 +58,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
@ -76,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 };
@ -108,7 +116,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 +123,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);

View File

@ -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)

View File

@ -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/gl3.h> // 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