mid smth
This commit is contained in:
1 parent
7a0a09c2a1
commit
0af2d75754
18 files changed
+509
-37
No files matched your search
@@ -4,12 +4,15 @@
|
||||
#include "rlgl.h"
|
||||
#include "raymath.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <math.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(PLATFORM_IOS)
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
static int sr_width = 1;
|
||||
static int sr_height = 1;
|
||||
|
||||
@@ -65,6 +68,7 @@ static int loc_fog_color = -1;
|
||||
static int loc_fog_start = -1;
|
||||
static int loc_fog_end = -1;
|
||||
|
||||
#if !defined(PLATFORM_IOS)
|
||||
// raylib is built as a static/dynamic library with GLFW baked in, but we never
|
||||
// call InitWindow(). Instead we render into an OpenGL context owned by the
|
||||
// macOS app, so we must supply the OpenGL entry point loader ourselves.
|
||||
@@ -78,6 +82,7 @@ static void *sr_gl_loader(const char *name)
|
||||
if (handle == NULL) return NULL;
|
||||
return dlsym(handle, name);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Compose a model transform exactly like raylib's DrawModel() does, so the
|
||||
// matrices we feed to DrawMesh() match what rlgl computes internally.
|
||||
@@ -190,9 +195,14 @@ void raybri_init(
|
||||
// raylib's default INFO logging is noisy; keep warnings and errors only.
|
||||
SetTraceLogLevel(LOG_WARNING);
|
||||
|
||||
#if !defined(PLATFORM_IOS)
|
||||
rlLoadExtensions((void *)sr_gl_loader);
|
||||
// Init with default 1x1 size
|
||||
rlglInit(1, 1);
|
||||
#else
|
||||
// On iOS the prebuilt raylib (ghera/raylib-iOS) already calls
|
||||
// rlLoadExtensions() and rlglInit() inside InitWindow(); skip here.
|
||||
#endif
|
||||
|
||||
sr_load_shaders(main_vs, main_fs, shadow_vs, shadow_fs);
|
||||
sr_config_shaders();
|
||||
@@ -216,6 +226,9 @@ void raybri_load_model(const char *gltf_path)
|
||||
|
||||
if (sr_has_model)
|
||||
{
|
||||
fprintf(stderr, "SR: model loaded: %s (%d meshes, %d materials)\n",
|
||||
gltf_path, sr_model.meshCount, sr_model.materialCount);
|
||||
|
||||
int cube_mat_index = (sr_model.materialCount > 0) ? sr_model.meshMaterial[0] : 0;
|
||||
sr_cube_material = sr_model.materials[cube_mat_index];
|
||||
sr_cube_material.shader = sr_main_shader;
|
||||
@@ -435,6 +448,8 @@ void raybri_shutdown(void)
|
||||
if (sr_main_shader.id > 0) UnloadShader(sr_main_shader);
|
||||
if (sr_shadow_shader.id > 0) UnloadShader(sr_shadow_shader);
|
||||
|
||||
#if !defined(PLATFORM_IOS)
|
||||
rlglClose();
|
||||
#endif
|
||||
sr_ready = 0;
|
||||
}
|
||||
Reference in new issue
Block a user