-
Автор темы
- #1
[Osiris say hello]
Код:
void world_visuals::MolotovHull(c_inferno* inferno, ImDrawList* list)
{
static const auto flameCircumference = [] {
std::array<vec3_t, 72> points;
for (std::size_t i = 0; i < points.size(); ++i) {
constexpr auto flameRadius = 60.0f;
points[i] = vec3_t{ flameRadius * std::cos(DEG2RAD(i * (360.0f / points.size()))),
flameRadius * std::sin(DEG2RAD(i * (360.0f / points.size()))),
0.0f };
}
return points;
}();
std::vector<vec3_t> points;
auto origin = inferno->get_abs_origin();
points.reserve(inferno->fireCount());
for (int i = 0; i < inferno->fireCount(); ++i) {
if (inferno->fireIsBurning()[i])
points.emplace_back(inferno->get_fire_x_delta()[i] + origin.x, inferno->get_fire_y_delta()[i] + origin.y, inferno->get_fire_z_delta()[i] + origin.z);
}
for (const auto& pos : points) {
std::array<ImVec2, flameCircumference.size()> screenPoints;
std::size_t count = 0;
for (const auto& point : flameCircumference) {
if (D::WorldToScreen(pos + point, screenPoints[count]))
++count;
}
if (count < 1)
continue;
std::swap(screenPoints[0], *std::min_element(screenPoints.begin(), screenPoints.begin() + count, [](const auto& a, const auto& b) { return a.y < b.y || (a.y == b.y && a.x < b.x); }));
constexpr auto orientation = [](const ImVec2& a, const ImVec2& b, const ImVec2& c) {
return (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y);
};
std::sort(screenPoints.begin() + 1, screenPoints.begin() + count, [&](const auto& a, const auto& b) { return orientation(screenPoints[0], a, b) > 0.0f; });
list->AddConvexPolyFilled(screenPoints.data(), count, ImColor(1.f, 0.f, 0.f, 0.5f));
}
}
Код:
ANETVAR( get_fire_x_delta( ), int, 100, "CInferno->m_fireXDelta" )
ANETVAR( get_fire_y_delta( ), int, 100, "CInferno->m_fireYDelta" )
ANETVAR( get_fire_z_delta( ), int, 100, "CInferno->m_fireZDelta" )
ANETVAR(fireIsBurning( ), bool, 100, "CInferno->m_bFireIsBurning" )
NETVAR(fireCount(), int, "CInferno->m_fireCount");
Вложения
-
490 KB Просмотры: 680