fix minor bugs and errors (x86) for the RGFW platform, update RGFW platform license, update makefile info for RGFW platform
This commit is contained in:
parent
d80febde7d
commit
65e06cf721
|
|
@ -13,6 +13,11 @@
|
|||
# - Windows (Win32, Win64)
|
||||
# - Linux (X11/Wayland desktop mode)
|
||||
# - Others (not tested)
|
||||
# > PLATFORM_DESKTOP_RGFW (RGFW backend):
|
||||
# - Windows (Win32, Win64)
|
||||
# - Linux (X11 desktop mode)
|
||||
# - macOS/OSX (x64, arm64 (not tested))
|
||||
# - Others (not tested)
|
||||
# > PLATFORM_WEB:
|
||||
# - HTML5 (WebAssembly)
|
||||
# > PLATFORM_DRM:
|
||||
|
|
@ -45,7 +50,7 @@
|
|||
# Define required environment variables
|
||||
#------------------------------------------------------------------------------------------------
|
||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DESKTOP_SDL, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
PLATFORM ?= PLATFORM_DESKTOP
|
||||
PLATFORM ?= PLATFORM_DESKTOP_RGFW
|
||||
|
||||
# Define required raylib variables
|
||||
PROJECT_NAME ?= raylib_examples
|
||||
|
|
@ -86,7 +91,7 @@ BUILD_WEB_RESOURCES ?= TRUE
|
|||
BUILD_WEB_RESOURCES_PATH ?= $(dir $<)resources@resources
|
||||
|
||||
# Determine PLATFORM_OS when required
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB))
|
||||
ifeq ($(PLATFORM),$(filter $(PLATFORM),PLATFORM_DESKTOP PLATFORM_DESKTOP_SDL PLATFORM_WEB PLATFORM_DESKTOP_RGFW))
|
||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
||||
# ifeq ($(UNAME),Msys) -> Windows
|
||||
ifeq ($(OS),Windows_NT)
|
||||
|
|
@ -416,6 +421,31 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
|
|||
LDLIBS += -latomic
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||
# Libraries for Windows desktop compilation
|
||||
LDLIBS = ..\src\libraylib.a -lgdi32 -lwinmm -lopengl32
|
||||
endif
|
||||
ifeq ($(PLATFORM_OS),LINUX)
|
||||
# Libraries for Debian GNU/Linux desktop compipling
|
||||
# NOTE: Required packages: libegl1-mesa-dev
|
||||
LDLIBS = ../src/libraylib.a -lGL -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -lm -lpthread -ldl -lrt
|
||||
|
||||
# Explicit link to libc
|
||||
ifeq ($(RAYLIB_LIBTYPE),SHARED)
|
||||
LDLIBS += -lc
|
||||
endif
|
||||
|
||||
# NOTE: On ARM 32bit arch, miniaudio requires atomics library
|
||||
LDLIBS += -latomic
|
||||
endif
|
||||
ifeq ($(PLATFORM_OS),OSX)
|
||||
# Libraries for Debian GNU/Linux desktop compiling
|
||||
# NOTE: Required packages: libegl1-mesa-dev
|
||||
LDLIBS = ../src/libraylib.a -lm
|
||||
LDLIBS += -framework Foundation -framework AppKit -framework OpenGL -framework CoreVideo
|
||||
endif
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DRM)
|
||||
# Libraries for DRM compiling
|
||||
# NOTE: Required packages: libasound2-dev (ALSA)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ int main(void)
|
|||
|
||||
int targetFPS = 60; // Our initial target fps
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ static TextureCubemap GenTextureCubemap(Shader shader, Texture2D panorama, int s
|
|||
rlEnableShader(shader.id);
|
||||
|
||||
// Define projection matrix and send it to shader
|
||||
Matrix matFboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
|
||||
Matrix matFboProjection = MatrixPerspective(90.0*DEG2RAD, 1.0, rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
rlSetUniformMatrix(shader.locs[SHADER_LOC_MATRIX_PROJECTION], matFboProjection);
|
||||
|
||||
// Define view matrix for every side of the cubemap
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ int main(void)
|
|||
// Set bilinear scale filter for better font scaling
|
||||
SetTextureFilter(font.texture, TEXTURE_FILTER_BILINEAR);
|
||||
|
||||
SetTextLineSpacing(54); // Set line spacing for multiline text (when line breaks are included '\n')
|
||||
SetTextLineSpacing(20); // Set line spacing for multiline text (when line breaks are included '\n')
|
||||
|
||||
// Free codepoints, atlas has already been generated
|
||||
free(codepointsNoDups);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ int main(void)
|
|||
// NOTE: We define a font base size of 32 pixels tall and up-to 250 characters
|
||||
Font fontTtf = LoadFontEx("resources/pixantiqua.ttf", 32, 0, 250);
|
||||
|
||||
SetTextLineSpacing(48); // Set line spacing for multiline text (when line breaks are included '\n')
|
||||
SetTextLineSpacing(16); // Set line spacing for multiline text (when line breaks are included '\n')
|
||||
|
||||
bool useTtf = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -2957,27 +2957,27 @@
|
|||
{
|
||||
"name": "CAMERA_CUSTOM",
|
||||
"value": 0,
|
||||
"description": "Custom camera"
|
||||
"description": "Camera custom, controlled by user (UpdateCamera() does nothing)"
|
||||
},
|
||||
{
|
||||
"name": "CAMERA_FREE",
|
||||
"value": 1,
|
||||
"description": "Free camera"
|
||||
"description": "Camera free mode"
|
||||
},
|
||||
{
|
||||
"name": "CAMERA_ORBITAL",
|
||||
"value": 2,
|
||||
"description": "Orbital camera"
|
||||
"description": "Camera orbital, around target, zoom supported"
|
||||
},
|
||||
{
|
||||
"name": "CAMERA_FIRST_PERSON",
|
||||
"value": 3,
|
||||
"description": "First person camera"
|
||||
"description": "Camera first person"
|
||||
},
|
||||
{
|
||||
"name": "CAMERA_THIRD_PERSON",
|
||||
"value": 4,
|
||||
"description": "Third person camera"
|
||||
"description": "Camera third person"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2957,27 +2957,27 @@ return {
|
|||
{
|
||||
name = "CAMERA_CUSTOM",
|
||||
value = 0,
|
||||
description = "Custom camera"
|
||||
description = "Camera custom, controlled by user (UpdateCamera() does nothing)"
|
||||
},
|
||||
{
|
||||
name = "CAMERA_FREE",
|
||||
value = 1,
|
||||
description = "Free camera"
|
||||
description = "Camera free mode"
|
||||
},
|
||||
{
|
||||
name = "CAMERA_ORBITAL",
|
||||
value = 2,
|
||||
description = "Orbital camera"
|
||||
description = "Camera orbital, around target, zoom supported"
|
||||
},
|
||||
{
|
||||
name = "CAMERA_FIRST_PERSON",
|
||||
value = 3,
|
||||
description = "First person camera"
|
||||
description = "Camera first person"
|
||||
},
|
||||
{
|
||||
name = "CAMERA_THIRD_PERSON",
|
||||
value = 4,
|
||||
description = "Third person camera"
|
||||
description = "Camera third person"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -627,11 +627,11 @@
|
|||
<Value name="GESTURE_PINCH_OUT" integer="512" desc="Pinch out gesture" />
|
||||
</Enum>
|
||||
<Enum name="CameraMode" valueCount="5" desc="Camera system modes">
|
||||
<Value name="CAMERA_CUSTOM" integer="0" desc="Custom camera" />
|
||||
<Value name="CAMERA_FREE" integer="1" desc="Free camera" />
|
||||
<Value name="CAMERA_ORBITAL" integer="2" desc="Orbital camera" />
|
||||
<Value name="CAMERA_FIRST_PERSON" integer="3" desc="First person camera" />
|
||||
<Value name="CAMERA_THIRD_PERSON" integer="4" desc="Third person camera" />
|
||||
<Value name="CAMERA_CUSTOM" integer="0" desc="Camera custom, controlled by user (UpdateCamera() does nothing)" />
|
||||
<Value name="CAMERA_FREE" integer="1" desc="Camera free mode" />
|
||||
<Value name="CAMERA_ORBITAL" integer="2" desc="Camera orbital, around target, zoom supported" />
|
||||
<Value name="CAMERA_FIRST_PERSON" integer="3" desc="Camera first person" />
|
||||
<Value name="CAMERA_THIRD_PERSON" integer="4" desc="Camera third person" />
|
||||
</Enum>
|
||||
<Enum name="CameraProjection" valueCount="2" desc="Camera projection">
|
||||
<Value name="CAMERA_PERSPECTIVE" integer="0" desc="Perspective projection" />
|
||||
|
|
|
|||
18
src/Makefile
18
src/Makefile
|
|
@ -13,6 +13,11 @@
|
|||
# - Windows (Win32, Win64)
|
||||
# - Linux (X11/Wayland desktop mode)
|
||||
# - Others (not tested)
|
||||
# > PLATFORM_DESKTOP_RGFW (RGFW backend):
|
||||
# - Windows (Win32, Win64)
|
||||
# - Linux (X11 desktop mode)
|
||||
# - macOS/OSX (x64, arm64 (not tested))
|
||||
# - Others (not tested)
|
||||
# > PLATFORM_WEB:
|
||||
# - HTML5 (WebAssembly)
|
||||
# > PLATFORM_DRM:
|
||||
|
|
@ -51,7 +56,7 @@
|
|||
# Define required environment variables
|
||||
#------------------------------------------------------------------------------------------------
|
||||
# Define target platform: PLATFORM_DESKTOP, PLATFORM_DRM, PLATFORM_ANDROID, PLATFORM_WEB
|
||||
PLATFORM ?= PLATFORM_DESKTOP
|
||||
PLATFORM ?= PLATFORM_DESKTOP_RGFW
|
||||
|
||||
# Define required raylib variables
|
||||
RAYLIB_VERSION = 5.0.0
|
||||
|
|
@ -224,6 +229,14 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_RGFW)
|
||||
# By default use OpenGL 3.3 on desktop platforms
|
||||
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_43 # Uncomment to use OpenGL 4.3
|
||||
#GRAPHICS = GRAPHICS_API_OPENGL_ES2 # Uncomment to use OpenGL ES 2.0 (ANGLE)
|
||||
endif
|
||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP_SDL)
|
||||
# By default use OpenGL 3.3 on desktop platform with SDL backend
|
||||
GRAPHICS ?= GRAPHICS_API_OPENGL_33
|
||||
|
|
@ -583,7 +596,8 @@ OBJS = rcore.o \
|
|||
rshapes.o \
|
||||
rtextures.o \
|
||||
rtext.o \
|
||||
utils.o
|
||||
utils.o
|
||||
|
||||
|
||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||
ifeq ($(USE_EXTERNAL_GLFW),FALSE)
|
||||
|
|
|
|||
6350
src/external/RGFW.h
vendored
Normal file
6350
src/external/RGFW.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
src/external/sinfl.h
vendored
2
src/external/sinfl.h
vendored
|
|
@ -171,7 +171,7 @@ extern int zsinflate(void *out, int cap, const void *in, int size);
|
|||
|
||||
static int
|
||||
sinfl_bsr(unsigned n) {
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
_BitScanReverse(&n, n);
|
||||
return n;
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
|
|
|
|||
1519
src/platforms/rcore_desktop_rgfw.c
Normal file
1519
src/platforms/rcore_desktop_rgfw.c
Normal file
File diff suppressed because it is too large
Load Diff
10
src/raylib.h
10
src/raylib.h
|
|
@ -913,11 +913,11 @@ typedef enum {
|
|||
|
||||
// Camera system modes
|
||||
typedef enum {
|
||||
CAMERA_CUSTOM = 0, // Custom camera
|
||||
CAMERA_FREE, // Free camera
|
||||
CAMERA_ORBITAL, // Orbital camera
|
||||
CAMERA_FIRST_PERSON, // First person camera
|
||||
CAMERA_THIRD_PERSON // Third person camera
|
||||
CAMERA_CUSTOM = 0, // Camera custom, controlled by user (UpdateCamera() does nothing)
|
||||
CAMERA_FREE, // Camera free mode
|
||||
CAMERA_ORBITAL, // Camera orbital, around target, zoom supported
|
||||
CAMERA_FIRST_PERSON, // Camera first person
|
||||
CAMERA_THIRD_PERSON // Camera third person
|
||||
} CameraMode;
|
||||
|
||||
// Camera projection
|
||||
|
|
|
|||
|
|
@ -444,7 +444,8 @@ void UpdateCamera(Camera *camera, int mode)
|
|||
bool lockView = ((mode == CAMERA_FREE) || (mode == CAMERA_FIRST_PERSON) || (mode == CAMERA_THIRD_PERSON) || (mode == CAMERA_ORBITAL));
|
||||
bool rotateUp = false;
|
||||
|
||||
if (mode == CAMERA_ORBITAL)
|
||||
if (mode == CAMERA_CUSTOM) {}
|
||||
else if (mode == CAMERA_ORBITAL)
|
||||
{
|
||||
// Orbital can just orbit
|
||||
Matrix rotation = MatrixRotate(GetCameraUp(camera), CAMERA_ORBITAL_SPEED*GetFrameTime());
|
||||
|
|
|
|||
24
src/rcore.c
24
src/rcore.c
|
|
@ -154,13 +154,15 @@
|
|||
#endif
|
||||
|
||||
// Platform specific defines to handle GetApplicationDirectory()
|
||||
#if defined(_WIN32)
|
||||
#if (defined(_WIN32) && !defined(PLATFORM_DESKTOP_RGFW)) || (defined(_MSC_VER) && defined(PLATFORM_DESKTOP_RGFW))
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 1025
|
||||
#endif
|
||||
__declspec(dllimport) unsigned long __stdcall GetModuleFileNameA(void *hModule, void *lpFilename, unsigned long nSize);
|
||||
__declspec(dllimport) unsigned long __stdcall GetModuleFileNameW(void *hModule, void *lpFilename, unsigned long nSize);
|
||||
__declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, void *widestr, int cchwide, void *str, int cbmb, void *defchar, int *used_default);
|
||||
unsigned int __stdcall timeBeginPeriod(unsigned int uPeriod);
|
||||
unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
|
||||
#elif defined(__linux__)
|
||||
#include <unistd.h>
|
||||
#elif defined(__APPLE__)
|
||||
|
|
@ -482,7 +484,7 @@ static void ScanDirectoryFilesRecursively(const char *basePath, FilePathList *li
|
|||
static void RecordAutomationEvent(void); // Record frame events (to internal events array)
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(PLATFORM_DESKTOP_RGFW)
|
||||
// NOTE: We declare Sleep() function symbol to avoid including windows.h (kernel32.lib linkage required)
|
||||
void __stdcall Sleep(unsigned long msTimeout); // Required for: WaitTime()
|
||||
#endif
|
||||
|
|
@ -496,6 +498,8 @@ const char *TextFormat(const char *text, ...); // Formatting of tex
|
|||
#include "platforms/rcore_desktop.c"
|
||||
#elif defined(PLATFORM_DESKTOP_SDL)
|
||||
#include "platforms/rcore_desktop_sdl.c"
|
||||
#elif defined(PLATFORM_DESKTOP_RGFW)
|
||||
#include "platforms/rcore_desktop_rgfw.c"
|
||||
#elif defined(PLATFORM_WEB)
|
||||
#include "platforms/rcore_web.c"
|
||||
#elif defined(PLATFORM_DRM)
|
||||
|
|
@ -992,10 +996,10 @@ void BeginMode3D(Camera camera)
|
|||
if (camera.projection == CAMERA_PERSPECTIVE)
|
||||
{
|
||||
// Setup perspective projection
|
||||
double top = RL_CULL_DISTANCE_NEAR*tan(camera.fovy*0.5*DEG2RAD);
|
||||
double top = rlGetCullDistanceNear()*tan(camera.fovy*0.5*DEG2RAD);
|
||||
double right = top*aspect;
|
||||
|
||||
rlFrustum(-right, right, -top, top, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
|
||||
rlFrustum(-right, right, -top, top, rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
}
|
||||
else if (camera.projection == CAMERA_ORTHOGRAPHIC)
|
||||
{
|
||||
|
|
@ -1003,7 +1007,7 @@ void BeginMode3D(Camera camera)
|
|||
double top = camera.fovy/2.0;
|
||||
double right = top*aspect;
|
||||
|
||||
rlOrtho(-right, right, -top,top, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
|
||||
rlOrtho(-right, right, -top,top, rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
}
|
||||
|
||||
rlMatrixMode(RL_MODELVIEW); // Switch back to modelview matrix
|
||||
|
|
@ -1207,7 +1211,7 @@ VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device)
|
|||
|
||||
// Compute camera projection matrices
|
||||
float projOffset = 4.0f*lensShift; // Scaled to projection space coordinates [-1..1]
|
||||
Matrix proj = MatrixPerspective(fovy, aspect, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
|
||||
Matrix proj = MatrixPerspective(fovy, aspect, rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
|
||||
config.projection[0] = MatrixMultiply(proj, MatrixTranslate(projOffset, 0.0f, 0.0f));
|
||||
config.projection[1] = MatrixMultiply(proj, MatrixTranslate(-projOffset, 0.0f, 0.0f));
|
||||
|
|
@ -1446,7 +1450,7 @@ 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), RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
|
||||
matProj = MatrixPerspective(camera.fovy*DEG2RAD, ((double)width/(double)height), rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
}
|
||||
else if (camera.projection == CAMERA_ORTHOGRAPHIC)
|
||||
{
|
||||
|
|
@ -1533,7 +1537,7 @@ 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), RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
|
||||
matProj = MatrixPerspective(camera.fovy*DEG2RAD, ((double)width/(double)height), rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
}
|
||||
else if (camera.projection == CAMERA_ORTHOGRAPHIC)
|
||||
{
|
||||
|
|
@ -1542,7 +1546,7 @@ Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int heigh
|
|||
double right = top*aspect;
|
||||
|
||||
// Calculate projection matrix from orthographic
|
||||
matProj = MatrixOrtho(-right, right, -top, top, RL_CULL_DISTANCE_NEAR, RL_CULL_DISTANCE_FAR);
|
||||
matProj = MatrixOrtho(-right, right, -top, top, rlGetCullDistanceNear(), rlGetCullDistanceFar());
|
||||
}
|
||||
|
||||
// Calculate view matrix from camera look at (and transpose it)
|
||||
|
|
@ -1964,7 +1968,7 @@ const char *GetFileName(const char *filePath)
|
|||
|
||||
if (filePath != NULL) fileName = strprbrk(filePath, "\\/");
|
||||
|
||||
if (fileName != NULL) return filePath;
|
||||
if (fileName == NULL) return filePath;
|
||||
|
||||
return fileName + 1;
|
||||
}
|
||||
|
|
|
|||
25
src/rlgl.h
25
src/rlgl.h
|
|
@ -570,6 +570,9 @@ RLAPI void rlMultMatrixf(const float *matf); // Multiply the current
|
|||
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 rlViewport(int x, int y, int width, int height); // Set the viewport area
|
||||
RLAPI void rlSetClipPlanes(double near, double far); // Set clip planes distances
|
||||
RLAPI double rlGetCullDistanceNear(); // Get cull plane distance near
|
||||
RLAPI double rlGetCullDistanceFar(); // Get cull plane distance far
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
// Functions Declaration - Vertex level operations
|
||||
|
|
@ -1083,6 +1086,9 @@ typedef void *(*rlglLoadProc)(const char *name); // OpenGL extension functions
|
|||
//----------------------------------------------------------------------------------
|
||||
// Global Variables Definition
|
||||
//----------------------------------------------------------------------------------
|
||||
static double rlCullDistanceNear = RL_CULL_DISTANCE_NEAR;
|
||||
static double rlCullDistanceFar = RL_CULL_DISTANCE_FAR;
|
||||
|
||||
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
|
||||
static rlglData RLGL = { 0 };
|
||||
#endif // GRAPHICS_API_OPENGL_33 || GRAPHICS_API_OPENGL_ES2
|
||||
|
|
@ -1364,6 +1370,25 @@ void rlViewport(int x, int y, int width, int height)
|
|||
glViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
// Set clip planes distances
|
||||
void rlSetClipPlanes(double near, double far)
|
||||
{
|
||||
rlCullDistanceNear = near;
|
||||
rlCullDistanceFar = far;
|
||||
}
|
||||
|
||||
// Get cull plane distance near
|
||||
double rlGetCullDistanceNear(void)
|
||||
{
|
||||
return rlCullDistanceNear;
|
||||
}
|
||||
|
||||
// Get cull plane distance far
|
||||
double rlGetCullDistanceFar(void)
|
||||
{
|
||||
return rlCullDistanceFar;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Module Functions Definition - Vertex level operations
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -5121,14 +5121,6 @@ static Model LoadGLTF(const char *fileName)
|
|||
{
|
||||
// Support up to 2 texture coordinates attributes
|
||||
float *texcoordPtr = NULL;
|
||||
int index = data->meshes[i].primitives[p].attributes[j].index;
|
||||
if (index == 0) texcoordPtr = model.meshes[meshIndex].texcoords;
|
||||
else if (index == 1) texcoordPtr = model.meshes[meshIndex].texcoords2;
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "MODEL: [%s] No more than 2 texture coordinates attributes supported", fileName);
|
||||
continue;
|
||||
}
|
||||
|
||||
cgltf_accessor *attribute = data->meshes[i].primitives[p].attributes[j].data;
|
||||
|
||||
|
|
@ -5137,7 +5129,7 @@ static Model LoadGLTF(const char *fileName)
|
|||
if (attribute->component_type == cgltf_component_type_r_32f) // vec2, float
|
||||
{
|
||||
// Init raylib mesh texcoords to copy glTF attribute data
|
||||
texcoordPtr = RL_MALLOC(attribute->count*2*sizeof(float));
|
||||
texcoordPtr = (float *)RL_MALLOC(attribute->count*2*sizeof(float));
|
||||
|
||||
// Load 3 components of float data type into mesh.texcoords
|
||||
LOAD_ATTRIBUTE(attribute, 2, float, texcoordPtr)
|
||||
|
|
@ -5145,10 +5137,10 @@ static Model LoadGLTF(const char *fileName)
|
|||
else if (attribute->component_type == cgltf_component_type_r_8u) // vec2, u8n
|
||||
{
|
||||
// Init raylib mesh texcoords to copy glTF attribute data
|
||||
texcoordPtr = RL_MALLOC(attribute->count*2*sizeof(float));
|
||||
texcoordPtr = (float *)RL_MALLOC(attribute->count*2*sizeof(float));
|
||||
|
||||
// Load data into a temp buffer to be converted to raylib data type
|
||||
unsigned short *temp = RL_MALLOC(attribute->count*2*sizeof(unsigned char));
|
||||
unsigned char *temp = (unsigned char *)RL_MALLOC(attribute->count*2*sizeof(unsigned char));
|
||||
LOAD_ATTRIBUTE(attribute, 2, unsigned char, temp);
|
||||
|
||||
// Convert data to raylib texcoord data type (float)
|
||||
|
|
@ -5159,10 +5151,10 @@ static Model LoadGLTF(const char *fileName)
|
|||
else if (attribute->component_type == cgltf_component_type_r_16u) // vec2, u16n
|
||||
{
|
||||
// Init raylib mesh texcoords to copy glTF attribute data
|
||||
texcoordPtr = RL_MALLOC(attribute->count*2*sizeof(float));
|
||||
texcoordPtr = (float *)RL_MALLOC(attribute->count*2*sizeof(float));
|
||||
|
||||
// Load data into a temp buffer to be converted to raylib data type
|
||||
unsigned short *temp = RL_MALLOC(attribute->count*2*sizeof(unsigned short));
|
||||
unsigned short *temp = (unsigned short *)RL_MALLOC(attribute->count*2*sizeof(unsigned short));
|
||||
LOAD_ATTRIBUTE(attribute, 2, unsigned short, temp);
|
||||
|
||||
// Convert data to raylib texcoord data type (float)
|
||||
|
|
@ -5173,6 +5165,15 @@ static Model LoadGLTF(const char *fileName)
|
|||
else TRACELOG(LOG_WARNING, "MODEL: [%s] Texcoords attribute data format not supported", fileName);
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "MODEL: [%s] Texcoords attribute data format not supported, use vec2 float", fileName);
|
||||
|
||||
int index = data->meshes[i].primitives[p].attributes[j].index;
|
||||
if (index == 0) model.meshes[meshIndex].texcoords = texcoordPtr;
|
||||
else if (index == 1) model.meshes[meshIndex].texcoords2 = texcoordPtr;
|
||||
else
|
||||
{
|
||||
TRACELOG(LOG_WARNING, "MODEL: [%s] No more than 2 texture coordinates attributes supported", fileName);
|
||||
if (texcoordPtr != NULL) RL_FREE(texcoordPtr);
|
||||
}
|
||||
}
|
||||
else if (data->meshes[i].primitives[p].attributes[j].type == cgltf_attribute_type_color) // COLOR_n, vec3/vec4, float/u8n/u16n
|
||||
{
|
||||
|
|
|
|||
|
|
@ -178,8 +178,9 @@ void DrawLine(int startPosX, int startPosY, int endPosX, int endPosY, Color colo
|
|||
{
|
||||
rlBegin(RL_LINES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
rlVertex2f((float)startPosX, (float)startPosY);
|
||||
rlVertex2f((float)endPosX, (float)endPosY);
|
||||
// WARNING: Adding 0.5f offset to "center" point on selected pixel
|
||||
rlVertex2f((float)startPosX + 0.5f, (float)startPosY + 0.5f);
|
||||
rlVertex2f((float)endPosX + 0.5f, (float)endPosY + 0.5f);
|
||||
rlEnd();
|
||||
}
|
||||
|
||||
|
|
@ -188,8 +189,9 @@ void DrawLineV(Vector2 startPos, Vector2 endPos, Color color)
|
|||
{
|
||||
rlBegin(RL_LINES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
rlVertex2f(startPos.x, startPos.y);
|
||||
rlVertex2f(endPos.x, endPos.y);
|
||||
// WARNING: Adding 0.5f offset to "center" point on selected pixel
|
||||
rlVertex2f(startPos.x + 0.5f, startPos.y + 0.5f);
|
||||
rlVertex2f(endPos.x + 0.5f, endPos.y + 0.5f);
|
||||
rlEnd();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ static Font LoadBMFont(const char *fileName); // Load a BMFont file (AngelCode
|
|||
#if defined(SUPPORT_FILEFORMAT_BDF)
|
||||
static GlyphInfo *LoadFontDataBDF(const unsigned char *fileData, int dataSize, int *codepoints, int codepointCount, int *outFontSize);
|
||||
#endif
|
||||
static int textLineSpacing = 15; // Text vertical line spacing in pixels
|
||||
static int textLineSpacing = 2; // Text vertical line spacing in pixels (between lines)
|
||||
|
||||
#if defined(SUPPORT_DEFAULT_FONT)
|
||||
extern void LoadFontDefault(void);
|
||||
|
|
@ -1166,7 +1166,7 @@ void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, f
|
|||
if (codepoint == '\n')
|
||||
{
|
||||
// NOTE: Line spacing is a global variable, use SetTextLineSpacing() to setup
|
||||
textOffsetY += textLineSpacing;
|
||||
textOffsetY += (fontSize + textLineSpacing);
|
||||
textOffsetX = 0.0f;
|
||||
}
|
||||
else
|
||||
|
|
@ -1237,7 +1237,7 @@ void DrawTextCodepoints(Font font, const int *codepoints, int codepointCount, Ve
|
|||
if (codepoints[i] == '\n')
|
||||
{
|
||||
// NOTE: Line spacing is a global variable, use SetTextLineSpacing() to setup
|
||||
textOffsetY += textLineSpacing;
|
||||
textOffsetY += (fontSize + textLineSpacing);
|
||||
textOffsetX = 0.0f;
|
||||
}
|
||||
else
|
||||
|
|
@ -1319,7 +1319,7 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing
|
|||
textWidth = 0;
|
||||
|
||||
// NOTE: Line spacing is a global variable, use SetTextLineSpacing() to setup
|
||||
textHeight += (float)textLineSpacing;
|
||||
textHeight += (fontSize + textLineSpacing);
|
||||
}
|
||||
|
||||
if (tempByteCounter < byteCounter) tempByteCounter = byteCounter;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user