// Token: 0x060005A5 RID: 1445 RVA: 0x0001BC64 File Offset: 0x00019E64 public void PrepareStrip(Vector2[] positions, float[] rotations, VertexStrip.StripColorFunction colorFunction, VertexStrip.StripHalfWidthFunction widthFunction, Vector2 offsetForAllPositions = default(Vector2), int?expectedVertexPairsAmount = null, bool includeBacksides = false) { int num = positions.Length; int num2 = this._vertexAmountCurrentlyMaintained = num * 2; if (this._vertices.Length < num2) { Array.Resize <VertexStrip.CustomVertexInfo>(ref this._vertices, num2); } int num3 = num; if (expectedVertexPairsAmount != null) { num3 = expectedVertexPairsAmount.Value; } for (int i = 0; i < num; i++) { if (positions[i] == Vector2.Zero) { num = i - 1; this._vertexAmountCurrentlyMaintained = num * 2; break; } Vector2 pos = positions[i] + offsetForAllPositions; float rot = MathHelper.WrapAngle(rotations[i]); int indexOnVertexArray = i * 2; float progressOnStrip = (float)i / (float)(num3 - 1); this.AddVertex(colorFunction, widthFunction, pos, rot, indexOnVertexArray, progressOnStrip); } this.PrepareIndices(num, includeBacksides); }
public FinalFractalProfile(float fullBladeLength, Color color) { this.trailWidth = fullBladeLength / 2f; this.trailColor = color; this.widthMethod = (VertexStrip.StripHalfWidthFunction)null; this.colorMethod = (VertexStrip.StripColorFunction)null; this.dustMethod = (FinalFractalHelper.SpawnDustMethod)null; this.widthMethod = new VertexStrip.StripHalfWidthFunction(this.StripWidth); this.colorMethod = new VertexStrip.StripColorFunction(this.StripColors); this.dustMethod = new FinalFractalHelper.SpawnDustMethod(this.StripDust); }
public ZenithProfileType(float fullBladeLength, Color color) { trailWidth = fullBladeLength / 2f; trailColor = color; widthMethod = null; colorMethod = null; dustMethod = null; widthMethod = StripWidth; colorMethod = StripColors; dustMethod = StripDust; }
public void PrepareStripWithProceduralPadding( Vector2[] positions, float[] rotations, VertexStrip.StripColorFunction colorFunction, VertexStrip.StripHalfWidthFunction widthFunction, Vector2 offsetForAllPositions = default(Vector2), bool includeBacksides = false) { int length = positions.Length; this._temporaryPositionsCache.Clear(); this._temporaryRotationsCache.Clear(); for (int index = 0; index < length && !(positions[index] == Vector2.Zero); ++index) { Vector2 position1 = positions[index]; float f1 = MathHelper.WrapAngle(rotations[index]); this._temporaryPositionsCache.Add(position1); this._temporaryRotationsCache.Add(f1); if (index + 1 < length && positions[index + 1] != Vector2.Zero) { Vector2 position2 = positions[index + 1]; float f2 = MathHelper.WrapAngle(rotations[index + 1]); int num1 = (int)((double)Math.Abs(MathHelper.WrapAngle(f2 - f1)) / 0.261799395084381); if (num1 != 0) { float num2 = position1.Distance(position2); Vector2 vector2_1 = position1 + f1.ToRotationVector2() * num2; Vector2 vector2_2 = position2 + f2.ToRotationVector2() * -num2; float num3 = 1f / (float)(num1 + 2); Vector2 Target = position1; for (float amount = num3; (double)amount < 1.0; amount += num3) { Vector2 Origin = Vector2.CatmullRom(vector2_1, position1, position2, vector2_2, amount); float num4 = MathHelper.WrapAngle(Origin.DirectionTo(Target).ToRotation()); this._temporaryPositionsCache.Add(Origin); this._temporaryRotationsCache.Add(num4); Target = Origin; } } } } int count = this._temporaryPositionsCache.Count; for (int index = 0; index < count; ++index) { Vector2 pos = this._temporaryPositionsCache[index] + offsetForAllPositions; float rot = this._temporaryRotationsCache[index]; int indexOnVertexArray = index * 2; float progressOnStrip = (float)index / (float)(count - 1); this.AddVertex(colorFunction, widthFunction, pos, rot, indexOnVertexArray, progressOnStrip); } this._vertexAmountCurrentlyMaintained = count * 2; this.PrepareIndices(count, includeBacksides); }
public FinalFractalProfile(float fullBladeLength, Color color) { trailWidth = fullBladeLength / 2f; trailColor = color; widthMethod = null; colorMethod = null; dustMethod = null; widthMethod = StripWidth; colorMethod = StripColors; dustMethod = StripDust; }
// Token: 0x060005A8 RID: 1448 RVA: 0x0001C038 File Offset: 0x0001A238 private void AddVertex(VertexStrip.StripColorFunction colorFunction, VertexStrip.StripHalfWidthFunction widthFunction, Vector2 pos, float rot, int indexOnVertexArray, float progressOnStrip) { while (indexOnVertexArray + 1 >= this._vertices.Length) { Array.Resize <VertexStrip.CustomVertexInfo>(ref this._vertices, this._vertices.Length * 2); } Color color = colorFunction(progressOnStrip); float num = widthFunction(progressOnStrip); Vector2 value = Utils.ToRotationVector2(MathHelper.WrapAngle(rot - 1.5707964f)) * num; this._vertices[indexOnVertexArray].Position = pos + value; this._vertices[indexOnVertexArray + 1].Position = pos - value; this._vertices[indexOnVertexArray].TexCoord = new Vector3(progressOnStrip, num, num); this._vertices[indexOnVertexArray + 1].TexCoord = new Vector3(progressOnStrip, 0f, num); this._vertices[indexOnVertexArray].Color = color; this._vertices[indexOnVertexArray + 1].Color = color; }
public void PrepareStrip( Vector2[] positions, float[] rotations, VertexStrip.StripColorFunction colorFunction, VertexStrip.StripHalfWidthFunction widthFunction, Vector2 offsetForAllPositions = default(Vector2), int?expectedVertexPairsAmount = null, bool includeBacksides = false) { int vertexPaidsAdded = positions.Length; int newSize = vertexPaidsAdded * 2; this._vertexAmountCurrentlyMaintained = newSize; if (this._vertices.Length < newSize) { Array.Resize <VertexStrip.CustomVertexInfo>(ref this._vertices, newSize); } int num = vertexPaidsAdded; if (expectedVertexPairsAmount.HasValue) { num = expectedVertexPairsAmount.Value; } for (int index = 0; index < vertexPaidsAdded; ++index) { if (positions[index] == Vector2.Zero) { vertexPaidsAdded = index - 1; this._vertexAmountCurrentlyMaintained = vertexPaidsAdded * 2; break; } Vector2 pos = positions[index] + offsetForAllPositions; float rot = MathHelper.WrapAngle(rotations[index]); int indexOnVertexArray = index * 2; float progressOnStrip = (float)index / (float)(num - 1); this.AddVertex(colorFunction, widthFunction, pos, rot, indexOnVertexArray, progressOnStrip); } this.PrepareIndices(vertexPaidsAdded, includeBacksides); }
// Token: 0x060005A6 RID: 1446 RVA: 0x0001BD28 File Offset: 0x00019F28 public void PrepareStripWithProceduralPadding(Vector2[] positions, float[] rotations, VertexStrip.StripColorFunction colorFunction, VertexStrip.StripHalfWidthFunction widthFunction, Vector2 offsetForAllPositions = default(Vector2), bool includeBacksides = false) { int num = positions.Length; this._temporaryPositionsCache.Clear(); this._temporaryRotationsCache.Clear(); int i = 0; while (i < num && !(positions[i] == Vector2.Zero)) { Vector2 vector = positions[i]; float num2 = MathHelper.WrapAngle(rotations[i]); this._temporaryPositionsCache.Add(vector); this._temporaryRotationsCache.Add(num2); if (i + 1 < num && positions[i + 1] != Vector2.Zero) { Vector2 vector2 = positions[i + 1]; float num3 = MathHelper.WrapAngle(rotations[i + 1]); int num4 = (int)(Math.Abs(MathHelper.WrapAngle(num3 - num2)) / 0.2617994f); if (num4 != 0) { float num5 = vector.Distance(vector2); Vector2 value = vector + Utils.ToRotationVector2(num2) * num5; Vector2 value2 = vector2 + Utils.ToRotationVector2(num3) * (0f - num5); int num6 = num4 + 2; float num7 = 1f / (float)num6; Vector2 target = vector; for (float num8 = num7; num8 < 1f; num8 += num7) { Vector2 vector3 = Vector2.CatmullRom(value, vector, vector2, value2, num8); float item = MathHelper.WrapAngle(Utils.ToRotation(vector3.DirectionTo(target))); this._temporaryPositionsCache.Add(vector3); this._temporaryRotationsCache.Add(item); target = vector3; } } } i++; } int count = this._temporaryPositionsCache.Count; for (int j = 0; j < count; j++) { Vector2 pos = this._temporaryPositionsCache[j] + offsetForAllPositions; float rot = this._temporaryRotationsCache[j]; int indexOnVertexArray = j * 2; float progressOnStrip = (float)j / (float)(count - 1); this.AddVertex(colorFunction, widthFunction, pos, rot, indexOnVertexArray, progressOnStrip); } this._vertexAmountCurrentlyMaintained = count * 2; this.PrepareIndices(count, includeBacksides); }