Reprogrammed rectangle drawing to be on top of everything
This commit is contained in:
parent
a1ae6462b6
commit
9614049610
2 changed files with 19 additions and 19 deletions
BIN
default
BIN
default
Binary file not shown.
|
|
@ -128,7 +128,7 @@ rectangle_corners_get_triangles :: proc (corners: RectangleCorners) -> [2]tri2 {
|
||||||
collection = &corners_slice,
|
collection = &corners_slice,
|
||||||
len = proc(it: sort.Interface) -> int {
|
len = proc(it: sort.Interface) -> int {
|
||||||
array := (cast(^[]AngleAndReference)it.collection)^
|
array := (cast(^[]AngleAndReference)it.collection)^
|
||||||
return 4
|
return len(array)
|
||||||
},
|
},
|
||||||
less = proc(it: sort.Interface, i, j: int) -> bool {
|
less = proc(it: sort.Interface, i, j: int) -> bool {
|
||||||
array := (cast(^[]AngleAndReference)it.collection)^
|
array := (cast(^[]AngleAndReference)it.collection)^
|
||||||
|
|
@ -213,29 +213,29 @@ animation_draw :: proc(animation: Animation, global_transform: mat3, temp_alloca
|
||||||
|
|
||||||
switch animation.type {
|
switch animation.type {
|
||||||
case .Rectangle:
|
case .Rectangle:
|
||||||
shape := animation.shapes.rectangle
|
rectangles := make([]RectangleCorners, animation.matrix_count + 1, temp_allocator)
|
||||||
draw_animation_rectangle_corners(rectangle_corners_transform_mat3(global_transform, shape), ANIMATION_COLOR_ORIGIN)
|
rectangles[0] = rectangle_corners_transform_mat3(global_transform, animation.shapes.rectangle)
|
||||||
transform := linalg.identity(mat3)
|
transform := linalg.identity(mat3)
|
||||||
matrices := slice.reinterpret([]mat3, animation.matrices[:animation.matrix_count * 9])
|
matrices := slice.reinterpret([]mat3, animation.matrices[:animation.matrix_count * 9])
|
||||||
for mat, i in matrices {
|
for mat, i in matrices {
|
||||||
animation_progress := f32(i + 1) / f32(animation.matrix_count)
|
|
||||||
transform_previous := transform
|
|
||||||
transform *= mat
|
transform *= mat
|
||||||
shape_next := rectangle_corners_transform_mat3(transform, shape)
|
rectangle_transformed := rectangle_corners_transform_mat3(transform, animation.shapes.rectangle)
|
||||||
shape_next_world := rectangle_corners_transform_mat3(global_transform, shape_next)
|
rectangles[i + 1] = rectangle_corners_transform_mat3(global_transform, rectangle_transformed)
|
||||||
shape_next_color := linalg.lerp(color_origin, color_end, animation_progress)
|
}
|
||||||
draw_animation_rectangle_corners(shape_next_world, rl.Color(shape_next_color))
|
for rectangle, i in rectangles {
|
||||||
|
color := linalg.lerp(color_origin, color_end, f32(i) / f32(animation.matrix_count))
|
||||||
|
draw_animation_rectangle_corners(rectangle, rl.Color(color))
|
||||||
|
}
|
||||||
|
|
||||||
if f32(i) == math.floor(animation.matrix_index) {
|
animation_progress := math.clamp(animation.matrix_index, 0.0, f32(animation.matrix_count - 1))
|
||||||
animation_current_progress_fraction := ease.ease(animation.ease, fract(animation.matrix_index))
|
animation_progress_frame := ease.ease(animation.ease, fract(animation.matrix_index))
|
||||||
animation_current_progress := (math.trunc(animation.matrix_index) + animation_current_progress_fraction) / f32(animation.matrix_count)
|
animation_progress_total := animation_progress + animation_progress_frame
|
||||||
shape_previous := rectangle_corners_transform_mat3(transform_previous, shape)
|
animation_progress_fraction := animation_progress_total / f32(animation.matrix_count)
|
||||||
shape_previous_world := rectangle_corners_transform_mat3(global_transform, shape_previous)
|
rectangle_previous := rectangles[i32(animation_progress)]
|
||||||
shape_current_world := rectangle_corners_lerp(shape_previous_world, shape_next_world, animation_current_progress_fraction)
|
rectangle_next := rectangles[i32(animation_progress + 1)]
|
||||||
shape_current_color := linalg.lerp(color_origin, color_end, animation_current_progress)
|
rectangle_current := rectangle_corners_lerp(rectangle_previous, rectangle_next, animation_progress_frame)
|
||||||
draw_animation_rectangle_corners(shape_current_world, rl.Color(shape_current_color))
|
rectangle_current_color := linalg.lerp(color_origin, color_end, animation_progress_fraction)
|
||||||
}
|
draw_animation_rectangle_corners(rectangle_current, rl.Color(rectangle_current_color))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue