|
25 | 25 | namespace openage::path::tests { |
26 | 26 |
|
27 | 27 | void path_demo_1(const util::Path &path) { |
28 | | - auto grid = std::make_shared<Grid<path::SECTOR_SIZE>>(0, util::Vector2s{4, 3}, 10); |
| 28 | + auto grid = std::make_shared<Grid<path::SECTOR_SIZE>>(0, util::Vector2s{4, 3}); |
29 | 29 |
|
30 | 30 | // Initialize the cost field for each sector. |
31 | 31 | for (auto §or : grid->get_sectors()) { |
@@ -134,8 +134,8 @@ void path_demo_1(const util::Path &path) { |
134 | 134 | window->add_mouse_button_callback([&](const QMouseEvent &ev) { |
135 | 135 | if (ev.type() == QEvent::MouseButtonRelease) { |
136 | 136 | // From the mouse position, calculate the position/cell on the grid |
137 | | - auto cell_count_x = grid->get_size()[0] * grid->get_sector_size(); |
138 | | - auto cell_count_y = grid->get_size()[1] * grid->get_sector_size(); |
| 137 | + auto cell_count_x = grid->get_size()[0] * path::SECTOR_SIZE; |
| 138 | + auto cell_count_y = grid->get_size()[1] * path::SECTOR_SIZE; |
139 | 139 | auto window_size = window->get_size(); |
140 | 140 |
|
141 | 141 | double cell_size_x = static_cast<double>(window_size[0]) / cell_count_x; |
@@ -301,8 +301,8 @@ void RenderManager1::init_passes() { |
301 | 301 | // Create object for the grid |
302 | 302 | auto model = Eigen::Affine3f::Identity(); |
303 | 303 | model.prescale(Eigen::Vector3f{ |
304 | | - 2.0f / (this->grid->get_size()[0] * this->grid->get_sector_size()), |
305 | | - 2.0f / (this->grid->get_size()[1] * this->grid->get_sector_size()), |
| 304 | + 2.0f / (this->grid->get_size()[0] * path::SECTOR_SIZE), |
| 305 | + 2.0f / (this->grid->get_size()[1] * path::SECTOR_SIZE), |
306 | 306 | 1.0f}); |
307 | 307 | model.pretranslate(Eigen::Vector3f{-1.0f, -1.0f, 0.0f}); |
308 | 308 | auto grid_unifs = grid_shader->new_uniform_input( |
@@ -413,8 +413,8 @@ renderer::resources::MeshData RenderManager1::get_grid_mesh(const std::shared_pt |
413 | 413 | // increase by 1 in every dimension because to get the vertex length |
414 | 414 | // of each dimension |
415 | 415 | util::Vector2s size{ |
416 | | - grid->get_size()[0] * grid->get_sector_size() + 1, |
417 | | - grid->get_size()[1] * grid->get_sector_size() + 1}; |
| 416 | + grid->get_size()[0] * path::SECTOR_SIZE + 1, |
| 417 | + grid->get_size()[1] * path::SECTOR_SIZE + 1}; |
418 | 418 |
|
419 | 419 | // add vertices for the cells of the grid |
420 | 420 | std::vector<float> verts{}; |
@@ -467,7 +467,7 @@ renderer::resources::MeshData RenderManager1::get_grid_mesh(const std::shared_pt |
467 | 467 | void RenderManager1::create_impassible_tiles(const std::shared_ptr<path::Grid<path::SECTOR_SIZE>> &grid) { |
468 | 468 | auto width = grid->get_size()[0]; |
469 | 469 | auto height = grid->get_size()[1]; |
470 | | - auto sector_size = grid->get_sector_size(); |
| 470 | + auto sector_size = path::SECTOR_SIZE; |
471 | 471 |
|
472 | 472 | float tile_offset_width = 2.0f / (width * sector_size); |
473 | 473 | float tile_offset_height = 2.0f / (height * sector_size); |
@@ -529,7 +529,7 @@ void RenderManager1::create_impassible_tiles(const std::shared_ptr<path::Grid<pa |
529 | 529 | void RenderManager1::create_portal_tiles(const std::shared_ptr<path::Grid<path::SECTOR_SIZE>> &grid) { |
530 | 530 | auto width = grid->get_size()[0]; |
531 | 531 | auto height = grid->get_size()[1]; |
532 | | - auto sector_size = grid->get_sector_size(); |
| 532 | + auto sector_size = path::SECTOR_SIZE; |
533 | 533 |
|
534 | 534 | float tile_offset_width = 2.0f / (width * sector_size); |
535 | 535 | float tile_offset_height = 2.0f / (height * sector_size); |
@@ -606,7 +606,7 @@ void RenderManager1::create_portal_tiles(const std::shared_ptr<path::Grid<path:: |
606 | 606 | void RenderManager1::create_waypoint_tiles(const Path &path) { |
607 | 607 | auto width = grid->get_size()[0]; |
608 | 608 | auto height = grid->get_size()[1]; |
609 | | - auto sector_size = grid->get_sector_size(); |
| 609 | + auto sector_size = path::SECTOR_SIZE; |
610 | 610 |
|
611 | 611 | float tile_offset_width = 2.0f / (width * sector_size); |
612 | 612 | float tile_offset_height = 2.0f / (height * sector_size); |
|
0 commit comments