public void BuildForLine(LinesThroughPoints ln) { this.CurrentLine = ln; for (int si = 0; si < AlongCount; si++) { for (int ai = 0; ai < AroundCount; ai++) { float sf = ((float)si) / ((float)(AlongCount - 1)); float af = ((float)ai) / ((float)(AroundCount - 1)); var v = GenerateVertex(sf, af, ((si == 0) || ((si + 1) == AlongCount))); this.Vertices.Add(v); if (si > 0) { var i0 = ((si - 1) * AroundCount) + (ai); var i1 = ((si - 1) * AroundCount) + ((ai + 1) % AroundCount); var i2 = ((si - 0) * AroundCount) + (ai); var i3 = ((si - 0) * AroundCount) + ((ai + 1) % AroundCount); var tris = new int[] { i0, i1, i3, i3, i2, i0 }; this.Indices.AddRange(tris); } } } this.Result = new Mesh(); this.Result.vertices = this.Vertices.Select(k => k.Position).ToArray(); this.Result.normals = this.Vertices.Select(k => k.Normal).ToArray(); this.Result.uv = this.Vertices.Select(k => k.Texcoord).ToArray(); this.Result.triangles = this.Indices.ToArray(); this.Result.UploadMeshData(false); }
void SetupCoreLine() { switch (this.LineToShow) { case NamedLines.LeftLegToDanTien: { var pnts = this.LineBetweenTransforms(this.Body.LeftLegEnd.transform, this.Body.LeftLegStart.transform); pnts.Add(this.Body.SpineStart.position); this.CoreLine = new LinesThroughPoints(pnts.ToArray()); } break; case NamedLines.SpinalBreathing: { var pnts = this.LineBetweenTransforms(this.Body.SpineStart, this.Body.SpineEnd); //pnts.Add (this.Body.SpineStart.position); this.CoreLine = new LinesThroughPoints(pnts.ToArray()); for (int i = 0; i < this.Particles.Length; i++) { Particles[i].startColor = Color.red; } } break; } }
public ParticleSpan(ParticleExcersize sb, int count, LinesThroughPoints ln) { this.Owner = sb; this.Line = ln; this.First = sb.ClaimedCount; this.Count = count; sb.ClaimedCount += count; sb.AllSpans.Add(this); }
public ParticleSpan(SpinalBreath sb, int count, LinesThroughPoints ln) { this.Owner = sb; this.Line = ln; this.First = sb.ClaimedCount; this.Count = count; this.LatestAlpha = 1.0f; sb.ClaimedCount += count; sb.AllSpans.Add(this); }
public void SetupLine(LinesThroughPoints ln) { this.EnsureBuilder(); this.Builder.BuildForLine(ln); this.MyMesh.mesh = this.Builder.Result; }