diff --git a/core/math.jai b/core/math.jai index 5e7b766..eef0d1d 100644 --- a/core/math.jai +++ b/core/math.jai @@ -162,6 +162,14 @@ move_towards :: (origin: Vector3, target: Vector3, amount: float) -> Vector3 { return result; } +move_towards :: (origin: Vector2, target: Vector2, amount: float) -> Vector2 { + result : Vector2; + dir := normalize(target - origin); + result.x = move_towards(origin.x, target.x, abs(dir.x) * amount); + result.y = move_towards(origin.y, target.y, abs(dir.y) * amount); + return result; +} + smooth_damp :: (current: Vector3, target: Vector3, current_velocity: *Vector3, smooth_time: float, max_speed: float, delta_time: float) -> Vector3 { output_x := 0.0; output_y := 0.0; @@ -389,4 +397,4 @@ ease_in_out_sine :: (x: float) -> float { #import "PCG"; #import "Math"; -#load "frustum.jai"; \ No newline at end of file +#load "frustum.jai"; diff --git a/core/static_array.jai b/core/static_array.jai index a3ae998..26725df 100644 --- a/core/static_array.jai +++ b/core/static_array.jai @@ -32,6 +32,10 @@ operator [] :: (static_array: Static_Array, index: int) -> static_array.Data_Typ return static_array.data[index]; } +operator [] :: (static_array: *Static_Array, index: int) -> *static_array.Data_Type { + return *static_array.data[index]; +} + operator []= :: (static_array: *Static_Array, index: int, value: static_array.Data_Type) { static_array.data[index] = value; } \ No newline at end of file diff --git a/renderer/renderer.jai b/renderer/renderer.jai index 74099b9..1b9431c 100644 --- a/renderer/renderer.jai +++ b/renderer/renderer.jai @@ -602,6 +602,10 @@ Renderer :: struct { render_target_width: u32; render_target_height: u32; + default_models : struct { + sphere: Model; + } + default_meshes : struct { plane : Mesh_Handle; cube : Mesh_Handle; @@ -805,6 +809,7 @@ init_default_meshes :: () { { sphere_model := load_fbx("../modules/Coven/assets/models/sphere.fbx"); + engine.renderer.default_models.sphere = sphere_model; sphere_mesh, success := get_first_mesh_from_model(sphere_model); assert(success);