Advertisement
Guest User

hud forward vector sample

a guest
Sep 4th, 2014
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.43 KB | None | 0 0
  1. helmetMountedDisplay = 1;
  2. helmetPosition[] = { -0.04, 0.03, 0.1 };
  3. helmetRight[] = { 0.08, 0, 0 };
  4. helmetDown[] = { -0, -0.06, 0 };
  5. #define PosY0CenterAdjust 0.50 //from top
  6. #define PosYCenterHorizont 0.50 //0.33 for center (old helmet position 0.017 Y)
  7. #define PosY0Center 0.50
  8. #define PosX0Center 0.50
  9. #define SizeX10deg 0.2113243709752
  10. #define SizeY10deg 0.2931048289372
  11.  
  12. #define XtoYscale  (SizeX10deg/SizeY10deg)
  13.  
  14. #define XY_Scaled(xx,yy) __EVAL(xx),__EVAL((yy)/(XtoYscale))
  15.  
  16. class Bones
  17. {
  18.     class ForwardVec
  19.     {
  20.         type = "vector";
  21.         source = "forward";
  22.         pos0[] = { 0, 0 };
  23.         pos10[] = { SizeX10deg, SizeY10deg };
  24.     };
  25.     class ForwardVecX
  26.     {
  27.         type = "vector";
  28.         source = "forward";
  29.         pos0[] = { 0, 0 };
  30.         pos10[] = { SizeX10deg, 0 };
  31.     };
  32.     class ForwardVecY
  33.     {
  34.         type = "vector";
  35.         source = "forward";
  36.         pos0[] = { 0, 0 };
  37.         pos10[] = { 0, SizeY10deg };
  38.     };
  39.     class Level0 // horizon line bone (hud space)
  40.     {
  41.         type=vector;
  42.         pos0[]={PosX0Center,PosYCenterHorizont};
  43.         pos10[]={__EVAL(PosX0Center+SizeX10deg),__EVAL(PosYCenterHorizont+SizeY10deg)};
  44.         type=horizon;
  45.         angle=0;
  46.     };
  47.  
  48. class Draw
  49. {
  50.     alpha=0.4;
  51.     color[]={0.15,1.0,0.15};
  52.     condition="on";
  53.     //color[]={0.5,0.05,0.05};
  54.     class Border_debug //unnecessary but helps to see the HUD area better
  55.     {
  56.         type = line;
  57.         width = 1.0;
  58.         points[] = {
  59.                 { { 0, 0 }, 1 },
  60.                 { { 0, 1 }, 1 },
  61.                 { { 1, 1 }, 1 },
  62.                 { { 1, 0 }, 1 },
  63.                 { { 0, 0 }, 1 }
  64.         };
  65.     };
  66. // FV, FVX and FVY are basically just lines drawn from the Forward Vector and its components X, Y to the 0,0 HUD position. just debug stuff
  67.     class FV { //Forward Vector debug, draws vector between HUD 0,0 and FV 0,0
  68.         class FV_text // label the vector so we know which one is which in game
  69.         {
  70.             type = text;
  71.             source = static;
  72.             text = "FV";
  73.             align = right;
  74.             scale = 1; // text size (obsolete apparently)
  75.             sourceScale = 1;
  76.             pos[] = { ForwardVec, { XY_Scaled(0, 0) }, 1 };
  77.             right[] = { ForwardVec, { XY_Scaled(0.04, 0) }, 1 };
  78.             down[] = { ForwardVec, { XY_Scaled(0, 0.025) }, 1 };
  79.         };
  80.         class FV_cross // draw a cross on the vector (just to display bone orientation better, intended this for later testing with the horizon source)
  81.         {
  82.             type = line;
  83.             width = 1;
  84.             points[] =
  85.             {
  86.                 { { 0, 0 }, 1 },
  87.                 { ForwardVec, 1 },
  88.                 {},
  89.                 { ForwardVec, { 0.01, 0.01 }, 1 }, // X mark
  90.                 { ForwardVec, { -0.01, -0.01 }, 1 },
  91.                 {},
  92.                 { ForwardVec, { 0.01, -0.01 }, 1 },
  93.                 { ForwardVec, { -0.01, 0.01 }, 1 }
  94.             };
  95.         };
  96.     };
  97.     class FVX { //same as FV except only for X axis
  98.         class FVX_text
  99.         {
  100.             type = text;
  101.             source = static;
  102.             text = "FVX";
  103.             align = right;
  104.             scale = 1; // text size (obsolete apparently)
  105.             sourceScale = 1;
  106.             pos[] = { ForwardVecX, { XY_Scaled(0, 0) }, 1 };
  107.             right[] = { ForwardVecX, { XY_Scaled(0.04, 0) }, 1 };
  108.             down[] = { ForwardVecX, { XY_Scaled(0, 0.025) }, 1 };
  109.         };
  110.         class FVX_cross
  111.         {
  112.             type = line;
  113.             width = 1;
  114.             points[] =
  115.             {
  116.                 { { 0, 0 }, 1 },
  117.                 { ForwardVecX, 1 },
  118.                 {},
  119.                 { ForwardVecX, { 0.01, 0.01 }, 1 }, // X mark
  120.                 { ForwardVecX, { -0.01, -0.01 }, 1 },
  121.                 {},
  122.                 { ForwardVecX, { 0.01, -0.01 }, 1 },
  123.                 { ForwardVecX, { -0.01, 0.01 }, 1 }
  124.             };
  125.         };
  126.     };
  127.     class FVY { //samesame
  128.         class FVY_text
  129.         {
  130.             type = text;
  131.             source = static;
  132.             text = "FVY";
  133.             align = right;
  134.             scale = 1; // text size (obsolete apparently)
  135.             sourceScale = 1;
  136.             pos[] = { ForwardVecY, { XY_Scaled(0, 0) }, 1 };
  137.             right[] = { ForwardVecY, { XY_Scaled(0.04, 0) }, 1 };
  138.             down[] = { ForwardVecY, { XY_Scaled(0, 0.025) }, 1 };
  139.         };
  140.         class FVY_cross
  141.         {
  142.             type = line;
  143.             width = 1;
  144.             points[] =
  145.             {
  146.                 { { 0, 0 }, 1 },
  147.                 { ForwardVecY, 1 },
  148.                 {},
  149.                 { ForwardVecY, { 0.01, 0.01 }, 1 }, // X mark
  150.                 { ForwardVecY, { -0.01, -0.01 }, 1 },
  151.                 {},
  152.                 { ForwardVecY, { 0.01, -0.01 }, 1 },
  153.                 { ForwardVecY, { -0.01, 0.01 }, 1 },
  154.             };
  155.         };
  156.     };
  157.  
  158.     class Horizon {
  159. //here's where the magic happens. Horizon line which is
  160. //supposed to indicate the horizon whichever way you look,
  161. //but due to this bug, the more you look to the side,
  162. //the more the horizon displays wrong when you look up/down
  163.  
  164.         class Level0
  165.         {
  166.             type = line;
  167.             width = 2;
  168.             points[] =
  169.             {
  170.                 { Level0, { 10, 0 }, 1, ForwardVec, 1 },
  171.                 { Level0, { 0.08, 0 }, 1, ForwardVec, 1 },
  172.                 {},
  173.                 { level0, { -0.08, 0 }, 1, ForwardVec, 1 },
  174.                 { level0, { -10, 0 }, 1, ForwardVec, 1 },
  175.             };
  176.         };
  177.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement