rm rot
This commit is contained in:
1 parent
31abcb5b49
commit
1300669643
3 files changed
-35
No files matched your search
@@ -16,11 +16,6 @@ static int sr_height = 1;
|
|||||||
// Render configuration supplied by the application (see renderConst.swift).
|
// Render configuration supplied by the application (see renderConst.swift).
|
||||||
static raybri_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;
|
|
||||||
static float sr_rot_y = 0.0f;
|
|
||||||
static float sr_rot_z = 0.0f;
|
|
||||||
|
|
||||||
static int sr_ready = 0;
|
static int sr_ready = 0;
|
||||||
|
|
||||||
static Model sr_ground_model = { 0 };
|
static Model sr_ground_model = { 0 };
|
||||||
@@ -72,16 +67,6 @@ static void *sr_gl_loader(const char *name)
|
|||||||
return dlsym(handle, name);
|
return dlsym(handle, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compose a model transform exactly like raylib's DrawModel() does, so the
|
|
||||||
// matrices we feed to DrawMesh() match what rlgl computes internally.
|
|
||||||
static Matrix sr_transform(Vector3 pos, float scale, float rx, float ry, float rz)
|
|
||||||
{
|
|
||||||
Matrix mat_scale = MatrixScale(scale, scale, scale);
|
|
||||||
Matrix mat_rotation = MatrixRotateXYZ((Vector3){ rx * DEG2RAD, ry * DEG2RAD, rz * DEG2RAD });
|
|
||||||
Matrix mat_translation = MatrixTranslate(pos.x, pos.y, pos.z);
|
|
||||||
return MatrixMultiply(MatrixMultiply(mat_scale, mat_rotation), mat_translation);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sr_load_shaders(const char *main_vs, const char *main_fs,
|
static void sr_load_shaders(const char *main_vs, const char *main_fs,
|
||||||
const char *shadow_vs, const char *shadow_fs)
|
const char *shadow_vs, const char *shadow_fs)
|
||||||
{
|
{
|
||||||
@@ -200,18 +185,6 @@ void raybri_resize(int width, int height)
|
|||||||
if (height > 0) sr_height = height;
|
if (height > 0) sr_height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void raybri_set_rotation(float x_deg, float y_deg, float z_deg)
|
|
||||||
{
|
|
||||||
sr_rot_x = x_deg;
|
|
||||||
sr_rot_y = y_deg;
|
|
||||||
sr_rot_z = z_deg;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Matrix sr_cube_transform(void)
|
|
||||||
{
|
|
||||||
return sr_transform((Vector3){ 0.0f, 1.1f, 0.0f }, 1.0f, sr_rot_x, sr_rot_y, sr_rot_z);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sr_draw_object(Model model, Material material, Matrix model_mat,
|
static void sr_draw_object(Model model, Material material, Matrix model_mat,
|
||||||
Texture2D normal, float is_ground, float emissive);
|
Texture2D normal, float is_ground, float emissive);
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,6 @@ void raybri_init(
|
|||||||
// Resize the viewport.
|
// Resize the viewport.
|
||||||
void raybri_resize(int width, int height);
|
void raybri_resize(int width, int height);
|
||||||
|
|
||||||
// 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);
|
void raybri_render(void);
|
||||||
|
|
||||||
// Release all GPU resources.
|
// Release all GPU resources.
|
||||||
|
|||||||
@@ -3,12 +3,8 @@ import RaylibBridge
|
|||||||
|
|
||||||
func renderDraw(_ vm: RenderVM) {
|
func renderDraw(_ vm: RenderVM) {
|
||||||
vm.glView.openGLContext?.makeCurrentContext()
|
vm.glView.openGLContext?.makeCurrentContext()
|
||||||
|
|
||||||
raybri_resize(vm.pixelSize[0], vm.pixelSize[1])
|
raybri_resize(vm.pixelSize[0], vm.pixelSize[1])
|
||||||
let t = Float(CACurrentMediaTime() - vm.startTime)
|
|
||||||
raybri_set_rotation(t * 6.0, t * 18.0, 0.0)
|
|
||||||
raybri_render()
|
raybri_render()
|
||||||
|
|
||||||
vm.glView.openGLContext?.flushBuffer()
|
vm.glView.openGLContext?.flushBuffer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user