3 protected ref set<ref Shape>
m_Shapes =
new set<ref Shape>();
4 protected ref set<ref DebugTextWorldSpace>
m_ScreenSpaceTexts =
new set<ref DebugTextWorldSpace>();
36 vector points[2] = { from, to };
49 int count = points.Count();
57 for (
int i; i < count; i++)
59 pointsS[i] = points[i];
78 customSize =
vector.Distance(from, to) * 0.333;
108 if (coveredAngleRad < 0)
110 angleStartRad += coveredAngleRad;
111 coveredAngleRad = -coveredAngleRad;
114 if (angleStartRad < 0 || angleStartRad >
Math.PI2)
115 angleStartRad =
Math.Repeat(angleStartRad,
Math.PI2);
117 if ( coveredAngleRad >
Math.PI2)
118 coveredAngleRad =
Math.Repeat(coveredAngleRad,
Math.PI2);
120 vector forward = {
Math.Cos(angleStartRad), 0,
Math.Sin(angleStartRad) };
137 if (coveredAngleRad < 0)
139 angleStartRad -= coveredAngleRad;
140 coveredAngleRad *= -1;
143 if (angleStartRad < 0 || angleStartRad >
Math.PI2)
144 angleStartRad =
Math.Repeat(angleStartRad,
Math.PI2);
146 if (coveredAngleRad < 0 || coveredAngleRad >
Math.PI2)
147 coveredAngleRad =
Math.Repeat(coveredAngleRad,
Math.PI2);
149 vector forward = {
Math.Cos(angleStartRad), 0,
Math.Sin(angleStartRad) };
151 float angleDeg = coveredAngleRad *
Math.RAD2DEG;
167 vector endPos = origin + vectorDir.Normalized() * length;
171 float directionRad =
Math.Atan2(vectorDir[2], vectorDir[0]);
172 vector leftWidth = {
Math.Cos(directionRad +
Math.PI_HALF) * width, 0,
Math.Sin(directionRad +
Math.PI_HALF) * width };
173 vector rightWidth = {
Math.Cos(directionRad -
Math.PI_HALF) * width, 0,
Math.Sin(directionRad -
Math.PI_HALF) * width };
196 points[0] =
Vector(min[0], min[1], max[2]);
197 points[1] =
Vector(max[0], max[1], max[2]);
198 points[2] =
Vector(max[0], max[1], min[2]);
199 points[3] =
Vector(min[0], min[1], min[2]);
200 points[4] =
Vector(min[0], min[1], max[2]);
216 vector endPos = origin + {
Math.Cos(directionRad) * length, 0,
Math.Sin(directionRad) * length };
219 vector leftWidth = {
Math.Cos(directionRad +
Math.PI_HALF) * width, 0,
Math.Sin(directionRad +
Math.PI_HALF) * width };
220 vector rightWidth = {
Math.Cos(directionRad -
Math.PI_HALF) * width, 0,
Math.Sin(directionRad -
Math.PI_HALF) * width };
244 vector endPos = origin + vectorDir.Normalized() * length;
247 float directionRad =
Math.Atan2(vectorDir[2], vectorDir[0]);
248 vector leftWidth = {
Math.Cos(directionRad +
Math.PI_HALF) * width, 0,
Math.Sin(directionRad +
Math.PI_HALF) * width };
249 vector rightWidth = {
Math.Cos(directionRad -
Math.PI_HALF) * width, 0,
Math.Sin(directionRad -
Math.PI_HALF) * width };
252 AddLine(origin + leftWidth, endPos + leftWidth, colour),
253 AddLine(origin + rightWidth, endPos + rightWidth, colour),
269 int lastId = boundsPositionsWorldSpace.Count() - 1;
270 vector heightOffset = upDirection * height;
277 nextPosition = boundsPositionsWorldSpace[i + 1];
279 nextPosition = boundsPositionsWorldSpace[0];
281 verts[numberOfVerts] = nextPosition + heightOffset;
283 verts[numberOfVerts] = nextPosition;
287 verts[numberOfVerts] =
position + heightOffset;
289 verts[numberOfVerts] = nextPosition + heightOffset;
293 Shape shape =
Shape.CreateLines(colour,
ShapeFlags.DEFAULT | additionalFlags, verts, numberOfVerts);
324 if (subdivisions < 2)
327 if (subdivisions > 50)
330 vector forward = directionUp.Perpend();
333 vector right = directionUp * forward;
336 vector mat[3] = { right, directionUp, forward };
338 float sectionDeg = 360 / subdivisions;
344 vector bigBasePos = centerOfTopBasePos +
vector.Up.Multiply3(mat) * height;
345 for (
int i; i < subdivisions; i++)
347 point =
vector.FromYaw(sectionDeg * i) * smallBaseRadius;
348 point = point.Multiply3(mat);
349 points[pointsCount] = point + centerOfTopBasePos;
352 point =
vector.FromYaw(sectionDeg * i) * largeBaseRadius;
353 point = point.Multiply3(mat);
354 points[pointsCount] = point + bigBasePos;
357 point =
vector.FromYaw(sectionDeg * (i + 1)) * largeBaseRadius;
358 point = point.Multiply3(mat);
359 points[pointsCount] = point + bigBasePos;
362 points[pointsCount] = points[pointsCount - 2];
365 points[pointsCount] = points[pointsCount - 4];
368 point =
vector.FromYaw(sectionDeg * (i + 1)) * smallBaseRadius;
369 point = point.Multiply3(mat);
370 points[pointsCount] = point + centerOfTopBasePos;
390 WorldEditor worldEditor = Workbench.GetModule(WorldEditor);
391 BaseWorld world = worldEditor.GetApi().GetWorld();
398 Print(
"[SCR_DebugShapeManager.AddText] cannot determine world (" + __FILE__ +
" L" + __LINE__ +
")",
LogLevel.WARNING);
Shape CreateCircleSlice(vector pos, vector aroundDir, vector forwardDir, float angMin, float angMax, float radius, int color, int subdivisions, ShapeFlags flags)
Shape CreateCircle(vector pos, vector aroundDir, float radius, int color, int subdivisions, ShapeFlags flags)
Shape CreateCircleArc(vector pos, vector aroundDir, vector forwardDir, float angMin, float angMax, float radius, int color, int subdivisions, ShapeFlags flags)
ArmaReforgerScripted GetGame()
Shape AddArrow(vector from, vector to, float customSize=0, int colour=DEFAULT_SHAPE_COLOUR, ShapeFlags additionalFlags=0)
void Remove(notnull DebugTextWorldSpace text)
void Add(notnull Shape shape)
ref set< ref Shape > m_Shapes
void Clear()
Remove all stored shapes and texts.
void Remove(notnull Shape shape)
Shape AddRectangleXZ(vector origin, float directionRad, float length, float width, int colour=DEFAULT_SHAPE_COLOUR)
static const DebugTextFlags DEFAULT_TEXT_FLAGS
Shape AddLine(vector from, vector to, int colour=DEFAULT_SHAPE_COLOUR, ShapeFlags additionalFlags=0)
array< ref Shape > AddParallelLines(vector origin, vector vectorDir, float length, float width, int colour=DEFAULT_SHAPE_COLOUR)
DebugTextWorldSpace AddText(string text, vector worldPos, float size=2.0, int colour=DEFAULT_TEXT_COLOUR, int backgroundColour=DEFAULT_TEXT_BACKGROUND_COLOUR)
Shape AddAABBRectangleXZ(vector min, vector max, int colour=DEFAULT_SHAPE_COLOUR)
void Add(notnull DebugTextWorldSpace text)
Shape AddPolyLine(notnull array< vector > points, int colour=DEFAULT_SHAPE_COLOUR)
Shape AddRectangle(vector origin, vector vectorDir, float length, float width, int colour=DEFAULT_SHAPE_COLOUR)
Shape AddBBox(vector min, vector max, int colour=DEFAULT_SHAPE_COLOUR, ShapeFlags additionalFlags=0)
ref set< ref DebugTextWorldSpace > m_ScreenSpaceTexts
static const ShapeFlags DEFAULT_SHAPE_FLAGS
Shape AddTrapezoidalPrism(vector centerOfTopBasePos, vector directionUp, float smallBaseRadius, float largeBaseRadius, float height, int subdivisions=6, int colour=DEFAULT_SHAPE_COLOUR, ShapeFlags additionalFlags=0)
static const int DEFAULT_TEXT_COLOUR
static const int DEFAULT_TEXT_BACKGROUND_COLOUR
static const int DEFAULT_SHAPE_COLOUR
Shape AddCircleArcXZ(vector centre, float angleStartRad, float coveredAngleRad, float radius, int colour=DEFAULT_SHAPE_COLOUR)
void ClearTexts()
Remove all stored texts.
Shape AddSphere(vector centre, float radius, int colour=DEFAULT_SHAPE_COLOUR, ShapeFlags additionalFlags=0)
Shape AddBounds(notnull array< vector > boundsPositionsWorldSpace, float height, vector upDirection=vector.Up, int colour=DEFAULT_SHAPE_COLOUR, ShapeFlags additionalFlags=0)
Shape AddCircleSliceXZ(vector centre, float angleStartRad, float coveredAngleRad, float radius, int colour=DEFAULT_SHAPE_COLOUR)
Shape AddCircleXZ(vector centre, float radius, int colour=DEFAULT_SHAPE_COLOUR)
void ClearShapes()
Remove all stored shapes.
Instance of created debug visualizer.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
proto native vector Vector(float x, float y, float z)