From 56d4b2dd88be0bfca68feb93e4c35a6d85073b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=9A=D0=B0=D0=BF?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=BA=D0=BE?= Date: Fri, 23 Oct 2026 15:27:28 +0300 Subject: [PATCH] single bg color --- components/raybri/ios/raybriIOS.c | 31 ++---------------------- components/raybri/raybri.h | 10 +++----- components/render/ios/renderAux.swift | 4 +-- components/render/ios/renderEffect.swift | 3 --- 4 files changed, 6 insertions(+), 42 deletions(-) diff --git a/components/raybri/ios/raybriIOS.c b/components/raybri/ios/raybriIOS.c index 36cf2a2..dbcd755 100644 --- a/components/raybri/ios/raybriIOS.c +++ b/components/raybri/ios/raybriIOS.c @@ -12,7 +12,6 @@ #include "../raybri.h" -#include #include #include @@ -41,25 +40,6 @@ static void sr_log(const char *text) fflush(stderr); } -static void sr_hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b) -{ - float i = floorf(h * 6.0f); - float f = h * 6.0f - i; - float p = v * (1.0f - s); - float q = v * (1.0f - f * s); - float t = v * (1.0f - (1.0f - f) * s); - - switch (((int)i) % 6) - { - case 0: *r = v; *g = t; *b = p; break; - case 1: *r = q; *g = v; *b = p; break; - case 2: *r = p; *g = v; *b = t; break; - case 3: *r = p; *g = q; *b = v; break; - case 4: *r = t; *g = p; *b = v; break; - default: *r = v; *g = p; *b = q; break; - } -} - // (Re)create the EGL window surface on the layer handed to us by UIKit. static int sr_create_surface(void) { @@ -181,20 +161,13 @@ void raybri_resize(int width, int height) sr_log("surface recreated"); } -void raybri_render(double time) +void raybri_render(void) { if (!sr_ready) return; if (eglMakeCurrent(sr_display, sr_surface, sr_surface, sr_context) == EGL_FALSE) return; - // Background colour cycles through the hue wheel over time. - float hue = fmodf((float)time * 0.15f, 1.0f); - float r = 0.0f; - float g = 0.0f; - float b = 0.0f; - sr_hsv_to_rgb(hue, 0.65f, 0.85f, &r, &g, &b); - - rlClearColor((unsigned char)(r * 255.0f), (unsigned char)(g * 255.0f), (unsigned char)(b * 255.0f), 255); + rlClearColor(0, 0, 255, 255); rlClearScreenBuffers(); eglSwapBuffers(sr_display, sr_surface); diff --git a/components/raybri/raybri.h b/components/raybri/raybri.h index 39b3f9e..19de147 100644 --- a/components/raybri/raybri.h +++ b/components/raybri/raybri.h @@ -26,6 +26,9 @@ typedef struct raybri_config { // on iOS it recreates the EGL window surface when it changes. void raybri_resize(int width, int height); +// Render one frame. +void raybri_render(void); + // Release the GL/EGL resources owned by the bridge. void raybri_shutdown(void); @@ -35,10 +38,6 @@ void raybri_shutdown(void); // Returns 1 on success, 0 on failure. int raybri_init(void *layer, int width, int height); -// Render one frame: clear the drawable to a time-based background colour and -// present it. `time` is monotonically increasing seconds. -void raybri_render(double time); - #else // Initialise the OpenGL-backed raylib scene (no raylib window is created). @@ -57,9 +56,6 @@ void raybri_load_model(const char *gltf_path); // Cube rotation, driven by the application (Euler angles, degrees). void raybri_set_rotation(float x_deg, float y_deg, float z_deg); -// Render one frame. -void raybri_render(void); - #endif #ifdef __cplusplus diff --git a/components/render/ios/renderAux.swift b/components/render/ios/renderAux.swift index 349680b..0b91a78 100644 --- a/components/render/ios/renderAux.swift +++ b/components/render/ios/renderAux.swift @@ -1,12 +1,10 @@ -import QuartzCore import UIKit // Render a single frame. The timer calls this directly: an EGL/ANGLE surface // presents into the view's layer, so there is no draw(_:) / needsDisplay pass // like in the NSOpenGLView on macOS. func renderDraw(_ vm: RenderVM) { - let t = CACurrentMediaTime() - vm.startTime - raybri_render(t) + raybri_render() } // Backing-pixel size of the view, which is what EGL/ANGLE renders into. diff --git a/components/render/ios/renderEffect.swift b/components/render/ios/renderEffect.swift index d129eda..297492d 100644 --- a/components/render/ios/renderEffect.swift +++ b/components/render/ios/renderEffect.swift @@ -1,5 +1,4 @@ import Foundation -import QuartzCore import UIKit // Bring up EGL/ANGLE on the view's layer. Returns false when the surface could @@ -17,8 +16,6 @@ func renderInit(_ vm: RenderVM) -> Bool { // Same shape as the macOS timer: a repeating timer on the main run loop, but // here it calls the renderer directly instead of flagging the view for redraw. func renderStartTimer(_ vm: RenderVM) { - vm.startTime = CACurrentMediaTime() - let timer = Timer(timeInterval: 1.0 / RENDER_FPS, repeats: true) { [weak vm] _ in guard let vm else { return } renderDraw(vm)