Code:
void CVisuals::Box3D(LPDIRECT3DDEVICE9 pDevice, D3DCOLOR ESP_Color, LTObject* obj)
{
D3DXVECTOR3 _min = obj->GetBoxMin();
D3DXVECTOR3 _max = obj->GetBoxMax();
D3DXVECTOR3 crnr2 = D3DXVECTOR3(_max.x, _min.y, _min.z);
D3DXVECTOR3 crnr3 = D3DXVECTOR3(_max.x, _min.y, _max.z);
D3DXVECTOR3 crnr4 = D3DXVECTOR3(_min.x, _min.y, _max.z);
D3DXVECTOR3 crnr5 = D3DXVECTOR3(_min.x, _max.y, _max.z);
D3DXVECTOR3 crnr6 = D3DXVECTOR3(_min.x, _max.y, _min.z);
D3DXVECTOR3 crnr7 = D3DXVECTOR3(_max.x, _max.y, _min.z);
if (D::WTS(_min, &_min) &&
D::WTS(_max, &_max) &&
D::WTS(crnr2, &crnr2) &&
D::WTS(crnr3, &crnr3) &&
D::WTS(crnr4, &crnr4) &&
D::WTS(crnr5, &crnr5) &&
D::WTS(crnr6, &crnr6) &&
D::WTS(crnr7, &crnr7))
{
D::DrawLine(_min.x, _min.y, crnr2.x, crnr2.y, 1, ESP_Color, pDevice);
D::DrawLine(_min.x, _min.y, crnr4.x, crnr4.y, 1, ESP_Color, pDevice);
D::DrawLine(_min.x, _min.y, crnr6.x, crnr6.y, 1, ESP_Color, pDevice);
D::DrawLine(_max.x, _max.y, crnr5.x, crnr5.y, 1, ESP_Color, pDevice);
D::DrawLine(_max.x, _max.y, crnr7.x, crnr7.y, 1, ESP_Color, pDevice);
D::DrawLine(_max.x, _max.y, crnr3.x, crnr3.y, 1, ESP_Color, pDevice);
D::DrawLine(crnr2.x, crnr2.y, crnr7.x, crnr7.y, 1, ESP_Color, pDevice);
D::DrawLine(crnr2.x, crnr2.y, crnr3.x, crnr3.y, 1, ESP_Color, pDevice);
D::DrawLine(crnr4.x, crnr4.y, crnr5.x, crnr5.y, 1, ESP_Color, pDevice);
D::DrawLine(crnr4.x, crnr4.y, crnr3.x, crnr3.y, 1, ESP_Color, pDevice);
D::DrawLine(crnr6.x, crnr6.y, crnr5.x, crnr5.y, 1, ESP_Color, pDevice);
D::DrawLine(crnr6.x, crnr6.y, crnr7.x, crnr7.y, 1, ESP_Color, pDevice);
}
}
void CVisuals::Box2D(LPDIRECT3DDEVICE9 pDevice, D3DCOLOR ESP_Color, LTObject* obj)
{
D3DXVECTOR3 min = obj->GetBoxMin();
D3DXVECTOR3 max = obj->GetBoxMax();
D3DXVECTOR3 points[] =
{
D3DXVECTOR3(min.x, min.y, min.z),
D3DXVECTOR3(min.x, max.y, min.z),
D3DXVECTOR3(max.x, max.y, min.z),
D3DXVECTOR3(max.x, min.y, min.z),
D3DXVECTOR3(max.x, max.y, max.z),
D3DXVECTOR3(min.x, max.y, max.z),
D3DXVECTOR3(min.x, min.y, max.z),
D3DXVECTOR3(max.x, min.y, max.z)
};
D3DXVECTOR3 flb;
D3DXVECTOR3 brt;
D3DXVECTOR3 blb;
D3DXVECTOR3 frt;
D3DXVECTOR3 frb;
D3DXVECTOR3 brb;
D3DXVECTOR3 blt;
D3DXVECTOR3 flt;
if (D::WTS(points[3], &flb) && D::WTS(points[5], &brt) &&
D::WTS(points[0], &blb) && D::WTS(points[4], &frt) &&
D::WTS(points[2], &frb) && D::WTS(points[1], &brb) &&
D::WTS(points[6], &blt) && D::WTS(points[7], &flt))
{
D3DXVECTOR3 arr[] = { flb, brt, blb, frt, frb, brb, blt, flt };
float left = flb.x; // left
float top = flb.y; // top
float right = flb.x; // right
float bottom = flb.y; // bottom
for (int i = 1; i < 8; i++)
{
if (left > arr[i].x)
left = arr[i].x;
if (top < arr[i].y)
top = arr[i].y;
if (right < arr[i].x)
right = arr[i].x;
if (bottom > arr[i].y)
bottom = arr[i].y;
}
D::DrawLine(left, bottom, left, top, 1, ESP_Color, I::pDevice);
D::DrawLine(left, top, right, top, 1, ESP_Color, I::pDevice);
D::DrawLine(right, top, right, bottom, 1, ESP_Color, I::pDevice);
D::DrawLine(right, bottom, left, bottom, 1, ESP_Color, I::pDevice);
}
}
Credits :: smallC & dude719 from UC