private float CalculateEasedCurve(float Percent) { return(EasingLookupTable.EaseEvaluate(Percent, 8)); }
private void UpdateRendererMeshValue() { float chartTime = _Tuner.ChartTime; float uvTileScale = TouchMaterial.mainTextureScale.x; float uvTileScaleInverse = 1.0f / UV_DURATION; Parallel.For(0, MeshRenderers.Length, i => { var renderer = MeshRenderers[i]; if (!renderer.DoneInitRenderer) { return; } float startTime, deltaTime; float startDegree, endDegree, deltaDegree; int ease = 0; //No Joints Variant if (MeshRenderers.Length <= 1) { startTime = Note.Time; deltaTime = Note.Duration; if (Note.Jcount == 0) { startDegree = Note.Degree; endDegree = Note.Degree; } else { startDegree = Note.Degree; endDegree = Note.Degree + Note.Joints[0].dDegree; ease = Note.Joints[0].Cfmi; } } //1+ Joints Variant else { var joint = Note.Joints[i]; startTime = joint.aTime - joint.dTime; deltaTime = joint.dTime; startDegree = joint.aDegree - joint.dDegree; endDegree = joint.aDegree; ease = joint.Cfmi; } if (startTime + deltaTime <= chartTime) { //Skip when joint is fully hidden renderer.Hide(); return; } else { renderer.Show(); } deltaDegree = endDegree - startDegree; //Get Total Points count inside Joint int totalPoints = 0; if (!renderer.DoneInitMesh) { float unscaledTotalPoints = DetermineIdealCount(deltaTime, deltaDegree); totalPoints = (int)(unscaledTotalPoints * QUALITY); renderer.SetCount(totalPoints); //Set UV Scale var secPoints = (int)((UV_DURATION / deltaTime) * totalPoints); renderer.SetUVScale((1.0f / secPoints) * uvTileScaleInverse); } else { totalPoints = renderer.Length; } float percentStep = 1.0f / (float)(totalPoints - 1); Parallel.For(0, totalPoints, j => { //First Index will be Start of the Rail float percent = j * percentStep; float time = startTime + (deltaTime * percent); //Initialize Basic Info for Renderer if (!renderer.DoneInitMesh) { float degree = startDegree + (deltaDegree * EasingLookupTable.EaseEvaluate(percent, ease)); renderer.SetPointByDegree(j, degree); var isReverse = CalculateScrollSpeed(time) < 0.0f; renderer.SetReverseScrollSpeed(j, isReverse); } //Skip the move calculation for obvious one if (time <= chartTime) { renderer.SetPercent(j, 1.0f); return; } //Put Move percent to Renderer float movePercent = CalcEasedMovePercent(time); renderer.SetPercent(j, movePercent * 0.01f); }); }); }