Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
DebugShapes.c
Go to the documentation of this file.
1 /*************************************************************************************
2 * This file contains additional debug shape functions
3 *************************************************************************************/
4 
5 //------------------------------------------------------------------------------------------------
6 // Visualizes a bone in an entity with axial lines
7 void ShowBoneDebug(IEntity ent, int bone, float scale)
8 {
9  vector boneMat[4];
10  if (ent.GetAnimation().GetBoneMatrix(bone, boneMat))
11  {
12  vector mat[4];
13  ent.GetTransform(mat);
14 
15  vector pBase = boneMat[3];
16  vector p0 = boneMat[0] * scale + boneMat[3];
17  vector p1 = boneMat[1] * scale + boneMat[3];
18  vector p2 = boneMat[2] * scale + boneMat[3];
19  pBase = pBase.Multiply4(mat);
20  p0 = p0.Multiply4(mat);
21  p1 = p1.Multiply4(mat);
22  p2 = p2.Multiply4(mat);
23  Shape.Create(ShapeType.LINE, ARGB(255, 255, 0, 0), ShapeFlags.ONCE|ShapeFlags.NOZBUFFER, pBase, p0);
24  Shape.Create(ShapeType.LINE, ARGB(255, 0, 255, 0), ShapeFlags.ONCE|ShapeFlags.NOZBUFFER, pBase, p1);
25  Shape.Create(ShapeType.LINE, ARGB(255, 0, 0, 255), ShapeFlags.ONCE|ShapeFlags.NOZBUFFER, pBase, p2);
26  }
27 }
28 
29 //------------------------------------------------------------------------------------------------
30 Shape CreateCone(vector pos, vector aroundDir, float coneAngX, float coneAngY, float coneLength, int color, int subdivisions, ShapeFlags flags)
31 {
32  if (subdivisions < 2)
33  subdivisions = 2;
34  if (subdivisions > 50)
35  subdivisions = 50;
36 
37  vector rt = "1 0 0";
38  if (rt == aroundDir)
39  rt = "0 1 0";
40  vector fw = rt * aroundDir;
41  fw.Normalize();
42  rt = aroundDir * fw;
43  rt.Normalize();
44 
45  vector mat[3];
46  mat[0] = rt;
47  mat[1] = aroundDir;
48  mat[2] = fw;
49 
50  float sectionDeg = 360 / subdivisions;
51  subdivisions++;
52 
53  vector pts[200];
54  int curPts = 0;
55  for (int i = 0; i < subdivisions; i++)
56  {
57  float xValue = Math.Sin(sectionDeg * i * Math.DEG2RAD);
58  xValue *= xValue;
59  float yValue = Math.Cos(sectionDeg * i * Math.DEG2RAD);
60  yValue *= yValue;
61 
62  float lineAng = Math.AbsFloat(xValue * coneAngX);
63  lineAng += Math.AbsFloat(yValue * coneAngY);
64 
65  vector pt = Vector(0, 0, coneLength);
66  vector rotMat[3];
67  Math3D.AnglesToMatrix(Vector(sectionDeg * i, 90 - lineAng, 0), rotMat);
68  pt = pt.Multiply3(rotMat);
69  pt = pt.Multiply3(mat);
70  pts[curPts] = pt + pos;
71  curPts++;
72  pts[curPts] = pos;
73  curPts++;
74  pts[curPts] = pt + pos; // Have to make an additional line back to the circle to keep it as one shape object
75  curPts++;
76  }
77  pts[curPts] = pts[0];
78 
79  return Shape.CreateLines(color, flags, pts, curPts);
80 }
81 
82 //------------------------------------------------------------------------------------------------
83 Shape CreateCircle(vector pos, vector aroundDir, float radius, int color, int subdivisions, ShapeFlags flags)
84 {
85  if (subdivisions < 2)
86  subdivisions = 2;
87  if (subdivisions > 50)
88  subdivisions = 50;
89 
90  vector rt = "1 0 0";
91  if (rt == aroundDir)
92  rt = "0 1 0";
93  vector fw = rt * aroundDir;
94  fw.Normalize();
95  rt = aroundDir * fw;
96  rt.Normalize();
97 
98  vector mat[3];
99  mat[0] = rt;
100  mat[1] = aroundDir;
101  mat[2] = fw;
102 
103  float sectionDeg = 360 / subdivisions;
104  subdivisions++;
105 
106  vector pts[51];
107  for (int i = 0; i < subdivisions; i++)
108  {
109  vector pt = vector.FromYaw(sectionDeg * i) * radius;
110  pt = pt.Multiply3(mat);
111  pts[i] = pt + pos;
112  }
113  pts[subdivisions - 1] = pts[0];
114 
115  return Shape.CreateLines(color, flags, pts, subdivisions);
116 }
117 
118 //------------------------------------------------------------------------------------------------
119 Shape CreateCircleArc(vector pos, vector aroundDir, vector forwardDir, float angMin, float angMax, float radius, int color, int subdivisions, ShapeFlags flags)
120 {
121  if (subdivisions < 2)
122  subdivisions = 2;
123 
124  if (subdivisions > 50)
125  subdivisions = 50;
126 
127  if (angMin > angMax)
128  {
129  float angTmp = angMin;
130  angMin = angMax;
131  angMax = angTmp;
132  }
133 
134  if (angMin > 360 || angMax > 360)
135  return CreateCircle(pos, aroundDir, radius, color, subdivisions, flags);
136 
137  vector rt = aroundDir * forwardDir;
138  rt.Normalize();
139 
140  vector mat[3];
141  mat[0] = rt;
142  mat[1] = aroundDir;
143  mat[2] = forwardDir;
144 
145  float sectionDeg = Math.AbsFloat(angMax - angMin) / subdivisions;
146 
147  subdivisions++;
148 
149  vector pts[51];
150  for (int i = 0; i < subdivisions; i++)
151  {
152  vector pt = vector.FromYaw(sectionDeg * i + angMin) * radius;
153  pt = pt.Multiply3(mat);
154  pts[i] = pos + pt;
155  }
156 
157  return Shape.CreateLines(color, flags, pts, subdivisions);
158 }
159 
160 //------------------------------------------------------------------------------------------------
165 Shape CreateCircleSlice(vector pos, vector aroundDir, vector forwardDir, float angMin, float angMax, float radius, int color, int subdivisions, ShapeFlags flags)
166 {
167  if (subdivisions < 2)
168  subdivisions = 2;
169  if (subdivisions > 50)
170  subdivisions = 50;
171  if (angMin > angMax) // Min greater than max, do full circle
172  return CreateCircle(pos, aroundDir, radius, color, subdivisions, flags);
173 
174  subdivisions++;
175 
176  vector rt = aroundDir * forwardDir;
177  rt.Normalize();
178 
179  vector mat[3];
180  mat[0] = rt;
181  mat[1] = aroundDir;
182  mat[2] = forwardDir;
183 
184  float sectionDeg = Math.AbsFloat(angMax - angMin) / (subdivisions - 1);
185 
186  vector pts[53];
187  for (int i = 0; i < subdivisions; i++)
188  {
189  int ptIndex = i + 1;
190  vector pt = vector.FromYaw(sectionDeg * i + angMin) * radius;
191  pt = pt.Multiply3(mat);
192  pts[ptIndex] = pt + pos;
193  }
194  subdivisions += 2;
195  pts[0] = pos;
196  pts[subdivisions - 1] = pos;
197 
198  return Shape.CreateLines(color, flags, pts, subdivisions);
199 }
200 
201 //------------------------------------------------------------------------------------------------
202 void CreateArrowLinkLines(vector from, vector to, vector faceDir, float size, int numArrows, int color, ShapeFlags flags)
203 {
204  if (numArrows == 0)
205  return;
206 
207  vector fw = to - from;
208  fw.Normalize();
209  vector rt = faceDir * fw;
210  rt.Normalize();
211  vector up = fw * rt;
212  up.Normalize();
213 
214  vector scaledMat[3];
215  scaledMat[0] = rt;
216  scaledMat[1] = up;
217  scaledMat[2] = fw;
218 
219  Shape shp;
220 
221  vector pts[3];
222 
223  float distInc = vector.Distance(from, to) / numArrows;
224  for (int i = 0; i < numArrows; i++)
225  {
226 
227  vector pos = fw * (distInc * i) + from;
228  pts[0] = Vector(-1, 0, 0).Multiply3(scaledMat) * size + pos;
229  pts[1] = Vector(0, 0, 0.5).Multiply3(scaledMat) * size + pos;
230  pts[2] = Vector(1, 0, 0).Multiply3(scaledMat) * size + pos;
231  shp = Shape.CreateLines(color, flags, pts, 3);
232  }
233 }
234 
235 //------------------------------------------------------------------------------------------------
236 void CreateSimpleText(string text, vector mat[4], float size, int color, ShapeFlags flags, array<ref Shape> output = null, float scaleWidth = 1, bool doBackground = false, int backgroundColor = 0x80000000)
237 {
238  vector scaledMat[4];
239  scaledMat[0] = mat[0] * size * scaleWidth;
240  scaledMat[1] = mat[1] * size;
241  scaledMat[2] = mat[2];
242  scaledMat[3] = mat[3];
243 
244  vector pts[14];
245 
246  int numLetters = text.Length();
247  float offsetStartLeft = numLetters * -0.5;
248  Shape shp;
249 
250  // Add background
251  if (doBackground)
252  {
253  ShapeFlags bgFlags = ShapeFlags.TRANSP | ShapeFlags.NOOUTLINE | ShapeFlags.NOZWRITE;
254  if (flags & ShapeFlags.ONCE)
255  bgFlags |= ShapeFlags.ONCE;
256  if (flags & ShapeFlags.NOZBUFFER)
257  bgFlags |= ShapeFlags.NOZBUFFER;
258 
259  shp = Shape.Create(ShapeType.BBOX, backgroundColor, bgFlags, Vector(offsetStartLeft - 0.25, -0.25, 0.01), Vector(-offsetStartLeft + 0.25, 1.25, 0.01));
260  shp.SetMatrix(scaledMat);
261  if (output)
262  output.Insert(shp);
263  }
264 
265  for (int i = 0; i < numLetters; i++)
266  {
267  float start = i + offsetStartLeft + 0.1;
268  string letter = text.Get(i);
269  string letterUpper = letter;
270  letterUpper.ToUpper();
271 
272  float caseScale;
273  if (letterUpper == letter) // Is upper case
274  caseScale = 1;
275  else
276  caseScale = 0.6;
277 
278  switch (letterUpper)
279  {
280  // Letters --------------------------------------------
281  case "A":
282  {
283  pts[0][0] = start; pts[0][1] = 0;
284  pts[1][0] = start + 0.3; pts[1][1] = caseScale * 0.9;
285  pts[2][0] = start + 0.6; pts[2][1] = 0;
286  pts[3][0] = start + 0.47; pts[3][1] = caseScale * 0.37;
287  pts[4][0] = start + 0.13; pts[4][1] = caseScale * 0.37;
288  shp = Shape.CreateLines(color, flags, pts, 5);
289  shp.SetMatrix(scaledMat);
290  if (output)
291  output.Insert(shp);
292  break;
293  }
294  case "B":
295  {
296  pts[0][0] = start + 0.1; pts[0][1] = 0;
297  pts[1][0] = start + 0.1; pts[1][1] = caseScale * 0.9;
298  pts[2][0] = start + 0.5; pts[2][1] = caseScale * 0.9;
299  pts[3][0] = start + 0.6; pts[3][1] = caseScale * 0.8;
300  pts[4][0] = start + 0.6; pts[4][1] = caseScale * 0.6;
301  pts[5][0] = start + 0.5; pts[5][1] = caseScale * 0.5;
302  pts[6][0] = start + 0.1; pts[6][1] = caseScale * 0.5;
303  pts[7] = pts[5];
304  pts[8][0] = start + 0.6; pts[8][1] = caseScale * 0.4;
305  pts[9][0] = start + 0.6; pts[9][1] = caseScale * 0.1;
306  pts[10][0] = start + 0.5; pts[10][1] = 0;
307  pts[11][0] = start + 0.1; pts[11][1] = 0;
308  shp = Shape.CreateLines(color, flags, pts, 12);
309  shp.SetMatrix(scaledMat);
310  if (output)
311  output.Insert(shp);
312 
313  break;
314  }
315  case "C":
316  {
317  pts[0][0] = start + 0.6; pts[0][1] = caseScale * 0.2;
318  pts[1][0] = start + 0.4; pts[1][1] = 0;
319  pts[2][0] = start + 0.2; pts[2][1] = 0;
320  pts[3][0] = start; pts[3][1] = caseScale * 0.2;
321  pts[4][0] = start; pts[4][1] = caseScale * 0.7;
322  pts[5][0] = start + 0.2; pts[5][1] = caseScale * 0.9;
323  pts[6][0] = start + 0.4; pts[6][1] = caseScale * 0.9;
324  pts[7][0] = start + 0.6; pts[7][1] = caseScale * 0.7;
325  shp = Shape.CreateLines(color, flags, pts, 8);
326  shp.SetMatrix(scaledMat);
327  if (output)
328  output.Insert(shp);
329 
330  break;
331  }
332  case "D":
333  {
334  pts[0][0] = start; pts[0][1] = caseScale * 0.9;
335  pts[1][0] = start + 0.4; pts[1][1] = caseScale * 0.9;
336  pts[2][0] = start + 0.6; pts[2][1] = caseScale * 0.7;
337  pts[3][0] = start + 0.6; pts[3][1] = caseScale * 0.2;
338  pts[4][0] = start + 0.4; pts[4][1] = 0;
339  pts[5][0] = start; pts[5][1] = 0;
340  pts[6][0] = start; pts[6][1] = caseScale * 0.9;
341  shp = Shape.CreateLines(color, flags, pts, 7);
342  shp.SetMatrix(scaledMat);
343  if (output)
344  output.Insert(shp);
345 
346  break;
347  }
348  case "E":
349  {
350  pts[0][0] = start + 0.5; pts[0][1] = 0;
351  pts[1][0] = start; pts[1][1] = 0;
352  pts[2][0] = start; pts[2][1] = caseScale * 0.4;
353  pts[3][0] = start + 0.4; pts[3][1] = caseScale * 0.4;
354  pts[4] = pts[2];
355  pts[5][0] = start; pts[5][1] = caseScale * 0.9;
356  pts[6][0] = start + 0.5; pts[6][1] = caseScale * 0.9;
357  shp = Shape.CreateLines(color, flags, pts, 7);
358  shp.SetMatrix(scaledMat);
359  if (output)
360  output.Insert(shp);
361  break;
362  }
363  case "F":
364  {
365  pts[0] = Vector(start, 0, 0);
366  pts[1] = Vector(start, caseScale * 0.4, 0);
367  pts[2] = Vector(start + 0.4, caseScale * 0.4, 0);
368  pts[3] = pts[1];
369  pts[4] = Vector(start, caseScale * 0.9, 0);
370  pts[5] = Vector(start + 0.5, caseScale * 0.9, 0);
371  shp = Shape.CreateLines(color, flags, pts, 6);
372  shp.SetMatrix(scaledMat);
373  if (output)
374  output.Insert(shp);
375  break;
376  }
377  case "G":
378  {
379  pts[0] = Vector(start + 0.4, caseScale * 0.4, 0);
380  pts[1] = Vector(start + 0.6, caseScale * 0.4, 0);
381  pts[2] = Vector(start + 0.6, caseScale * 0.2, 0);
382  pts[3] = Vector(start + 0.4, 0, 0);
383  pts[4] = Vector(start + 0.2, 0, 0);
384  pts[5] = Vector(start, caseScale * 0.2, 0);
385  pts[6] = Vector(start, caseScale * 0.7, 0);
386  pts[7] = Vector(start + 0.2, caseScale * 0.9, 0);
387  pts[8] = Vector(start + 0.4, caseScale * 0.9, 0);
388  pts[9] = Vector(start + 0.6, caseScale * 0.7, 0);
389  shp = Shape.CreateLines(color, flags, pts, 10);
390  shp.SetMatrix(scaledMat);
391  if (output)
392  output.Insert(shp);
393 
394  break;
395  }
396  case "H":
397  {
398  pts[0] = Vector(start, 0, 0);
399  pts[1] = Vector(start, caseScale * 0.9, 0);
400  pts[2] = Vector(start, caseScale * 0.4, 0);
401  pts[3] = Vector(start + 0.6, caseScale * 0.4, 0);
402  pts[4] = Vector(start + 0.6, caseScale * 0.9, 0);
403  pts[5] = Vector(start + 0.6, 0, 0);
404 
405  shp = Shape.CreateLines(color, flags, pts, 6);
406  shp.SetMatrix(scaledMat);
407  if (output)
408  output.Insert(shp);
409  break;
410  }
411  case "I":
412  {
413  pts[0][0] = start + 0.1; pts[0][1] = caseScale * 0.9;
414  pts[1][0] = start + 0.5; pts[1][1] = caseScale * 0.9;
415  pts[2][0] = start + 0.3; pts[2][1] = caseScale * 0.9;
416  pts[3][0] = start + 0.3; pts[3][1] = 0;
417  pts[4][0] = start + 0.5; pts[4][1] = 0;
418  pts[5][0] = start + 0.1; pts[5][1] = 0;
419  shp = Shape.CreateLines(color, flags, pts, 6);
420  shp.SetMatrix(scaledMat);
421  if (output)
422  output.Insert(shp);
423  break;
424  }
425  case "J":
426  {
427  pts[0] = Vector(start, caseScale * 0.9, 0);
428  pts[1] = Vector(start + 0.6, caseScale * 0.9, 0);
429  pts[2] = Vector(start + 0.3, caseScale * 0.9, 0);
430  pts[3] = Vector(start + 0.3, caseScale * 0.1, 0);
431  pts[4] = Vector(start + 0.2, 0, 0);
432  pts[5] = Vector(start + 0.1, 0, 0);
433  pts[6] = Vector(start, caseScale * 0.1, 0);
434  pts[7] = Vector(start, caseScale * 0.3, 0);
435 
436  shp = Shape.CreateLines(color, flags, pts, 8);
437  shp.SetMatrix(scaledMat);
438  if (output)
439  output.Insert(shp);
440  break;
441  }
442  case "K":
443  {
444  pts[0] = Vector(start, 0, 0);
445  pts[1] = Vector(start, caseScale * 0.9, 0);
446  pts[2] = Vector(start, caseScale * 0.5, 0);
447  pts[3] = Vector(start + 0.2, caseScale * 0.5, 0);
448  pts[4] = Vector(start + 0.6, 0, 0);
449  pts[5] = pts[3];
450  pts[6] = Vector(start + 0.6, caseScale * 0.9, 0);
451  shp = Shape.CreateLines(color, flags, pts, 7);
452  shp.SetMatrix(scaledMat);
453  if (output)
454  output.Insert(shp);
455  break;
456  }
457  case "L":
458  {
459  pts[0] = Vector(start, caseScale * 0.9, 0);
460  pts[1] = Vector(start, 0, 0);
461  pts[2] = Vector(start + 0.6, 0, 0);
462  shp = Shape.CreateLines(color, flags, pts, 3);
463  shp.SetMatrix(scaledMat);
464  if (output)
465  output.Insert(shp);
466 
467  break;
468  }
469  case "M":
470  {
471  pts[0] = Vector(start, 0, 0);
472  pts[1] = Vector(start, caseScale * 0.9, 0);
473  pts[2] = Vector(start + 0.3, caseScale * 0.5, 0);
474  pts[3] = Vector(start + 0.6, caseScale * 0.9, 0);
475  pts[4] = Vector(start + 0.6, 0, 0);
476  shp = Shape.CreateLines(color, flags, pts, 5);
477  shp.SetMatrix(scaledMat);
478  if (output)
479  output.Insert(shp);
480 
481  break;
482  }
483  case "N":
484  {
485  pts[0] = Vector(start, 0, 0);
486  pts[1] = Vector(start, caseScale * 0.9, 0);
487  pts[2] = Vector(start + 0.6, 0, 0);
488  pts[3] = Vector(start + 0.6, caseScale * 0.9, 0);
489  shp = Shape.CreateLines(color, flags, pts, 4);
490  shp.SetMatrix(scaledMat);
491  if (output)
492  output.Insert(shp);
493 
494  break;
495  }
496  case "O":
497  {
498  pts[0][0] = start + 0.6; pts[0][1] = caseScale * 0.2;
499  pts[1][0] = start + 0.4; pts[1][1] = 0;
500  pts[2][0] = start + 0.2; pts[2][1] = 0;
501  pts[3][0] = start; pts[3][1] = caseScale * 0.2;
502  pts[4][0] = start; pts[4][1] = caseScale * 0.7;
503  pts[5][0] = start + 0.2; pts[5][1] = caseScale * 0.9;
504  pts[6][0] = start + 0.4; pts[6][1] = caseScale * 0.9;
505  pts[7][0] = start + 0.6; pts[7][1] = caseScale * 0.7;
506  pts[8] = pts[0];
507  shp = Shape.CreateLines(color, flags, pts, 9);
508  shp.SetMatrix(scaledMat);
509  if (output)
510  output.Insert(shp);
511 
512  break;
513  }
514  case "P":
515  {
516  pts[0] = Vector(start, 0, 0);
517  pts[1] = Vector(start, caseScale * 0.5, 0);
518  pts[2] = Vector(start, caseScale * 0.9, 0);
519  pts[3] = Vector(start + 0.4, caseScale * 0.9, 0);
520  pts[4] = Vector(start + 0.5, caseScale * 0.8, 0);
521  pts[5] = Vector(start + 0.5, caseScale * 0.6, 0);
522  pts[6] = Vector(start + 0.4, caseScale * 0.5, 0);
523  pts[7] = Vector(start, caseScale * 0.5, 0);
524  shp = Shape.CreateLines(color, flags, pts, 8);
525  shp.SetMatrix(scaledMat);
526  if (output)
527  output.Insert(shp);
528 
529  break;
530  }
531  case "Q":
532  {
533  pts[0] = Vector(start + 0.6, caseScale * 0.2, 0);
534  pts[1] = Vector(start + 0.4, 0, 0);
535  pts[2] = Vector(start + 0.2, 0, 0);
536  pts[3] = Vector(start, caseScale * 0.2, 0);
537  pts[4] = Vector(start, caseScale * 0.7, 0);
538  pts[5] = Vector(start + 0.2, caseScale * 0.9, 0);
539  pts[6] = Vector(start + 0.4, caseScale * 0.9, 0);
540  pts[7] = Vector(start + 0.6, caseScale * 0.7, 0);
541  pts[8] = pts[0];
542  shp = Shape.CreateLines(color, flags, pts, 9);
543  shp.SetMatrix(scaledMat);
544  if (output)
545  output.Insert(shp);
546 
547  pts[0] = Vector(start + 0.4, caseScale * 0.2, 0);
548  pts[1] = Vector(start + 0.6, 0, 0);
549  shp = Shape.CreateLines(color, flags, pts, 2);
550  shp.SetMatrix(scaledMat);
551  if (output)
552  output.Insert(shp);
553 
554  break;
555  }
556  case "R":
557  {
558  pts[0] = Vector(start, 0, 0);
559  pts[1] = Vector(start, caseScale * 0.5, 0);
560  pts[2] = Vector(start, caseScale * 0.9, 0);
561  pts[3] = Vector(start + 0.4, caseScale * 0.9, 0);
562  pts[4] = Vector(start + 0.5, caseScale * 0.8, 0);
563  pts[5] = Vector(start + 0.5, caseScale * 0.6, 0);
564  pts[6] = Vector(start + 0.4, caseScale * 0.5, 0);
565  pts[7] = Vector(start + 0.2, caseScale * 0.5, 0);
566  pts[8] = pts[1];
567  shp = Shape.CreateLines(color, flags, pts, 9);
568  shp.SetMatrix(scaledMat);
569  if (output)
570  output.Insert(shp);
571 
572  pts[0] = Vector(start + 0.2, caseScale * 0.5, 0);
573  pts[1] = Vector(start + 0.5, 0, 0);
574  shp = Shape.CreateLines(color, flags, pts, 2);
575  shp.SetMatrix(scaledMat);
576  if (output)
577  output.Insert(shp);
578 
579  break;
580  }
581  case "S":
582  {
583  pts[0] = Vector(start + 0.5, caseScale * 0.8, 0);
584  pts[1] = Vector(start + 0.4, caseScale * 0.9, 0);
585  pts[2] = Vector(start + 0.1, caseScale * 0.9, 0);
586  pts[3] = Vector(start, caseScale * 0.8, 0);
587  pts[4] = Vector(start, caseScale * 0.6, 0);
588  pts[5] = Vector(start + 0.1, caseScale * 0.5, 0);
589  pts[6] = Vector(start + 0.4, caseScale * 0.4, 0);
590  pts[7] = Vector(start + 0.5, caseScale * 0.3, 0);
591  pts[8] = Vector(start + 0.5, caseScale * 0.1, 0);
592  pts[9] = Vector(start + 0.4, 0, 0);
593  pts[10] = Vector(start + 0.1, 0, 0);
594  pts[11] = Vector(start, caseScale * 0.1, 0);
595  shp = Shape.CreateLines(color, flags, pts, 12);
596  shp.SetMatrix(scaledMat);
597  if (output)
598  output.Insert(shp);
599 
600  break;
601  }
602  case "T":
603  {
604  pts[0] = Vector(start, caseScale * 0.9, 0);
605  pts[1] = Vector(start + 0.6, caseScale * 0.9, 0);
606  pts[2] = Vector(start + 0.3, caseScale * 0.9, 0);
607  pts[3] = Vector(start + 0.3, 0, 0);
608  shp = Shape.CreateLines(color, flags, pts, 4);
609  shp.SetMatrix(scaledMat);
610  if (output)
611  output.Insert(shp);
612  break;
613  }
614  case "U":
615  {
616  pts[0] = Vector(start, caseScale * 0.9, 0);
617  pts[1] = Vector(start, caseScale * 0.2, 0);
618  pts[2] = Vector(start + 0.2, 0, 0);
619  pts[3] = Vector(start + 0.4, 0, 0);
620  pts[4] = Vector(start + 0.6, caseScale * 0.2, 0);
621  pts[5] = Vector(start + 0.6, caseScale * 0.9, 0);
622  shp = Shape.CreateLines(color, flags, pts, 6);
623  shp.SetMatrix(scaledMat);
624  if (output)
625  output.Insert(shp);
626 
627  break;
628  }
629  case "V":
630  {
631  pts[0] = Vector(start, caseScale * 0.9, 0);
632  pts[1] = Vector(start + 0.3, 0, 0);
633  pts[2] = Vector(start + 0.6, caseScale * 0.9, 0);
634  shp = Shape.CreateLines(color, flags, pts, 3);
635  shp.SetMatrix(scaledMat);
636  if (output)
637  output.Insert(shp);
638 
639  break;
640  }
641  case "W":
642  {
643  pts[0] = Vector(start, caseScale * 0.9, 0);
644  pts[1] = Vector(start + 0.1, 0, 0);
645  pts[2] = Vector(start + 0.3, caseScale * 0.4, 0);
646  pts[3] = Vector(start + 0.5, 0, 0);
647  pts[4] = Vector(start + 0.6, caseScale * 0.9, 0);
648  shp = Shape.CreateLines(color, flags, pts, 5);
649  shp.SetMatrix(scaledMat);
650  if (output)
651  output.Insert(shp);
652 
653  break;
654  }
655  case "X":
656  {
657  pts[0] = Vector(start, caseScale * 0.9, 0);
658  pts[1] = Vector(start + 0.3, caseScale * 0.45, 0);
659  pts[2] = Vector(start + 0.6, caseScale * 0.9, 0);
660  pts[3] = pts[1];
661  pts[4] = Vector(start, 0, 0);
662  pts[5] = pts[3];
663  pts[6] = Vector(start + 0.6, 0, 0);
664  shp = Shape.CreateLines(color, flags, pts, 7);
665  shp.SetMatrix(scaledMat);
666  if (output)
667  output.Insert(shp);
668  break;
669  }
670  case "Y":
671  {
672  pts[0] = Vector(start, caseScale * 0.9, 0);
673  pts[1] = Vector(start + 0.3, caseScale * 0.5, 0);
674  pts[2] = Vector(start + 0.6, caseScale * 0.9, 0);
675  pts[3] = pts[1];
676  pts[4] = Vector(start + 0.3, 0, 0);
677  shp = Shape.CreateLines(color, flags, pts, 5);
678  shp.SetMatrix(scaledMat);
679  if (output)
680  output.Insert(shp);
681  break;
682  }
683  case "Z":
684  {
685  pts[0] = Vector(start, caseScale * 0.9, 0);
686  pts[1] = Vector(start + 0.6, caseScale * 0.9, 0);
687  pts[2] = Vector(start, 0, 0);
688  pts[3] = Vector(start + 0.6, 0, 0);
689  shp = Shape.CreateLines(color, flags, pts, 4);
690  shp.SetMatrix(scaledMat);
691  if (output)
692  output.Insert(shp);
693 
694  break;
695  }
696 
697  // Numbers --------------------------------------------
698  case "0":
699  {
700  pts[0][0] = start + 0.5; pts[0][1] = 0.7;
701  pts[1][0] = start + 0.4; pts[1][1] = 0.9;
702  pts[2][0] = start + 0.2; pts[2][1] = 0.9;
703  pts[3][0] = start + 0.1; pts[3][1] = 0.7;
704  pts[4][0] = start + 0.1; pts[4][1] = 0.2;
705  pts[5][0] = start + 0.2; pts[5][1] = 0;
706  pts[6][0] = start + 0.4; pts[6][1] = 0;
707  pts[7][0] = start + 0.5; pts[7][1] = 0.2;
708  pts[8][0] = start + 0.5; pts[8][1] = 0.7;
709  pts[9] = pts[4];
710  shp = Shape.CreateLines(color, flags, pts, 10);
711  shp.SetMatrix(scaledMat);
712  if (output)
713  output.Insert(shp);
714 
715  break;
716  }
717  case "1":
718  {
719  pts[0] = Vector(start + 0.1, 0.7, 0);
720  pts[1] = Vector(start + 0.3, 0.9, 0);
721  pts[2] = Vector(start + 0.3, 0, 0);
722  pts[3] = Vector(start + 0.1, 0, 0);
723  pts[4] = Vector(start + 0.5, 0, 0);
724  shp = Shape.CreateLines(color, flags, pts, 5);
725  shp.SetMatrix(scaledMat);
726  if (output)
727  output.Insert(shp);
728  break;
729  }
730  case "2":
731  {
732  pts[0] = Vector(start + 0.1, 0.7, 0);
733  pts[1] = Vector(start + 0.2, 0.9, 0);
734  pts[2] = Vector(start + 0.4, 0.9, 0);
735  pts[3] = Vector(start + 0.5, 0.7, 0);
736  pts[4] = Vector(start + 0.1, 0, 0);
737  pts[5] = Vector(start + 0.5, 0, 0);
738  shp = Shape.CreateLines(color, flags, pts, 6);
739  shp.SetMatrix(scaledMat);
740  if (output)
741  output.Insert(shp);
742 
743  break;
744  }
745  case "3":
746  {
747  pts[0] = Vector(start + 0.1, 0.7, 0);
748  pts[1] = Vector(start + 0.2, 0.9, 0);
749  pts[2] = Vector(start + 0.4, 0.9, 0);
750  pts[3] = Vector(start + 0.5, 0.7, 0);
751  pts[4] = Vector(start + 0.4, 0.45, 0);
752  pts[5] = Vector(start + 0.3, 0.45, 0);
753  shp = Shape.CreateLines(color, flags, pts, 6);
754  shp.SetMatrix(scaledMat);
755  if (output)
756  output.Insert(shp);
757 
758  pts[0] = Vector(start + 0.4, 0.45, 0);
759  pts[1] = Vector(start + 0.5, 0.2, 0);
760  pts[2] = Vector(start + 0.4, 0, 0);
761  pts[3] = Vector(start + 0.2, 0, 0);
762  pts[4] = Vector(start + 0.1, 0.2, 0);
763  shp = Shape.CreateLines(color, flags, pts, 5);
764  shp.SetMatrix(scaledMat);
765  if (output)
766  output.Insert(shp);
767 
768  break;
769  }
770  case "4":
771  {
772  pts[0] = Vector(start + 0.4, 0, 0);
773  pts[1] = Vector(start + 0.4, 0.4, 0);
774  pts[2] = Vector(start + 0.4, 0.9, 0);
775  pts[3] = Vector(start + 0.1, 0.4, 0);
776  pts[4] = Vector(start + 0.4, 0.4, 0);
777  pts[5] = Vector(start + 0.5, 0.4, 0);
778  shp = Shape.CreateLines(color, flags, pts, 6);
779  shp.SetMatrix(scaledMat);
780  if (output)
781  output.Insert(shp);
782 
783  break;
784  }
785  case "5":
786  {
787  pts[0] = Vector(start + 0.5, 0.9, 0);
788  pts[1] = Vector(start + 0.1, 0.9, 0);
789  pts[2] = Vector(start + 0.1, 0.5, 0);
790  pts[3] = Vector(start + 0.4, 0.5, 0);
791  pts[4] = Vector(start + 0.5, 0.3, 0);
792  pts[5] = Vector(start + 0.5, 0.2, 0);
793  pts[6] = Vector(start + 0.4, 0, 0);
794  pts[7] = Vector(start + 0.2, 0, 0);
795  pts[8] = Vector(start + 0.1, 0.2, 0);
796  shp = Shape.CreateLines(color, flags, pts, 9);
797  shp.SetMatrix(scaledMat);
798  if (output)
799  output.Insert(shp);
800 
801  break;
802  }
803  case "6":
804  {
805  pts[0] = Vector(start + 0.4, 0.9, 0);
806  pts[1] = Vector(start + 0.2, 0.9, 0);
807  pts[2] = Vector(start + 0.1, 0.7, 0);
808  pts[3] = Vector(start + 0.1, 0.3, 0);
809  pts[4] = Vector(start + 0.1, 0.2, 0);
810  pts[5] = Vector(start + 0.2, 0, 0);
811  pts[6] = Vector(start + 0.4, 0, 0);
812  pts[7] = Vector(start + 0.5, 0.2, 0);
813  pts[8] = Vector(start + 0.5, 0.3, 0);
814  pts[9] = Vector(start + 0.4, 0.5, 0);
815  pts[10] = Vector(start + 0.2, 0.5, 0);
816  pts[11] = pts[3];
817  shp = Shape.CreateLines(color, flags, pts, 12);
818  shp.SetMatrix(scaledMat);
819  if (output)
820  output.Insert(shp);
821 
822  break;
823  }
824  case "7":
825  {
826  pts[0] = Vector(start + 0.1, 0.9, 0);
827  pts[1] = Vector(start + 0.5, 0.9, 0);
828  pts[2] = Vector(start + 0.3, 0, 0);
829  shp = Shape.CreateLines(color, flags, pts, 3);
830  shp.SetMatrix(scaledMat);
831  if (output)
832  output.Insert(shp);
833 
834  break;
835  }
836  case "8":
837  {
838  pts[0] = Vector(start + 0.4, 0.9, 0);
839  pts[1] = Vector(start + 0.2, 0.9, 0);
840  pts[2] = Vector(start + 0.1, 0.7, 0);
841  pts[3] = Vector(start + 0.2, 0.5, 0);
842  pts[4] = Vector(start + 0.4, 0.5, 0);
843  pts[5] = Vector(start + 0.5, 0.7, 0);
844  pts[6] = pts[0];
845  shp = Shape.CreateLines(color, flags, pts, 7);
846  shp.SetMatrix(scaledMat);
847  if (output)
848  output.Insert(shp);
849 
850  pts[0] = Vector(start + 0.2, 0.5, 0);
851  pts[1] = Vector(start + 0.1, 0.3, 0);
852  pts[2] = Vector(start + 0.1, 0.2, 0);
853  pts[3] = Vector(start + 0.2, 0, 0);
854  pts[4] = Vector(start + 0.4, 0, 0);
855  pts[5] = Vector(start + 0.5, 0.2, 0);
856  pts[6] = Vector(start + 0.5, 0.3, 0);
857  pts[7] = Vector(start + 0.4, 0.5, 0);
858  shp = Shape.CreateLines(color, flags, pts, 8);
859  shp.SetMatrix(scaledMat);
860  if (output)
861  output.Insert(shp);
862 
863  break;
864  }
865  case "9":
866  {
867  pts[0] = Vector(start + 0.5, 0.6, 0);
868  pts[1] = Vector(start + 0.4, 0.4, 0);
869  pts[2] = Vector(start + 0.2, 0.4, 0);
870  pts[3] = Vector(start + 0.1, 0.6, 0);
871  pts[4] = Vector(start + 0.1, 0.7, 0);
872  pts[5] = Vector(start + 0.2, 0.9, 0);
873  pts[6] = Vector(start + 0.4, 0.9, 0);
874  pts[7] = Vector(start + 0.5, 0.7, 0);
875  pts[8] = Vector(start + 0.5, 0.6, 0);
876  pts[9] = Vector(start + 0.5, 0.4, 0);
877  pts[10] = Vector(start + 0.5, 0.2, 0);
878  pts[11] = Vector(start + 0.4, 0, 0);
879  pts[12] = Vector(start + 0.2, 0, 0);
880  pts[13] = Vector(start + 0.1, 0.2, 0);
881  shp = Shape.CreateLines(color, flags, pts, 14);
882  shp.SetMatrix(scaledMat);
883  if (output)
884  output.Insert(shp);
885 
886  break;
887  }
888 
889  // Special --------------------------------------------
890  case "_":
891  {
892  pts[0] = Vector(start, 0.1, 0);
893  pts[1] = Vector(start + 0.6, 0.1, 0);
894  shp = Shape.CreateLines(color, flags, pts, 2);
895  shp.SetMatrix(scaledMat);
896  if (output)
897  output.Insert(shp);
898 
899  break;
900  }
901  case "-":
902  {
903  pts[0] = Vector(start + 0.1, 0.45, 0);
904  pts[1] = Vector(start + 0.5, 0.45, 0);
905  shp = Shape.CreateLines(color, flags, pts, 2);
906  shp.SetMatrix(scaledMat);
907  if (output)
908  output.Insert(shp);
909 
910  break;
911  }
912  case "+":
913  {
914  pts[0] = Vector(start + 0.1, 0.45, 0);
915  pts[1] = Vector(start + 0.5, 0.45, 0);
916  pts[2] = Vector(start + 0.3, 0.45, 0);
917  pts[3] = Vector(start + 0.3, 0.25, 0);
918  pts[4] = Vector(start + 0.3, 0.65, 0);
919  shp = Shape.CreateLines(color, flags, pts, 5);
920  shp.SetMatrix(scaledMat);
921  if (output)
922  output.Insert(shp);
923  break;
924  }
925  case ".":
926  {
927  pts[0] = Vector(start + 0.3, 0, 0);
928  pts[1] = Vector(start + 0.3, 0.05, 0);
929  pts[2] = Vector(start + 0.25, 0.05, 0);
930  pts[3] = Vector(start + 0.25, 0, 0);
931  pts[4] = pts[0];
932  shp = Shape.CreateLines(color, flags, pts, 5);
933  shp.SetMatrix(scaledMat);
934  if (output)
935  output.Insert(shp);
936 
937  break;
938  }
939  case ":":
940  {
941  pts[0] = Vector(start + 0.3, 0.1, 0);
942  pts[1] = Vector(start + 0.3, 0.15, 0);
943  pts[2] = Vector(start + 0.25, 0.15, 0);
944  pts[3] = Vector(start + 0.25, 0.1, 0);
945  pts[4] = pts[0];
946  shp = Shape.CreateLines(color, flags, pts, 5);
947  shp.SetMatrix(scaledMat);
948  if (output)
949  output.Insert(shp);
950 
951  pts[0] = Vector(start + 0.3, 0.6, 0);
952  pts[1] = Vector(start + 0.3, 0.65, 0);
953  pts[2] = Vector(start + 0.25, 0.65, 0);
954  pts[3] = Vector(start + 0.25, 0.6, 0);
955  pts[4] = pts[0];
956  shp = Shape.CreateLines(color, flags, pts, 5);
957  shp.SetMatrix(scaledMat);
958  if (output)
959  output.Insert(shp);
960 
961  break;
962  }
963  case "!":
964  {
965  pts[0] = Vector(start + 0.3, 0.3, 0);
966  pts[1] = Vector(start + 0.3, 0.9, 0);
967  pts[2] = Vector(start + 0.25, 0.9, 0);
968  pts[3] = Vector(start + 0.25, 0.3, 0);
969  pts[4] = pts[0];
970  shp = Shape.CreateLines(color, flags, pts, 5);
971  shp.SetMatrix(scaledMat);
972  if (output)
973  output.Insert(shp);
974 
975  pts[0] = Vector(start + 0.3, 0, 0);
976  pts[1] = Vector(start + 0.3, 0.05, 0);
977  pts[2] = Vector(start + 0.25, 0.05, 0);
978  pts[3] = Vector(start + 0.25, 0, 0);
979  pts[4] = pts[0];
980  shp = Shape.CreateLines(color, flags, pts, 5);
981  shp.SetMatrix(scaledMat);
982  if (output)
983  output.Insert(shp);
984 
985  break;
986  }
987  case ",":
988  {
989  pts[0] = Vector(start + 0.3, 0, 0);
990  pts[1] = Vector(start + 0.2, 0, 0);
991  pts[2] = Vector(start + 0.1, -0.2, 0);
992  pts[3] = Vector(start + 0.2, -0.2, 0);
993  pts[4] = pts[0];
994  shp = Shape.CreateLines(color, flags, pts, 5);
995  shp.SetMatrix(scaledMat);
996  if (output)
997  output.Insert(shp);
998 
999  break;
1000  }
1001  case "'":
1002  {
1003  pts[0] = Vector(start + 0.4, 0.9, 0);
1004  pts[1] = Vector(start + 0.25, 0.9, 0);
1005  pts[2] = Vector(start + 0.3, 0.6, 0);
1006  pts[3] = Vector(start + 0.35, 0.6, 0);
1007  pts[4] = pts[0];
1008  shp = Shape.CreateLines(color, flags, pts, 5);
1009  shp.SetMatrix(scaledMat);
1010  if (output)
1011  output.Insert(shp);
1012 
1013  break;
1014  }
1015  case "/":
1016  {
1017  pts[0] = Vector(start + 0.54, 0.9, 0);
1018  pts[1] = Vector(start + 0.25, 0, 0);
1019  shp = Shape.CreateLines(color, flags, pts, 2);
1020  shp.SetMatrix(scaledMat);
1021  if (output)
1022  output.Insert(shp);
1023 
1024  break;
1025  }
1026  case "%":
1027  {
1028  pts[0] = Vector(start + 0.55, 0.9, 0);
1029  pts[1] = Vector(start + 0.25, 0, 0);
1030  shp = Shape.CreateLines(color, flags, pts, 2);
1031  shp.SetMatrix(scaledMat);
1032  if (output)
1033  output.Insert(shp);
1034 
1035  pts[0] = Vector(start + 0.2, 0.5, 0);
1036  pts[1] = Vector(start + 0.05, 0.7, 0);
1037  pts[2] = Vector(start + 0.2, 0.9, 0);
1038  pts[3] = Vector(start + 0.35, 0.7, 0);
1039  pts[4] = pts[0];
1040  shp = Shape.CreateLines(color, flags, pts, 5);
1041  shp.SetMatrix(scaledMat);
1042  if (output)
1043  output.Insert(shp);
1044 
1045  pts[0] = Vector(start + 0.6, 0.1, 0);
1046  pts[1] = Vector(start + 0.45, 0.3, 0);
1047  pts[2] = Vector(start + 0.6, 0.5, 0);
1048  pts[3] = Vector(start + 0.75, 0.3, 0);
1049  pts[4] = pts[0];
1050  shp = Shape.CreateLines(color, flags, pts, 5);
1051  shp.SetMatrix(scaledMat);
1052  if (output)
1053  output.Insert(shp);
1054 
1055  break;
1056  }
1057  }
1058  }
1059 
1060  /*
1061  vector pts[53];
1062  for (int i = 0; i < subdivisions; i++)
1063  {
1064  int ptIndex = i + 1;
1065  vector pt = vector.YawToVector(sectionDeg * i + angMin) * radius;
1066  pt = Vector(-pt[0], 0, pt[1]); // Convert from Enforce to Enfusion format
1067  pt = pt.Multiply3(mat);
1068  pts[ptIndex] = pt + pos;
1069  }
1070  subdivisions += 2;
1071  pts[0] = pos;
1072  pts[subdivisions - 1] = pos;
1073 
1074  return Shape.CreateLines(color, flags, pts, subdivisions); */
1075 }
ShowBoneDebug
void ShowBoneDebug(IEntity ent, int bone, float scale)
Definition: DebugShapes.c:7
CreateArrowLinkLines
void CreateArrowLinkLines(vector from, vector to, vector faceDir, float size, int numArrows, int color, ShapeFlags flags)
Definition: DebugShapes.c:202
CreateCircle
Shape CreateCircle(vector pos, vector aroundDir, float radius, int color, int subdivisions, ShapeFlags flags)
Definition: DebugShapes.c:83
CreateSimpleText
void CreateSimpleText(string text, vector mat[4], float size, int color, ShapeFlags flags, array< ref Shape > output=null, float scaleWidth=1, bool doBackground=false, int backgroundColor=0x80000000)
Definition: DebugShapes.c:236
CreateCircleArc
Shape CreateCircleArc(vector pos, vector aroundDir, vector forwardDir, float angMin, float angMax, float radius, int color, int subdivisions, ShapeFlags flags)
Definition: DebugShapes.c:119
CreateCircleSlice
Shape CreateCircleSlice(vector pos, vector aroundDir, vector forwardDir, float angMin, float angMax, float radius, int color, int subdivisions, ShapeFlags flags)
Definition: DebugShapes.c:165
CreateCone
Shape CreateCone(vector pos, vector aroundDir, float coneAngX, float coneAngY, float coneLength, int color, int subdivisions, ShapeFlags flags)
Definition: DebugShapes.c:30