The
This commit is contained in:
parent
4e920b5f0a
commit
d5793c836f
4 changed files with 73 additions and 61 deletions
12
grid.odin
12
grid.odin
|
|
@ -9,15 +9,19 @@ Grid :: struct {
|
|||
world_position, world_size, offset: v2,
|
||||
}
|
||||
|
||||
draw_grid :: proc(grid: Grid, text_draw, text_clip: rect2) {
|
||||
zoom_amount := grid_get_zoom_amount(grid.zoom)
|
||||
world_to_grid_matrix := (
|
||||
grid_world_to_grid_matrix :: proc(zoom, offset: v2) -> mat3 {
|
||||
zoom_amount := linalg.pow(v2{2.0, 2.0}, zoom) - 1.0
|
||||
return (
|
||||
mat3 {
|
||||
1, 0, 0,
|
||||
0, 1, 0,
|
||||
grid.offset.x, grid.offset.y, 1,
|
||||
offset.x, offset.y, 1,
|
||||
} *
|
||||
linalg.matrix3_scale(v3{**zoom_amount, 1.0}))
|
||||
}
|
||||
|
||||
draw_grid :: proc(grid: Grid, text_draw, text_clip: rect2) {
|
||||
world_to_grid_matrix := grid_world_to_grid_matrix(grid.zoom, grid.offset)
|
||||
grid_to_world_matrix := linalg.inverse(world_to_grid_matrix)
|
||||
grid_world_br := grid.world_position + grid.world_size
|
||||
grid_color := rl.Color{64, 64, 64, 255}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue