remove redundant cell iter check

This commit is contained in:
jacob 2025-01-28 23:31:08 -06:00
parent dbd16ccd67
commit fef1d98c26
2 changed files with 6 additions and 9 deletions

View File

@ -380,11 +380,6 @@ struct space_client *space_iter_next(struct space_iter *iter)
/* Started */
ASSERT(iter->prev != NULL);
next_node = iter->prev->next_in_cell;
} else if (cell_cur.x < cell_start.x || cell_cur.y < cell_start.y) {
/* Unstarted */
iter->cell_cur = iter->cell_start;
iter->cell_cur.x -= 1;
iter->cell_cur.y -= 1;
} else if (cell_cur.x > cell_end.x || cell_cur.y > cell_end.y) {
/* Ended */
return NULL;
@ -408,19 +403,18 @@ struct space_client *space_iter_next(struct space_iter *iter)
cell_cur.y += nexty;
cell_cur.x += (cell_cur.x == 0);
cell_cur.y += (cell_cur.y == 0);
iter->cell_cur = cell_cur;
struct space_cell *cell = space_get_cell(space, cell_cur);
next_node = cell->first_node;
} else {
/* Reached end of iter */
cell_cur.x += 1;
cell_cur.y += 1;
iter->cell_cur = cell_cur;
break;
}
}
}
iter->prev = next_node;
iter->cell_cur = cell_cur;
return next_node ? next_node->client : NULL;
}

View File

@ -439,7 +439,9 @@ INTERNAL void debug_draw_movement(struct entity *ent)
struct v2 pos = xform_mul_v2(G.world_to_ui_xf, xf.og);
struct v2 vel_ray = xform_basis_mul_v2(G.world_to_ui_xf, velocity);
draw_arrow_ray(G.ui_cmd_buffer, pos, vel_ray, thickness, arrow_len, color_vel);
if (v2_len(vel_ray) > 0.00001) {
draw_arrow_ray(G.ui_cmd_buffer, pos, vel_ray, thickness, arrow_len, color_vel);
}
}
/* ========================== *
@ -1077,8 +1079,9 @@ INTERNAL void user_update(void)
f32 thickness = 2;
{
/* Draw collider using support points */
u32 detail = 32;
//u32 detail = 64;
u32 detail = 512;
//u32 detail = 512;
draw_collider_line(G.ui_cmd_buffer, G.world_to_ui_xf, collider, xf, thickness, color, detail);
}
{