rename
This commit is contained in:
1 parent
f0862c88f7
commit
41a7b330aa
6 files changed
+43
-36
No files matched your search
@@ -14,7 +14,7 @@ static int sr_width = 1;
|
||||
static int sr_height = 1;
|
||||
|
||||
// Render configuration supplied by the application (see renderConst.swift).
|
||||
static sr_config sr_cfg = { 0 };
|
||||
static raybri_config sr_cfg = { 0 };
|
||||
|
||||
// Cube transform (driven by the application, Euler degrees).
|
||||
static float sr_rot_x = 0.0f;
|
||||
@@ -178,12 +178,12 @@ static void sr_config_shaders(void)
|
||||
rlDisableShader();
|
||||
}
|
||||
|
||||
void sr_init(
|
||||
void raybri_init(
|
||||
const char *main_vs,
|
||||
const char *main_fs,
|
||||
const char *shadow_vs,
|
||||
const char *shadow_fs,
|
||||
sr_config config
|
||||
raybri_config config
|
||||
) {
|
||||
sr_cfg = config;
|
||||
|
||||
@@ -201,7 +201,7 @@ void sr_init(
|
||||
sr_ready = 1;
|
||||
}
|
||||
|
||||
void sr_load_model(const char *gltf_path)
|
||||
void raybri_load_model(const char *gltf_path)
|
||||
{
|
||||
if (!sr_ready || gltf_path == NULL) return;
|
||||
|
||||
@@ -242,13 +242,13 @@ void sr_load_model(const char *gltf_path)
|
||||
}
|
||||
}
|
||||
|
||||
void sr_resize(int width, int height)
|
||||
void raybri_resize(int width, int height)
|
||||
{
|
||||
if (width > 0) sr_width = width;
|
||||
if (height > 0) sr_height = height;
|
||||
}
|
||||
|
||||
void sr_set_rotation(float x_deg, float y_deg, float z_deg)
|
||||
void raybri_set_rotation(float x_deg, float y_deg, float z_deg)
|
||||
{
|
||||
sr_rot_x = x_deg;
|
||||
sr_rot_y = y_deg;
|
||||
@@ -395,7 +395,7 @@ static void sr_draw_object(Model model, Material material, Matrix model_mat,
|
||||
DrawMesh(model.meshes[0], material, model_mat);
|
||||
}
|
||||
|
||||
void sr_render(void)
|
||||
void raybri_render(void)
|
||||
{
|
||||
if (!sr_ready) return;
|
||||
|
||||
@@ -411,7 +411,7 @@ void sr_render(void)
|
||||
sr_render_main_pass();
|
||||
}
|
||||
|
||||
void sr_shutdown(void)
|
||||
void raybri_shutdown(void)
|
||||
{
|
||||
if (!sr_ready) return;
|
||||
|
||||
|
||||
@@ -6,38 +6,38 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
// Render configuration, sourced from renderConst.swift.
|
||||
typedef struct sr_config {
|
||||
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
|
||||
} sr_config;
|
||||
} raybri_config;
|
||||
|
||||
// Initialise the OpenGL-backed raylib scene (no raylib window is created).
|
||||
// The four shader sources come from renderConstShader.swift.
|
||||
void sr_init(
|
||||
void raybri_init(
|
||||
const char *main_vs,
|
||||
const char *main_fs,
|
||||
const char *shadow_vs,
|
||||
const char *shadow_fs,
|
||||
sr_config config
|
||||
raybri_config config
|
||||
);
|
||||
|
||||
// Load the textured cube glTF model.
|
||||
void sr_load_model(const char *gltf_path);
|
||||
void raybri_load_model(const char *gltf_path);
|
||||
|
||||
// Resize the viewport.
|
||||
void sr_resize(int width, int height);
|
||||
void raybri_resize(int width, int height);
|
||||
|
||||
// Cube rotation, driven by the application (Euler angles, degrees).
|
||||
void sr_set_rotation(float x_deg, float y_deg, float z_deg);
|
||||
void raybri_set_rotation(float x_deg, float y_deg, float z_deg);
|
||||
|
||||
// Render one frame.
|
||||
void sr_render(void);
|
||||
void raybri_render(void);
|
||||
|
||||
// Release all GPU resources.
|
||||
void sr_shutdown(void);
|
||||
void raybri_shutdown(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ import RaylibBridge
|
||||
func renderDraw(_ vm: RenderVM) {
|
||||
vm.glView.openGLContext?.makeCurrentContext()
|
||||
|
||||
sr_resize(vm.pixelSize[0], vm.pixelSize[1])
|
||||
raybri_resize(vm.pixelSize[0], vm.pixelSize[1])
|
||||
let t = Float(CACurrentMediaTime() - vm.startTime)
|
||||
sr_set_rotation(t * 6.0, t * 18.0, 0.0)
|
||||
sr_render()
|
||||
raybri_set_rotation(t * 6.0, t * 18.0, 0.0)
|
||||
raybri_render()
|
||||
|
||||
vm.glView.openGLContext?.flushBuffer()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import AppKit
|
||||
import RaylibBridge
|
||||
|
||||
let RENDER_CONFIG = sr_config(
|
||||
let RENDER_CONFIG = raybri_config(
|
||||
fov_y: 45.0,
|
||||
near_plane: 0.1,
|
||||
far_plane: 1000.0,
|
||||
|
||||
@@ -6,7 +6,7 @@ func renderDeinit(_ vm: RenderVM) {
|
||||
print("ИГР renderD")
|
||||
vm.timer?.invalidate()
|
||||
vm.glView.openGLContext?.makeCurrentContext()
|
||||
sr_shutdown()
|
||||
raybri_shutdown()
|
||||
}
|
||||
|
||||
func renderInit(_ vm: RenderVM) {
|
||||
@@ -17,7 +17,7 @@ func renderInit(_ vm: RenderVM) {
|
||||
vm.glView.openGLContext?.setValues(&swapInterval, for: .swapInterval)
|
||||
|
||||
// Init Raylib
|
||||
sr_init(
|
||||
raybri_init(
|
||||
RENDER_SHADER_MAIN_VS,
|
||||
RENDER_SHADER_MAIN_FS,
|
||||
RENDER_SHADER_SHADOW_VS,
|
||||
@@ -29,7 +29,7 @@ func renderInit(_ vm: RenderVM) {
|
||||
func renderLoadCubeModel(_ vm: RenderVM) {
|
||||
let path = Bundle.main.resourceURL!.path + RENDER_MODEL_CUBE
|
||||
vm.glView.openGLContext?.makeCurrentContext()
|
||||
sr_load_model(path)
|
||||
raybri_load_model(path)
|
||||
}
|
||||
|
||||
func renderStartTimer(_ vm: RenderVM) {
|
||||
|
||||
Reference in new issue
Block a user