Залитые 3D-Боксы

root

  • 239
  • 283

root

Администратор
  • 239
  • 283
Код:
void Visuals::Player::Render3DBox()
{
    ICollideable* pCollideable = esp_ctx.pl->GetCollideable();
    if (!pCollideable)
        return;

    Vector min = pCollideable->OBBMins();
    Vector max = pCollideable->OBBMaxs();

    Vector points[] = {
        Vector(min.x, min.y, min.z),
        Vector(min.x, max.y, min.z),
        Vector(max.x, max.y, min.z),
        Vector(max.x, min.y, min.z),

        Vector(min.x, min.y, max.z),
        Vector(min.x, max.y, max.z),
        Vector(max.x, max.y, max.z),
        Vector(max.x, min.y, max.z)
    };

    matrix3x4_t trans = esp_ctx.pl->m_rgflCoordinateFrame();

    Vector pointsTransformed[8];
    for (int i = 0; i < 8; i++)
        Math::VectorTransform(points[i], trans, pointsTransformed[i]);

    Vector screenPoints[8];
    for (int i = 0; i < 8; i++)
        if (!Math::WorldToScreen(pointsTransformed[i], screenPoints[i]))
            return;

    g_VGuiSurface->DrawSetColor(esp_ctx.clr);
    for (int i = 1; i <= 4; i++)
    {
        g_VGuiSurface->DrawLine(screenPoints[i - 1].x, screenPoints[i - 1].y, screenPoints[i % 4].x, screenPoints[i % 4].y);
        g_VGuiSurface->DrawLine(screenPoints[i - 1].x, screenPoints[i - 1].y, screenPoints[i + 3].x, screenPoints[i + 3].y);
        g_VGuiSurface->DrawLine(screenPoints[i + 3].x, screenPoints[i + 3].y, screenPoints[i % 4 + 4].x, screenPoints[i % 4 + 4].y);
    }

    if (Settings::ESP::player_filledboxes)
    {

        Vertex_t Bottom[] = {
            Vector2D(screenPoints[3].x, screenPoints[3].y),
            Vector2D(screenPoints[2].x, screenPoints[2].y),
            Vector2D(screenPoints[1].x, screenPoints[1].y),
            Vector2D(screenPoints[0].x, screenPoints[0].y),
        };

        Vertex_t Top[] =
        {
            Vector2D(screenPoints[7].x, screenPoints[7].y),
            Vector2D(screenPoints[4].x, screenPoints[4].y),
            Vector2D(screenPoints[5].x, screenPoints[5].y),
            Vector2D(screenPoints[6].x, screenPoints[6].y),
        };

        Vertex_t Right[] =
        {
            Vector2D(screenPoints[3].x, screenPoints[3].y),
            Vector2D(screenPoints[0].x, screenPoints[0].y),
            Vector2D(screenPoints[4].x, screenPoints[4].y),
            Vector2D(screenPoints[7].x, screenPoints[7].y),
        };

        Vertex_t Left[] =
        {
            Vector2D(screenPoints[1].x, screenPoints[1].y),
            Vector2D(screenPoints[2].x, screenPoints[2].y),
            Vector2D(screenPoints[6].x, screenPoints[6].y),
            Vector2D(screenPoints[5].x, screenPoints[5].y),
        };

        Vertex_t Back[] =
        {
            Vector2D(screenPoints[0].x, screenPoints[0].y),
            Vector2D(screenPoints[1].x, screenPoints[1].y),
            Vector2D(screenPoints[5].x, screenPoints[5].y),
            Vector2D(screenPoints[4].x, screenPoints[4].y),
        };

        Vertex_t Front[] =
        {
            Vector2D(screenPoints[7].x, screenPoints[7].y),
            Vector2D(screenPoints[6].x, screenPoints[6].y),
            Vector2D(screenPoints[2].x, screenPoints[2].y),
            Vector2D(screenPoints[3].x, screenPoints[3].y),
        };

        static unsigned char buf[4] = { 255, 255, 255, 255 };
        static int texture = g_VGuiSurface->CreateNewTextureID(true);
        g_VGuiSurface->DrawSetTextureRGBA(texture, buf, 1, 1);
        g_VGuiSurface->DrawSetColor(esp_ctx.clr.r(), esp_ctx.clr.g(), esp_ctx.clr.b(), 50);
        g_VGuiSurface->DrawSetTexture(texture);
        g_VGuiSurface->DrawTexturedPolygon(4, Bottom);
        g_VGuiSurface->DrawTexturedPolygon(4, Top);
        g_VGuiSurface->DrawTexturedPolygon(4, Right);
        g_VGuiSurface->DrawTexturedPolygon(4, Left);
        g_VGuiSurface->DrawTexturedPolygon(4, Back);
        g_VGuiSurface->DrawTexturedPolygon(4, Front);
    }
}
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.