This commit is contained in:
aozhiwei 2023-06-20 16:54:28 +08:00
parent 1bf347bf12
commit a4a8586f36

View File

@ -11,6 +11,12 @@ namespace mt
void SafeAreaSafePoint::Init1()
{
auto itr = _type_safe_points_hash.find(type());
if (itr == _type_safe_points_hash.end()) {
_type_safe_points_hash[type()] = std::vector<glm::vec3>();
itr = _type_safe_points_hash.find(type());
}
itr->second.push_back(glm::vec3(x(), y(), z()));
}
void SafeAreaSafePoint::StaticPostInit()
@ -19,7 +25,9 @@ namespace mt
glm::vec3* SafeAreaSafePoint::RandPoint(int type) const
{
auto itr = _type_safe_points_hash.find(type);
return itr != _type_safe_points_hash.end() && !itr->second.empty() ?
&itr->second.at(rand() % itr->second.size()) : nullptr;
}
}