40 lines
697 B
C++
40 lines
697 B
C++
#pragma once
|
|
|
|
class Human;
|
|
|
|
namespace mc
|
|
{
|
|
struct Triangle;
|
|
}
|
|
|
|
struct CellNode
|
|
{
|
|
list_head entry;
|
|
mc::Triangle* tri = nullptr;
|
|
};
|
|
|
|
class Room;
|
|
class MapService
|
|
{
|
|
public:
|
|
MapService();
|
|
~MapService();
|
|
|
|
void Init(int width, int height, int cell_width);
|
|
void UnInit();
|
|
|
|
bool CanAdd(const glm::vec3& pos, int rad);
|
|
void AddTriangle(mc::Triangle* tri);
|
|
int GetGridId(float world_x, float world_y);
|
|
void GetGridList(int grid_id, list_head* grid_list[9], int& grid_count);
|
|
|
|
private:
|
|
list_head* map_cells_ = nullptr;
|
|
int map_width_ = 0;
|
|
int map_height_ = 0;
|
|
int cell_width_ = 0;
|
|
int max_grid_id_ = 0;
|
|
int grid_offset_arr_[9] = {0};
|
|
|
|
};
|