Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Drawing::Draw3DBox(Vector vOrigin, Vector vMins, Vector vMaxs, float* flAngles, int linewidth, int r, int g, int b, int a) {
- Vector vF, vR, vU;
- g_Engine.pfnAngleVectors(flAngles, vF, vR, vU);
- float flForward = vMaxs.y;
- float flBack = vMins.y;
- float flRight = vMaxs.x;
- float flLeft = vMins.x;
- float flUp = vMaxs.z;
- float flDown = vMins.z;
- /*if (bIsPlayer)
- {
- flForward += 15.0f;
- flBack -= 5.0f;
- flRight += 5.0f;
- flLeft -= 5.0f;
- flUp -= 5.0f;
- flDown -= 2.0f;
- }*/
- Vector TopLeftFront = vOrigin + vU * flUp + vF * flForward + vR * flLeft;
- Vector TopRightFront = vOrigin + vU * flUp + vF * flForward + vR * flRight;
- Vector TopLeftBack = vOrigin + vU * flUp + vF * flBack + vR * flLeft;
- Vector TopRightBack = vOrigin + vU * flUp + vF * flBack + vR * flRight;
- Vector BottomLeftFront = vOrigin + vU * flDown + vF * flForward + vR * flLeft;
- Vector BottomRightFront = vOrigin + vU * flDown + vF * flForward + vR * flRight;
- Vector BottomLeftBack = vOrigin + vU * flDown + vF * flBack + vR * flLeft;
- Vector BottomRightBack = vOrigin + vU * flDown + vF * flBack + vR * flRight;
- //Top Box
- DrawVectorLine(TopLeftFront, TopRightFront, linewidth, r, g, b, a);
- DrawVectorLine(TopRightFront, TopRightBack, linewidth, r, g, b, a);
- DrawVectorLine(TopRightBack, TopLeftBack, linewidth, r, g, b, a);
- DrawVectorLine(TopLeftBack, TopLeftFront, linewidth, r, g, b, a);
- //Mid Box
- DrawVectorLine(TopLeftFront, BottomLeftFront, linewidth, r, g, b, a);
- DrawVectorLine(TopRightFront, BottomRightFront, linewidth, r, g, b, a);
- DrawVectorLine(TopLeftBack, BottomLeftBack, linewidth, r, g, b, a);
- DrawVectorLine(TopRightBack, BottomRightBack, linewidth, r, g, b, a);
- //Bottom Box
- DrawVectorLine(BottomLeftFront, BottomRightFront, linewidth, r, g, b, a);
- DrawVectorLine(BottomRightFront, BottomRightBack, linewidth, r, g, b, a);
- DrawVectorLine(BottomRightBack, BottomLeftBack, linewidth, r, g, b, a);
- DrawVectorLine(BottomLeftBack, BottomLeftFront, linewidth, r, g, b, a);
- // diagonal lines #1 (+)
- DrawVectorLine(BottomLeftFront, TopRightFront, linewidth, r, g, b, a);
- DrawVectorLine(TopRightFront, BottomRightBack, linewidth, r, g, b, a);
- DrawVectorLine(BottomRightBack, TopLeftBack, linewidth, r, g, b, a);
- DrawVectorLine(TopLeftBack, BottomLeftFront, linewidth, r, g, b, a);
- DrawVectorLine(BottomLeftFront, BottomRightBack, linewidth, r, g, b, a);
- DrawVectorLine(TopLeftFront, TopRightBack, linewidth, r, g, b, a);
- // diagonal lines #2 (-)
- DrawVectorLine(TopLeftFront, BottomRightFront, linewidth, r, g, b, a);
- DrawVectorLine(BottomRightFront, TopLeftBack, linewidth, r, g, b, a);
- DrawVectorLine(BottomLeftBack, TopRightBack, linewidth, r, g, b, a);
- DrawVectorLine(TopRightBack, BottomRightFront, linewidth, r, g, b, a);
- DrawVectorLine(BottomRightFront, BottomLeftBack, linewidth, r, g, b, a);
- DrawVectorLine(TopRightFront, TopLeftBack, linewidth, r, g, b, a);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement