diff --git a/core/static_array.jai b/core/static_array.jai index b407c4d..8f273ce 100644 --- a/core/static_array.jai +++ b/core/static_array.jai @@ -4,7 +4,7 @@ Static_Array :: struct (Data_Type : Type, Count: s64) { } array_add :: (static_array: *Static_Array, value: static_array.Data_Type) { - assert(static_array.count <= static_array.Count); + assert(static_array.count < static_array.Count); static_array.data[static_array.count] = value; static_array.count += 1; } diff --git a/core/transform.jai b/core/transform.jai index 586ded7..e45f58a 100644 --- a/core/transform.jai +++ b/core/transform.jai @@ -50,6 +50,10 @@ update_matrix :: (transform: *Transform) { transform.dirty = true; } +set_position :: (e: *Entity, position: Vector3, calculate_matrix: bool = true) { + set_position(*e.transform, position, calculate_matrix); +} + set_position :: (transform: *Transform, position: Vector3, calculate_matrix: bool = true) { transform.position = position; if calculate_matrix update_matrix(transform); @@ -129,6 +133,10 @@ quaternion_to_euler :: (q: Quaternion) -> yaw: float, pitch: float, roll: float return yaw, pitch, roll; } +set_rotation :: (e: *Entity, orientation: Quaternion, calculate_matrix: bool = true) { + set_rotation(*e.transform, orientation, calculate_matrix); +} + set_rotation :: (transform: *Transform, orientation: Quaternion, calculate_matrix: bool = true) { transform.orientation = orientation; if calculate_matrix update_matrix(transform); @@ -140,6 +148,10 @@ set_rotation :: (transform: *Transform, euler_angles: Vector3, calculate_matrix: if calculate_matrix update_matrix(transform); } +set_scale :: (e: *Entity, scale: Vector3, calculate_matrix: bool = true) { + set_scale(*e.transform, scale, calculate_matrix); +} + set_scale :: (transform: *Transform, scale: Vector3, calculate_matrix: bool = true) { transform.scale = scale; if calculate_matrix update_matrix(transform);