mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-21 10:48:15 +00:00
Review libc dependencies and remove when possible
Just for clarification, no plans to remove libc dependency, just did some code analysis to see how much raylib depend on stardard C library. My conclusions: - stdlib.h: primary dependency is for malloc() and free() - stdio.h: primary dependency is for FILE access, maybe it could go through a custom ABI? - string.h: just around 8 functions required - math.h: just around 8 functions required - others: 1-2 functions required for some other headers
This commit is contained in:
16
src/rlgl.h
16
src/rlgl.h
@@ -621,10 +621,10 @@ RLAPI int GetPixelDataSize(int width, int height, int format);// Get pixel data
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h> // Required for: fopen(), fclose(), fread()... [Used only on LoadText()]
|
||||
#include <stdlib.h> // Required for: malloc(), free(), rand()
|
||||
#include <string.h> // Required for: strcmp(), strlen(), strtok() [Used only in extensions loading]
|
||||
#include <math.h> // Required for: atan2()
|
||||
#include <stdlib.h> // Required for: malloc(), free()
|
||||
#include <stdio.h> // Required for: fopen(), fseek(), fread(), fclose() [LoadText]
|
||||
#include <string.h> // Required for: strcmp(), strlen() [Used in rlglInit(), on extensions loading]
|
||||
#include <math.h> // Required for: atan2f()
|
||||
|
||||
#if !defined(RLGL_STANDALONE)
|
||||
#include "raymath.h" // Required for: Vector3 and Matrix functions
|
||||
@@ -677,7 +677,7 @@ RLAPI int GetPixelDataSize(int width, int height, int format);// Get pixel data
|
||||
#endif
|
||||
|
||||
#if defined(RLGL_STANDALONE)
|
||||
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end() [Used only on TRACELOG()]
|
||||
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end() [Used in TraceLog()]
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -3683,10 +3683,10 @@ void SetVrConfiguration(VrDeviceInfo hmd, Shader distortion)
|
||||
TRACELOGD("VR: Distortion Shader: Scale = { %f, %f }", scale[0], scale[1]);
|
||||
TRACELOGD("VR: Distortion Shader: ScaleIn = { %f, %f }", scaleIn[0], scaleIn[1]);
|
||||
|
||||
// Fovy is normally computed with: 2*atan2(hmd.vScreenSize, 2*hmd.eyeToScreenDistance)
|
||||
// Fovy is normally computed with: 2*atan2f(hmd.vScreenSize, 2*hmd.eyeToScreenDistance)
|
||||
// ...but with lens distortion it is increased (see Oculus SDK Documentation)
|
||||
//float fovy = 2.0f*atan2(hmd.vScreenSize*0.5f*distortionScale, hmd.eyeToScreenDistance); // Really need distortionScale?
|
||||
float fovy = 2.0f*(float)atan2(hmd.vScreenSize*0.5f, hmd.eyeToScreenDistance);
|
||||
//float fovy = 2.0f*atan2f(hmd.vScreenSize*0.5f*distortionScale, hmd.eyeToScreenDistance); // Really need distortionScale?
|
||||
float fovy = 2.0f*(float)atan2f(hmd.vScreenSize*0.5f, hmd.eyeToScreenDistance);
|
||||
|
||||
// Compute camera projection matrices
|
||||
float projOffset = 4.0f*lensShift; // Scaled to projection space coordinates [-1..1]
|
||||
|
Reference in New Issue
Block a user