diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core.c | 17 | ||||
-rw-r--r-- | src/debug_strings.c | 5 | ||||
-rw-r--r-- | src/maths.c | 8 |
3 files changed, 24 insertions, 6 deletions
@@ -27,16 +27,21 @@ void core_bringup(const char* window_name, struct GLFWwindow* optional_window) { glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); char* full_window_name = malloc(sizeof(char) * 100); - int _offset = sprintf(full_window_name, "%s (%s)", window_name, gapi); + sprintf(full_window_name, "%s (%s)", window_name, gapi); + + if (optional_window) { + g_core.window = optional_window; + } else { + GLFWwindow* glfw_window = glfwCreateWindow(800, 600, full_window_name, NULL, NULL); + g_core.window = glfw_window; + } - GLFWwindow* glfw_window = glfwCreateWindow(800, 600, full_window_name, NULL, NULL); - g_core.window = glfw_window; // This may move into a renderer struct - ral_backend_init(window_name, glfw_window); + ral_backend_init(window_name, g_core.window); - glfwSetKeyCallback(glfw_window, key_callback); - glfwSetFramebufferSizeCallback(glfw_window, resize_callback); + glfwSetKeyCallback(g_core.window, key_callback); + glfwSetFramebufferSizeCallback(g_core.window, resize_callback); } void core_shutdown() { ral_backend_shutdown(); diff --git a/src/debug_strings.c b/src/debug_strings.c new file mode 100644 index 0000000..b1e09aa --- /dev/null +++ b/src/debug_strings.c @@ -0,0 +1,5 @@ +#include <celeritas.h> + +const char* keyframe_kind_strings[4] = { "ROTATION", "TRANSLATION", "SCALE", "WEIGHTS" }; + +const char* interpolation_strings[3] = { "Step", "Linear", "Cubic" };
\ No newline at end of file diff --git a/src/maths.c b/src/maths.c index fbfcd72..10fa9e0 100644 --- a/src/maths.c +++ b/src/maths.c @@ -2,6 +2,10 @@ vec3 vec3_create(f32 x, f32 y, f32 z) { return (vec3){ x, y, z }; } +vec3 vec3_add(vec3 u, vec3 v) { + return (vec3){ .x = u.x + v.x, .y = u.y + v.y, .z = u.z + v.z }; +} + vec4 vec4_create(f32 x, f32 y, f32 z, f32 w) { return (vec4){ x, y, z, w }; } mat4 mat4_ident() { return (mat4){ .data = { 1.0, 0., 0., 0., 0., 1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1.0 } }; } @@ -35,3 +39,7 @@ mat4 mat4_perspective(f32 fov_radians, f32 aspect_ratio, f32 near_z, f32 far_z) out_matrix.data[14] = -((2.0f * far_z * near_z) / (far_z - near_z)); return out_matrix; } + +mat4 mat4_look_at(vec3 position, vec3 target, vec3 up) { + // TODO +}
\ No newline at end of file |