Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ PrepareStripWithProceduralPadding()

void Terraria.Graphics.VertexStrip.PrepareStripWithProceduralPadding ( Vector2[] positions,
float[] rotations,
StripColorFunction colorFunction,
StripHalfWidthFunction widthFunction,
Vector2 offsetForAllPositions = default(Vector2),
bool includeBacksides = false,
bool tryStoppingOddBug = true )
inline

Definition at line 76 of file VertexStrip.cs.

77 {
78 int num = positions.Length;
81 for (int i = 0; i < num && !(positions[i] == Vector2.Zero); i++)
82 {
87 if (i + 1 >= num || !(positions[i + 1] != Vector2.Zero))
88 {
89 continue;
90 }
92 float num3 = MathHelper.WrapAngle(rotations[i + 1]);
93 int num4 = (int)(Math.Abs(MathHelper.WrapAngle(num3 - num2)) / ((float)Math.PI / 12f));
94 if (num4 != 0)
95 {
96 float num5 = vector.Distance(vector2);
97 Vector2 value = vector + num2.ToRotationVector2() * num5;
98 Vector2 value2 = vector2 + num3.ToRotationVector2() * (0f - num5);
99 int num6 = num4 + 2;
100 float num7 = 1f / (float)num6;
101 Vector2 target = vector;
102 for (float num8 = num7; num8 < 1f; num8 += num7)
103 {
105 float item = MathHelper.WrapAngle(vector3.DirectionTo(target).ToRotation());
108 target = vector3;
109 }
110 }
111 }
114 for (int j = 0; j < count && (!tryStoppingOddBug || !(_temporaryPositionsCache[j] == zero)); j++)
115 {
118 int indexOnVertexArray = j * 2;
119 float progressOnStrip = (float)j / (float)(count - 1);
121 }
124 }
static float WrapAngle(float angle)
Definition MathHelper.cs:87
static double Abs(double value)
List< Vector2 > _temporaryPositionsCache
void AddVertex(StripColorFunction colorFunction, StripHalfWidthFunction widthFunction, Vector2 pos, float rot, int indexOnVertexArray, float progressOnStrip)
void PrepareIndices(int vertexPaidsAdded, bool includeBacksides)
List< float > _temporaryRotationsCache
static Vector2 CatmullRom(Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount)
Definition Vector2.cs:273

References Terraria.Graphics.VertexStrip._temporaryPositionsCache, Terraria.Graphics.VertexStrip._temporaryRotationsCache, Terraria.Graphics.VertexStrip._vertexAmountCurrentlyMaintained, System.Math.Abs(), System.Collections.Generic.List< T >.Add(), Terraria.Graphics.VertexStrip.AddVertex(), Microsoft.Xna.Framework.Vector2.CatmullRom(), System.Collections.Generic.List< T >.Clear(), System.count, System.Collections.Generic.List< T >.Count, System.item, Terraria.Graphics.VertexStrip.PrepareIndices(), System.value, Microsoft.Xna.Framework.MathHelper.WrapAngle(), and Microsoft.Xna.Framework.Vector2.Zero.