#ifndef OGS_MAHJONG_RAYLIB_BRIDGE_H #define OGS_MAHJONG_RAYLIB_BRIDGE_H #include #ifdef __cplusplus extern "C" { #endif // Render configuration, sourced from renderConst.swift. typedef struct raybri_config { float fov_y; // vertical field of view (degrees) float near_plane; // camera near plane float far_plane; // camera far plane int shadow_size; // shadow map resolution (px) float ground_size; // ground plane extent } raybri_config; // The bridge always renders into a GL context owned by the app (no raylib // window), but the platform setup and the current feature set differ: // macOS renders the textured cube through raybri.c, iOS currently only clears // its EGL/ANGLE drawable through raybriIOS.c. The common names keep the Swift // call sites and lifecycle symmetrical. // Resize the drawable (backing pixels). On macOS this only records the size; // on iOS it recreates the EGL window surface when it changes. void raybri_resize(int width, int height); // Release the GL/EGL resources owned by the bridge. void raybri_shutdown(void); #if TARGET_OS_IPHONE // Initialise EGL (ANGLE) on the given CALayer and bring up rlgl. // 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). // The four shader sources come from renderConstShader.swift. void raybri_init( const char *main_vs, const char *main_fs, const char *shadow_vs, const char *shadow_fs, raybri_config config ); // Load the textured cube glTF model. 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 } #endif #endif