mirror of
https://github.com/raysan5/raylib.git
synced 2026-11-25 09:01:47 -05:00
Compare commits
2 Commits
5e63cf99a3
...
1026cb9645
| Author | SHA1 | Date | |
|---|---|---|---|
| 1026cb9645 | |||
| c9fca4c15a |
12
src/raudio.c
12
src/raudio.c
@ -810,6 +810,12 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
|
||||
{
|
||||
Wave wave = { 0 };
|
||||
|
||||
if (fileType == NULL)
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "WAVE: Missing file extension");
|
||||
return wave;
|
||||
}
|
||||
|
||||
if (false) { }
|
||||
#if SUPPORT_FILEFORMAT_WAV
|
||||
else if ((strcmp(fileType, ".wav") == 0) || (strcmp(fileType, ".WAV") == 0))
|
||||
@ -2781,7 +2787,7 @@ static bool IsFileExtension(const char *fileName, const char *ext)
|
||||
bool result = false;
|
||||
const char *fileExt;
|
||||
|
||||
if ((fileExt = strrchr(fileName, '.')) != NULL)
|
||||
if ((fileExt = GetFileExtension(fileName)) != NULL)
|
||||
{
|
||||
if (strcmp(fileExt, ext) == 0) result = true;
|
||||
}
|
||||
@ -2792,7 +2798,9 @@ static bool IsFileExtension(const char *fileName, const char *ext)
|
||||
// Get pointer to extension for a filename string (includes the dot: .png)
|
||||
static const char *GetFileExtension(const char *fileName)
|
||||
{
|
||||
const char *dot = strrchr(fileName, '.');
|
||||
// Only the file name part can contain the extension, not a directory name
|
||||
const char *name = GetFileName(fileName);
|
||||
const char *dot = strrchr(name, '.');
|
||||
|
||||
if (!dot || dot == fileName) return NULL;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**********************************************************************************************
|
||||
*
|
||||
* raymath v2.0 - Math functions to work with Vector2, Vector3, Vector4, Matrix and Quaternions
|
||||
* raymath v2.1 - Math functions to work with Vector2, Vector3, Vector4, Matrix and Quaternions
|
||||
*
|
||||
* CONVENTIONS:
|
||||
* - Matrix structure is defined as row-major (memory layout) but parameters naming AND all
|
||||
@ -9,6 +9,7 @@
|
||||
* It benefits some functions making them cache-friendly and also avoids matrix
|
||||
* transpositions sometimes required by OpenGL
|
||||
* Example: In memory order, row0 is [m0 m4 m8 m12] but in semantic math row0 is [m0 m1 m2 m3]
|
||||
* - All math is float only, no doubles usage
|
||||
* - Functions are always self-contained, no function use another raymath function inside,
|
||||
* required code is directly re-implemented inside
|
||||
* - Functions input parameters are always received by value (2 unavoidable exceptions)
|
||||
@ -1970,32 +1971,32 @@ RMAPI Matrix MatrixScale(float x, float y, float z)
|
||||
}
|
||||
|
||||
// Get perspective projection matrix
|
||||
RMAPI Matrix MatrixFrustum(double left, double right, double bottom, double top, double nearPlane, double farPlane)
|
||||
RMAPI Matrix MatrixFrustum(float left, float right, float bottom, float top, float nearPlane, float farPlane)
|
||||
{
|
||||
Matrix result = { 0 };
|
||||
|
||||
float rl = (float)(right - left);
|
||||
float tb = (float)(top - bottom);
|
||||
float fn = (float)(farPlane - nearPlane);
|
||||
float rl = right - left;
|
||||
float tb = top - bottom;
|
||||
float fn = farPlane - nearPlane;
|
||||
|
||||
result.m0 = ((float)nearPlane*2.0f)/rl;
|
||||
result.m0 = (nearPlane*2.0f)/rl;
|
||||
result.m1 = 0.0f;
|
||||
result.m2 = 0.0f;
|
||||
result.m3 = 0.0f;
|
||||
|
||||
result.m4 = 0.0f;
|
||||
result.m5 = ((float)nearPlane*2.0f)/tb;
|
||||
result.m5 = (nearPlane*2.0f)/tb;
|
||||
result.m6 = 0.0f;
|
||||
result.m7 = 0.0f;
|
||||
|
||||
result.m8 = ((float)right + (float)left)/rl;
|
||||
result.m9 = ((float)top + (float)bottom)/tb;
|
||||
result.m10 = -((float)farPlane + (float)nearPlane)/fn;
|
||||
result.m8 = (right + left)/rl;
|
||||
result.m9 = (top + bottom)/tb;
|
||||
result.m10 = -(farPlane + nearPlane)/fn;
|
||||
result.m11 = -1.0f;
|
||||
|
||||
result.m12 = 0.0f;
|
||||
result.m13 = 0.0f;
|
||||
result.m14 = -((float)farPlane*(float)nearPlane*2.0f)/fn;
|
||||
result.m14 = -(farPlane*nearPlane*2.0f)/fn;
|
||||
result.m15 = 0.0f;
|
||||
|
||||
return result;
|
||||
@ -2003,39 +2004,39 @@ RMAPI Matrix MatrixFrustum(double left, double right, double bottom, double top,
|
||||
|
||||
// Get perspective projection matrix
|
||||
// NOTE: Fovy angle must be provided in radians
|
||||
RMAPI Matrix MatrixPerspective(double fovY, double aspect, double nearPlane, double farPlane)
|
||||
RMAPI Matrix MatrixPerspective(float fovY, float aspect, float nearPlane, float farPlane)
|
||||
{
|
||||
Matrix result = { 0 };
|
||||
|
||||
double top = nearPlane*tan(fovY*0.5);
|
||||
double bottom = -top;
|
||||
double right = top*aspect;
|
||||
double left = -right;
|
||||
float top = nearPlane*tanf(fovY*0.5f);
|
||||
float bottom = -top;
|
||||
float right = top*aspect;
|
||||
float left = -right;
|
||||
|
||||
// MatrixFrustum(-right, right, -top, top, near, far);
|
||||
float rl = (float)(right - left);
|
||||
float tb = (float)(top - bottom);
|
||||
float fn = (float)(farPlane - nearPlane);
|
||||
float rl = right - left;
|
||||
float tb = top - bottom;
|
||||
float fn = farPlane - nearPlane;
|
||||
|
||||
result.m0 = ((float)nearPlane*2.0f)/rl;
|
||||
result.m5 = ((float)nearPlane*2.0f)/tb;
|
||||
result.m8 = ((float)right + (float)left)/rl;
|
||||
result.m9 = ((float)top + (float)bottom)/tb;
|
||||
result.m10 = -((float)farPlane + (float)nearPlane)/fn;
|
||||
result.m0 = (nearPlane*2.0f)/rl;
|
||||
result.m5 = (nearPlane*2.0f)/tb;
|
||||
result.m8 = (right + left)/rl;
|
||||
result.m9 = (top + bottom)/tb;
|
||||
result.m10 = -(farPlane + nearPlane)/fn;
|
||||
result.m11 = -1.0f;
|
||||
result.m14 = -((float)farPlane*(float)nearPlane*2.0f)/fn;
|
||||
result.m14 = -(farPlane*nearPlane*2.0f)/fn;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Get orthographic projection matrix
|
||||
RMAPI Matrix MatrixOrtho(double left, double right, double bottom, double top, double nearPlane, double farPlane)
|
||||
RMAPI Matrix MatrixOrtho(float left, float right, float bottom, float top, float nearPlane, float farPlane)
|
||||
{
|
||||
Matrix result = { 0 };
|
||||
|
||||
float rl = (float)(right - left);
|
||||
float tb = (float)(top - bottom);
|
||||
float fn = (float)(farPlane - nearPlane);
|
||||
float rl = right - left;
|
||||
float tb = top - bottom;
|
||||
float fn = farPlane - nearPlane;
|
||||
|
||||
result.m0 = 2.0f/rl;
|
||||
result.m1 = 0.0f;
|
||||
@ -2049,9 +2050,9 @@ RMAPI Matrix MatrixOrtho(double left, double right, double bottom, double top, d
|
||||
result.m9 = 0.0f;
|
||||
result.m10 = -2.0f/fn;
|
||||
result.m11 = 0.0f;
|
||||
result.m12 = -((float)left + (float)right)/rl;
|
||||
result.m13 = -((float)top + (float)bottom)/tb;
|
||||
result.m14 = -((float)farPlane + (float)nearPlane)/fn;
|
||||
result.m12 = -(left + right)/rl;
|
||||
result.m13 = -(top + bottom)/tb;
|
||||
result.m14 = -(farPlane + nearPlane)/fn;
|
||||
result.m15 = 1.0f;
|
||||
|
||||
return result;
|
||||
|
||||
@ -65,8 +65,8 @@
|
||||
#endif
|
||||
|
||||
#if defined(RCAMERA_STANDALONE)
|
||||
#define CAMERA_CULL_DISTANCE_NEAR 0.05
|
||||
#define CAMERA_CULL_DISTANCE_FAR 4000.0
|
||||
#define CAMERA_CULL_DISTANCE_NEAR 0.05f
|
||||
#define CAMERA_CULL_DISTANCE_FAR 4000.0f
|
||||
#else
|
||||
#define CAMERA_CULL_DISTANCE_NEAR RL_CULL_DISTANCE_NEAR
|
||||
#define CAMERA_CULL_DISTANCE_FAR RL_CULL_DISTANCE_FAR
|
||||
@ -430,8 +430,8 @@ Matrix GetCameraProjectionMatrix(Camera *camera, float aspect)
|
||||
}
|
||||
else if (camera->projection == CAMERA_ORTHOGRAPHIC)
|
||||
{
|
||||
double top = camera->fovy/2.0;
|
||||
double right = top*aspect;
|
||||
float top = camera->fovy/2.0f;
|
||||
float right = top*aspect;
|
||||
|
||||
return MatrixOrtho(-right, right, -top, top, CAMERA_CULL_DISTANCE_NEAR, CAMERA_CULL_DISTANCE_FAR);
|
||||
}
|
||||
|
||||
32
src/rcore.c
32
src/rcore.c
@ -957,16 +957,16 @@ void BeginMode3D(Camera camera)
|
||||
if (camera.projection == CAMERA_PERSPECTIVE)
|
||||
{
|
||||
// Setup perspective projection
|
||||
double top = rlGetCullDistanceNear()*tan(camera.fovy*0.5*DEG2RAD);
|
||||
double right = top*aspect;
|
||||
float top = rlGetCullDistanceNear()*tanf(camera.fovy*0.5f*DEG2RAD);
|
||||
float right = top*aspect;
|
||||
|
||||
rlFrustum(-right, right, -top, top, rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
}
|
||||
else if (camera.projection == CAMERA_ORTHOGRAPHIC)
|
||||
{
|
||||
// Setup orthographic projection
|
||||
double top = camera.fovy/2.0;
|
||||
double right = top*aspect;
|
||||
float top = camera.fovy/2.0f;
|
||||
float right = top*aspect;
|
||||
|
||||
rlOrtho(-right, right, -top,top, rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
}
|
||||
@ -1014,7 +1014,7 @@ void BeginTextureMode(RenderTexture2D target)
|
||||
|
||||
// Set orthographic projection to current framebuffer size
|
||||
// NOTE: Configured top-left corner as (0, 0)
|
||||
rlOrtho(0, target.texture.width, target.texture.height, 0, 0.0f, 1.0f);
|
||||
rlOrtho(0.0f, (float)target.texture.width, (float)target.texture.height, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
rlMatrixMode(RL_MODELVIEW); // Switch back to modelview matrix
|
||||
rlLoadIdentity(); // Reset current matrix (modelview)
|
||||
@ -1427,13 +1427,13 @@ Ray GetScreenToWorldRayEx(Vector2 position, Camera camera, int width, int height
|
||||
if (camera.projection == CAMERA_PERSPECTIVE)
|
||||
{
|
||||
// Calculate projection matrix from perspective
|
||||
matProj = MatrixPerspective(camera.fovy*DEG2RAD, ((double)width/(double)height), rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
matProj = MatrixPerspective(camera.fovy*DEG2RAD, (float)width/(float)height, rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
}
|
||||
else if (camera.projection == CAMERA_ORTHOGRAPHIC)
|
||||
{
|
||||
double aspect = (double)width/(double)height;
|
||||
double top = camera.fovy/2.0;
|
||||
double right = top*aspect;
|
||||
float aspect = (float)width/(float)height;
|
||||
float top = camera.fovy/2.0f;
|
||||
float right = top*aspect;
|
||||
|
||||
// Calculate projection matrix from orthographic
|
||||
matProj = MatrixOrtho(-right, right, -top, top, rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
@ -1514,13 +1514,13 @@ Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int heigh
|
||||
if (camera.projection == CAMERA_PERSPECTIVE)
|
||||
{
|
||||
// Calculate projection matrix from perspective
|
||||
matProj = MatrixPerspective(camera.fovy*DEG2RAD, ((double)width/(double)height), rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
matProj = MatrixPerspective(camera.fovy*DEG2RAD, (float)width/(float)height, rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
}
|
||||
else if (camera.projection == CAMERA_ORTHOGRAPHIC)
|
||||
{
|
||||
double aspect = (double)width/(double)height;
|
||||
double top = camera.fovy/2.0;
|
||||
double right = top*aspect;
|
||||
float aspect = (float)width/(float)height;
|
||||
float top = camera.fovy/2.0f;
|
||||
float right = top*aspect;
|
||||
|
||||
// Calculate projection matrix from orthographic
|
||||
matProj = MatrixOrtho(-right, right, -top, top, rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
@ -2499,7 +2499,9 @@ long GetFileModTime(const char *fileName)
|
||||
// WARNING: Getting the pointer to the input string extension position (not a string copy)
|
||||
const char *GetFileExtension(const char *fileName)
|
||||
{
|
||||
const char *dot = strrchr(fileName, '.');
|
||||
// Only the file name part can contain the extension, not a directory name
|
||||
const char *name = GetFileName(fileName);
|
||||
const char *dot = strrchr(name, '.');
|
||||
|
||||
if ((dot == NULL) || (dot == fileName)) return NULL;
|
||||
|
||||
@ -4339,7 +4341,7 @@ void SetupViewport(int width, int height)
|
||||
|
||||
// Set orthographic projection to current framebuffer size
|
||||
// NOTE: Configured top-left corner as (0, 0)
|
||||
rlOrtho(0, CORE.Window.render.width, CORE.Window.render.height, 0, 0.0f, 1.0f);
|
||||
rlOrtho(0.0f, (float)CORE.Window.render.width, (float)CORE.Window.render.height, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
rlMatrixMode(RL_MODELVIEW); // Switch back to modelview matrix
|
||||
rlLoadIdentity(); // Reset current matrix (modelview)
|
||||
|
||||
78
src/rlgl.h
78
src/rlgl.h
@ -46,15 +46,15 @@
|
||||
* rlgl capabilities could be customized defining some internal
|
||||
* values before library inclusion (default values listed):
|
||||
*
|
||||
* #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch elements limits
|
||||
* #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
|
||||
* #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
|
||||
* #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of texture units that can be activated on batch drawing (SetShaderValueTexture())
|
||||
* #define RL_DEFAULT_BATCH_BUFFER_ELEMENTS 8192 // Default internal render batch elements limits
|
||||
* #define RL_DEFAULT_BATCH_BUFFERS 1 // Default number of batch buffers (multi-buffering)
|
||||
* #define RL_DEFAULT_BATCH_DRAWCALLS 256 // Default number of batch draw calls (by state changes: mode, texture)
|
||||
* #define RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS 4 // Maximum number of texture units that can be activated on batch drawing (SetShaderValueTexture())
|
||||
*
|
||||
* #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack
|
||||
* #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported
|
||||
* #define RL_CULL_DISTANCE_NEAR 0.05 // Default projection matrix near cull distance
|
||||
* #define RL_CULL_DISTANCE_FAR 4000.0 // Default projection matrix far cull distance
|
||||
* #define RL_MAX_MATRIX_STACK_SIZE 32 // Maximum size of internal Matrix stack
|
||||
* #define RL_MAX_SHADER_LOCATIONS 32 // Maximum number of shader locations supported
|
||||
* #define RL_CULL_DISTANCE_NEAR 0.05f // Default projection matrix near cull distance
|
||||
* #define RL_CULL_DISTANCE_FAR 4000.0f // Default projection matrix far cull distance
|
||||
*
|
||||
* When loading a shader, the following vertex attributes and uniform location names are tried to be set automatically:
|
||||
* WARNING: Pre-defined names can not be changed, they are used by default shaders and all raylib examples shaders, they are just listed here for reference
|
||||
@ -235,10 +235,10 @@
|
||||
|
||||
// Projection matrix culling
|
||||
#ifndef RL_CULL_DISTANCE_NEAR
|
||||
#define RL_CULL_DISTANCE_NEAR 0.05 // Default near cull distance
|
||||
#define RL_CULL_DISTANCE_NEAR 0.05f // Default near cull distance
|
||||
#endif
|
||||
#ifndef RL_CULL_DISTANCE_FAR
|
||||
#define RL_CULL_DISTANCE_FAR 4000.0 // Default far cull distance
|
||||
#define RL_CULL_DISTANCE_FAR 4000.0f // Default far cull distance
|
||||
#endif
|
||||
|
||||
// Texture parameters (equivalent to OpenGL defines)
|
||||
@ -611,12 +611,12 @@ RLAPI void rlTranslatef(float x, float y, float z); // Multiply the current
|
||||
RLAPI void rlRotatef(float angle, float x, float y, float z); // Multiply the current matrix by a rotation matrix
|
||||
RLAPI void rlScalef(float x, float y, float z); // Multiply the current matrix by a scaling matrix
|
||||
RLAPI void rlMultMatrixf(const float *matf); // Multiply the current matrix by another matrix
|
||||
RLAPI void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar);
|
||||
RLAPI void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar);
|
||||
RLAPI void rlFrustum(float left, float right, float bottom, float top, float znear, float zfar);
|
||||
RLAPI void rlOrtho(float left, float right, float bottom, float top, float znear, float zfar);
|
||||
RLAPI void rlViewport(int x, int y, int width, int height); // Set the viewport area
|
||||
RLAPI void rlSetClipPlanes(double nearPlane, double farPlane); // Set clip planes distances
|
||||
RLAPI double rlGetCullDistanceNear(void); // Get cull plane distance near
|
||||
RLAPI double rlGetCullDistanceFar(void); // Get cull plane distance far
|
||||
RLAPI void rlSetClipPlanes(float nearPlane, float farPlane); // Set clip planes distances
|
||||
RLAPI float rlGetCullDistanceNear(void); // Get cull plane distance near
|
||||
RLAPI float rlGetCullDistanceFar(void); // Get cull plane distance far
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Functions Declaration - Vertex level operations
|
||||
@ -1111,8 +1111,8 @@ typedef struct rlglData {
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
static bool isGpuReady = false;
|
||||
static double rlCullDistanceNear = RL_CULL_DISTANCE_NEAR;
|
||||
static double rlCullDistanceFar = RL_CULL_DISTANCE_FAR;
|
||||
static float rlCullDistanceNear = RL_CULL_DISTANCE_NEAR;
|
||||
static float rlCullDistanceFar = RL_CULL_DISTANCE_FAR;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
static rlglData RLGL = { 0 };
|
||||
@ -1174,12 +1174,12 @@ void rlMatrixMode(int mode)
|
||||
}
|
||||
}
|
||||
|
||||
void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar)
|
||||
void rlFrustum(float left, float right, float bottom, float top, float znear, float zfar)
|
||||
{
|
||||
glFrustum(left, right, bottom, top, znear, zfar);
|
||||
}
|
||||
|
||||
void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar)
|
||||
void rlOrtho(float left, float right, float bottom, float top, float znear, float zfar)
|
||||
{
|
||||
glOrtho(left, right, bottom, top, znear, zfar);
|
||||
}
|
||||
@ -1332,47 +1332,47 @@ void rlMultMatrixf(const float *matf)
|
||||
}
|
||||
|
||||
// Multiply the current matrix by a perspective matrix generated by parameters
|
||||
void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar)
|
||||
void rlFrustum(float left, float right, float bottom, float top, float znear, float zfar)
|
||||
{
|
||||
Matrix matFrustum = { 0 };
|
||||
|
||||
float rl = (float)(right - left);
|
||||
float tb = (float)(top - bottom);
|
||||
float fn = (float)(zfar - znear);
|
||||
float rl = right - left;
|
||||
float tb = top - bottom;
|
||||
float fn = zfar - znear;
|
||||
|
||||
matFrustum.m0 = ((float) znear*2.0f)/rl;
|
||||
matFrustum.m0 = (znear*2.0f)/rl;
|
||||
matFrustum.m1 = 0.0f;
|
||||
matFrustum.m2 = 0.0f;
|
||||
matFrustum.m3 = 0.0f;
|
||||
|
||||
matFrustum.m4 = 0.0f;
|
||||
matFrustum.m5 = ((float) znear*2.0f)/tb;
|
||||
matFrustum.m5 = (znear*2.0f)/tb;
|
||||
matFrustum.m6 = 0.0f;
|
||||
matFrustum.m7 = 0.0f;
|
||||
|
||||
matFrustum.m8 = ((float)right + (float)left)/rl;
|
||||
matFrustum.m9 = ((float)top + (float)bottom)/tb;
|
||||
matFrustum.m10 = -((float)zfar + (float)znear)/fn;
|
||||
matFrustum.m8 = (right + left)/rl;
|
||||
matFrustum.m9 = (top + bottom)/tb;
|
||||
matFrustum.m10 = -(zfar + znear)/fn;
|
||||
matFrustum.m11 = -1.0f;
|
||||
|
||||
matFrustum.m12 = 0.0f;
|
||||
matFrustum.m13 = 0.0f;
|
||||
matFrustum.m14 = -((float)zfar*(float)znear*2.0f)/fn;
|
||||
matFrustum.m14 = -(zfar*znear*2.0f)/fn;
|
||||
matFrustum.m15 = 0.0f;
|
||||
|
||||
*RLGL.State.currentMatrix = rlMatrixMultiply(*RLGL.State.currentMatrix, matFrustum);
|
||||
}
|
||||
|
||||
// Multiply the current matrix by an orthographic matrix generated by parameters
|
||||
void rlOrtho(double left, double right, double bottom, double top, double znear, double zfar)
|
||||
void rlOrtho(float left, float right, float bottom, float top, float znear, float zfar)
|
||||
{
|
||||
// NOTE: If left-right and top-botton values are equal it could create a division by zero,
|
||||
// response to it is platform/compiler dependent
|
||||
Matrix matOrtho = { 0 };
|
||||
|
||||
float rl = (float)(right - left);
|
||||
float tb = (float)(top - bottom);
|
||||
float fn = (float)(zfar - znear);
|
||||
float rl = right - left;
|
||||
float tb = top - bottom;
|
||||
float fn = zfar - znear;
|
||||
|
||||
matOrtho.m0 = 2.0f/rl;
|
||||
matOrtho.m1 = 0.0f;
|
||||
@ -1386,9 +1386,9 @@ void rlOrtho(double left, double right, double bottom, double top, double znear,
|
||||
matOrtho.m9 = 0.0f;
|
||||
matOrtho.m10 = -2.0f/fn;
|
||||
matOrtho.m11 = 0.0f;
|
||||
matOrtho.m12 = -((float)left + (float)right)/rl;
|
||||
matOrtho.m13 = -((float)top + (float)bottom)/tb;
|
||||
matOrtho.m14 = -((float)zfar + (float)znear)/fn;
|
||||
matOrtho.m12 = -(left + right)/rl;
|
||||
matOrtho.m13 = -(top + bottom)/tb;
|
||||
matOrtho.m14 = -(zfar + znear)/fn;
|
||||
matOrtho.m15 = 1.0f;
|
||||
|
||||
*RLGL.State.currentMatrix = rlMatrixMultiply(*RLGL.State.currentMatrix, matOrtho);
|
||||
@ -1402,20 +1402,20 @@ void rlViewport(int x, int y, int width, int height)
|
||||
}
|
||||
|
||||
// Set clip planes distances
|
||||
void rlSetClipPlanes(double nearPlane, double farPlane)
|
||||
void rlSetClipPlanes(float nearPlane, float farPlane)
|
||||
{
|
||||
rlCullDistanceNear = nearPlane;
|
||||
rlCullDistanceFar = farPlane;
|
||||
}
|
||||
|
||||
// Get cull plane distance near
|
||||
double rlGetCullDistanceNear(void)
|
||||
float rlGetCullDistanceNear(void)
|
||||
{
|
||||
return rlCullDistanceNear;
|
||||
}
|
||||
|
||||
// Get cull plane distance far
|
||||
double rlGetCullDistanceFar(void)
|
||||
float rlGetCullDistanceFar(void)
|
||||
{
|
||||
return rlCullDistanceFar;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user