Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.91 KB | None | 0 0
  1. void Drawing::Draw3DBox(Vector vOrigin, Vector vMins, Vector vMaxs, float* flAngles, int linewidth, int r, int g, int b, int a) {
  2.     Vector vF, vR, vU;
  3.     g_Engine.pfnAngleVectors(flAngles, vF, vR, vU);
  4.  
  5.     float flForward = vMaxs.y;
  6.     float flBack = vMins.y;
  7.     float flRight = vMaxs.x;
  8.     float flLeft = vMins.x;
  9.     float flUp = vMaxs.z;
  10.     float flDown = vMins.z;
  11.  
  12.     /*if (bIsPlayer)
  13.     {
  14.         flForward += 15.0f;
  15.         flBack -= 5.0f;
  16.         flRight += 5.0f;
  17.         flLeft -= 5.0f;
  18.         flUp -= 5.0f;
  19.         flDown -= 2.0f;
  20.     }*/
  21.  
  22.     Vector TopLeftFront = vOrigin + vU * flUp + vF * flForward + vR * flLeft;
  23.     Vector TopRightFront = vOrigin + vU * flUp + vF * flForward + vR * flRight;
  24.     Vector TopLeftBack = vOrigin + vU * flUp + vF * flBack + vR * flLeft;
  25.     Vector TopRightBack = vOrigin + vU * flUp + vF * flBack + vR * flRight;
  26.  
  27.     Vector BottomLeftFront = vOrigin + vU * flDown + vF * flForward + vR * flLeft;
  28.     Vector BottomRightFront = vOrigin + vU * flDown + vF * flForward + vR * flRight;
  29.     Vector BottomLeftBack = vOrigin + vU * flDown + vF * flBack + vR * flLeft;
  30.     Vector BottomRightBack = vOrigin + vU * flDown + vF * flBack + vR * flRight;
  31.  
  32.     //Top Box
  33.     DrawVectorLine(TopLeftFront, TopRightFront, linewidth, r, g, b, a);
  34.     DrawVectorLine(TopRightFront, TopRightBack, linewidth, r, g, b, a);
  35.     DrawVectorLine(TopRightBack, TopLeftBack, linewidth, r, g, b, a);
  36.     DrawVectorLine(TopLeftBack, TopLeftFront, linewidth, r, g, b, a);
  37.  
  38.     //Mid Box
  39.     DrawVectorLine(TopLeftFront, BottomLeftFront, linewidth, r, g, b, a);
  40.     DrawVectorLine(TopRightFront, BottomRightFront, linewidth, r, g, b, a);
  41.     DrawVectorLine(TopLeftBack, BottomLeftBack, linewidth, r, g, b, a);
  42.     DrawVectorLine(TopRightBack, BottomRightBack, linewidth, r, g, b, a);
  43.  
  44.     //Bottom Box
  45.     DrawVectorLine(BottomLeftFront, BottomRightFront, linewidth, r, g, b, a);
  46.     DrawVectorLine(BottomRightFront, BottomRightBack, linewidth, r, g, b, a);
  47.     DrawVectorLine(BottomRightBack, BottomLeftBack, linewidth, r, g, b, a);
  48.     DrawVectorLine(BottomLeftBack, BottomLeftFront, linewidth, r, g, b, a);
  49.  
  50.     // diagonal lines #1 (+)
  51.     DrawVectorLine(BottomLeftFront, TopRightFront, linewidth, r, g, b, a);
  52.     DrawVectorLine(TopRightFront, BottomRightBack, linewidth, r, g, b, a);
  53.     DrawVectorLine(BottomRightBack, TopLeftBack, linewidth, r, g, b, a);
  54.     DrawVectorLine(TopLeftBack, BottomLeftFront, linewidth, r, g, b, a);
  55.     DrawVectorLine(BottomLeftFront, BottomRightBack, linewidth, r, g, b, a);
  56.     DrawVectorLine(TopLeftFront, TopRightBack, linewidth, r, g, b, a);
  57.    
  58.     // diagonal lines #2 (-)
  59.     DrawVectorLine(TopLeftFront, BottomRightFront, linewidth, r, g, b, a);
  60.     DrawVectorLine(BottomRightFront, TopLeftBack, linewidth, r, g, b, a);
  61.     DrawVectorLine(BottomLeftBack, TopRightBack, linewidth, r, g, b, a);
  62.     DrawVectorLine(TopRightBack, BottomRightFront, linewidth, r, g, b, a);
  63.     DrawVectorLine(BottomRightFront, BottomLeftBack, linewidth, r, g, b, a);
  64.     DrawVectorLine(TopRightFront, TopLeftBack, linewidth, r, g, b, a);
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement