This commit is contained in:
aozhiwei 2023-01-06 10:08:56 +08:00
parent 6f5f9f11e6
commit c451112e94
2 changed files with 10 additions and 47 deletions

View File

@ -162,53 +162,7 @@ void MapInstance::Init()
}
navmesh_query_ = new dtNavMeshQuery();
navmesh_query_->init(navmesh_, 1024);
#if 0
{
dtTileRef tile_ref = navmesh_->getTileRefAt(0, 0, 0);
glm::vec3 start;
glm::vec3 end;
glm::vec3 hit_point;
start.x = 1.45;
start.y = 0.0;
start.z = 1.45;
end = start;
end.x = 1035;
end.y = 0;
end.z = 51.25;
bool hit_result = false;
#if 0
auto a = Raycast(0, start, end, hit_point, hit_result);
a8::XPrintf("ret:%d hit_point:%f,%f,%f\n",
{
a,
hit_point.x,
hit_point.y,
hit_point.z
});
int i = 0;
#endif
}
{
std::set<float> group_y;
const dtMeshTile* tile = navmesh_->getTileAt(0, 0, 0);
for (int i = 0; i < tile->header->polyCount; ++i) {
dtPoly* poly = &tile->polys[i];
for (int ii = 0; ii < poly->vertCount; ++ii) {
const float* va = &tile->verts[poly->verts[ii] * 3];
float y = va[1];
group_y.insert(y);
}
}
a8::XPrintf("group_y>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n", {});
for (auto& itr : group_y) {
a8::XPrintf("y:%f\n", {itr});
}
a8::XPrintf("group_y<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", {});
}
#endif
MarkMapAreaPolys();
}
void MapInstance::UnInit()
@ -647,3 +601,11 @@ dtPoly* MapInstance::GetPoly(glm::vec3 pos)
}
return nullptr;
}
void MapInstance::MarkMapAreaPolys()
{
const dtMeshTile* tile = navmesh_->getTileAt(0, 0, 0);
if (!tile) {
abort();
}
}

View File

@ -45,6 +45,7 @@ class MapInstance : public std::enable_shared_from_this<MapInstance>
private:
void CreateThings();
int AllocUniid();
void MarkMapAreaPolys();
private:
dtNavMesh* navmesh_ = nullptr;