Math funcs
This commit is contained in:
@@ -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";
|
||||
#load "frustum.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;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user