diff --git a/.old/DriftGrind.cs b/.old/DriftGrind.cs index f826f25..265102e 100644 --- a/.old/DriftGrind.cs +++ b/.old/DriftGrind.cs @@ -106,7 +106,7 @@ public class DriftGrind { // pos = -(rCon.pos - Input.Head.position) + grindPos - (Input.Head.position - pos); // vel = Vec3.Zero; - // railT += Time.Elapsedf * grindVel.Magnitude * grindDir; // scale based on length of rail * calculate and cache on place + // railT += Time.Stepf * grindVel.Magnitude * grindDir; // scale based on length of rail * calculate and cache on place // // bool clamped = false; // // float railTpreClamp = railT; // // if @@ -124,7 +124,7 @@ public class DriftGrind { // cube.Draw(mat, Matrix.TS(grindPos, new Vec3(0.1f, 0.1f, 0.1f))); // // cube.Draw(mat, Matrix.TS(toPos, new Vec3(0.1f, 0.1f, 0.1f) * 0.333f)); - // // pos = Vec3.Lerp(pos, Bezier.Sample(net.me.cubics[0].p0, net.me.cubics[0].p1, net.me.cubics[0].p2, net.me.cubics[0].p3, railT) - (subCon.aim.position - pos), Time.Elapsedf * 6f); + // // pos = Vec3.Lerp(pos, Bezier.Sample(net.me.cubics[0].p0, net.me.cubics[0].p1, net.me.cubics[0].p2, net.me.cubics[0].p3, railT) - (subCon.aim.position - pos), Time.Stepf * 6f); // // how to reliably determine and control which direction to go? (velocity) // } // } @@ -149,12 +149,12 @@ public class DriftGrind { // pos.x = (float)Math.Sin(Time.Total * 0.1f) * 0.5f; - // pos += vel * Time.Elapsedf; + // pos += vel * Time.Stepf; // float preX = pos.x; pos.x = Math.Clamp(pos.x, -scene.scale / 2, scene.scale / 2); if (pos.x != preX) { vel.x = 0; } // float preY = pos.y; pos.y = Math.Clamp(pos.y, 0f, scene.scale / 2); if (pos.y != preY) { vel.y = 0; } // float preZ = pos.z; pos.z = Math.Clamp(pos.z, -scene.scale / 2, scene.scale / 2); if (pos.z != preZ) { vel.z = 0; } - // vel *= 1 - Time.Elapsedf * 0.2f; + // vel *= 1 - Time.Stepf * 0.2f; } } \ No newline at end of file diff --git a/app/Backrooms/Mono.cs b/app/Backrooms/Mono.cs index b82a153..8b67246 100644 --- a/app/Backrooms/Mono.cs +++ b/app/Backrooms/Mono.cs @@ -14,33 +14,33 @@ public class Mono { Vec3 angle = new Vec3(0, 0, 0); Thing[] thing; - Model model = Model.FromFile("/backrooms/backrooms.glb"); + Model model = Model.FromFile("backrooms/backrooms.glb"); public void Init() { thing = new Thing[] { new Thing( model.GetMesh("Carpet"), - new Material(Shader.FromFile("/shaders/oriel.hlsl")), + new Material(Shader.FromFile("shaders/oriel.hlsl")), "backrooms/Carpet.png" ), new Thing( model.GetMesh("Walls"), - new Material(Shader.FromFile("/shaders/oriel.hlsl")), + new Material(Shader.FromFile("shaders/oriel.hlsl")), "backrooms/Walls.png" ), new Thing( model.GetMesh("Ceiling"), - new Material(Shader.FromFile("/shaders/oriel.hlsl")), + new Material(Shader.FromFile("shaders/oriel.hlsl")), "backrooms/Ceiling.png" ), new Thing( model.GetMesh("Vents"), - new Material(Shader.FromFile("/shaders/oriel.hlsl")), + new Material(Shader.FromFile("shaders/oriel.hlsl")), "backrooms/Vents.png" ), new Thing( model.GetMesh("Lights"), - new Material(Shader.FromFile("/shaders/oriel.hlsl")), + new Material(Shader.FromFile("shaders/oriel.hlsl")), "backrooms/Lights.png" ), }; @@ -49,9 +49,9 @@ public class Mono { public void Frame() { Oriels.Rig rig = Oriels.Mono.inst.rig; - // angle.x -= rig.rCon.device.stick.y * 90f * Time.Elapsedf; + // angle.x -= rig.rCon.device.stick.y * 90f * Time.Stepf; // angle.x = PullRequest.Clamp(angle.x, -89, 89); - angle.y -= rig.rCon.device.stick.x * 90f * Time.Elapsedf; + angle.y -= rig.rCon.device.stick.x * 90f * Time.Stepf; Vec3 input = new Vec3( rig.lCon.device.stick.x, @@ -67,7 +67,7 @@ public class Mono { ).Normalized * input; input.y = 0; - offset += input * Time.Elapsedf; + offset += input * Time.Stepf; } offset.y = -height; diff --git a/app/Blocks.cs b/app/Blocks.cs index 0c563b4..1dc9bdd 100644 --- a/app/Blocks.cs +++ b/app/Blocks.cs @@ -126,7 +126,7 @@ public class BlockCon { spinDelta = Quat.Slerp( spinDelta.Normalized, (newRot.Inverse * conRotDelta * newRot).Normalized, - Time.Elapsedf / 0.1f + Time.Stepf / 0.1f ); } spinRot *= spinDelta * spinDelta; @@ -139,16 +139,16 @@ public class BlockCon { blocks[index].solid.Move(toPos, toRot); Quat newHeldRot = blocks[index].solid.GetPose().orientation; - angularMomentum = Vec3.Lerp(angularMomentum, PullRequest.AngularDisplacement((newHeldRot * oldHeldRot.Inverse).Normalized), Time.Elapsedf / 0.1f); + angularMomentum = Vec3.Lerp(angularMomentum, PullRequest.AngularDisplacement((newHeldRot * oldHeldRot.Inverse).Normalized), Time.Stepf / 0.1f); oldHeldRot = newHeldRot; delta = (cursor + (con.ori * heldRot * spinRot).Normalized * offset) - blocks[index].solid.GetPose().position; - momentum = Vec3.Lerp(momentum, delta, Time.Elapsedf / 0.1f); + momentum = Vec3.Lerp(momentum, delta, Time.Stepf / 0.1f); } } else { if (index >= 0) { - blocks[index].solid.SetAngularVelocity(angularMomentum / Time.Elapsedf); - blocks[index].solid.SetVelocity(momentum / Time.Elapsedf); + blocks[index].solid.SetAngularVelocity(angularMomentum / Time.Stepf); + blocks[index].solid.SetVelocity(momentum / Time.Stepf); } index = -1; } diff --git a/app/Board.cs b/app/Board.cs index 3459ab9..614f7c5 100644 --- a/app/Board.cs +++ b/app/Board.cs @@ -35,13 +35,13 @@ public class Board { // velocity - vel *= 1f - (drag * Time.Elapsedf); - vel += accel * speed * Time.Elapsedf; - vel = MathF.Max(vel - deccel * brake * Time.Elapsedf, 0); + vel *= 1f - (drag * Time.Stepf); + vel += accel * speed * Time.Stepf; + vel = MathF.Max(vel - deccel * brake * Time.Stepf, 0); // steering vector = Quat.LookDir(dir) * Quat.FromAngles(0, lean * tight, 0) * Vec3.Forward; - back += vector * vel * Time.Elapsedf; + back += vector * vel * Time.Stepf; dir = (front - back).Normalized; front = back + dir * length; diff --git a/app/Greenyard/Mono.cs b/app/Greenyard/Mono.cs index e24fdcc..c900757 100644 --- a/app/Greenyard/Mono.cs +++ b/app/Greenyard/Mono.cs @@ -31,9 +31,9 @@ public class Mono { public void Frame() { Oriels.Rig rig = Oriels.Mono.inst.rig; - // angle.x -= rig.rCon.device.stick.y * 90f * Time.Elapsedf; + // angle.x -= rig.rCon.device.stick.y * 90f * Time.Stepf; // angle.x = PullRequest.Clamp(angle.x, -89, 89); - angle.y -= rig.rCon.device.stick.x * 90f * Time.Elapsedf; + angle.y -= rig.rCon.device.stick.x * 90f * Time.Stepf; Vec3 input = new Vec3( rig.lCon.device.stick.x, @@ -49,7 +49,7 @@ public class Mono { ).Normalized * input; input.y = 0; - offset += input * Time.Elapsedf; + offset += input * Time.Stepf; } offset.y = -height; diff --git a/app/Mono.cs b/app/Mono.cs index 1f223b1..b194fcd 100644 --- a/app/Mono.cs +++ b/app/Mono.cs @@ -346,11 +346,11 @@ public class Cursor { set { _raw = value; pos = new Vec3( - (float)xF.Filter(raw.x, (double)Time.Elapsedf), - (float)yF.Filter(raw.y, (double)Time.Elapsedf), - (float)zF.Filter(raw.z, (double)Time.Elapsedf) + (float)xF.Filter(raw.x, (double)Time.Stepf), + (float)yF.Filter(raw.y, (double)Time.Stepf), + (float)zF.Filter(raw.z, (double)Time.Stepf) ); - smooth = Vec3.Lerp(smooth, pos, Time.Elapsedf * 6f); + smooth = Vec3.Lerp(smooth, pos, Time.Stepf * 6f); } } public Vec3 pos { get; private set; } diff --git a/app/PullRequest.cs b/app/PullRequest.cs index 0754873..343ea36 100644 --- a/app/PullRequest.cs +++ b/app/PullRequest.cs @@ -31,7 +31,7 @@ public static class PullRequest { ToAxisAngle(q, out axis, out angle); return axis * angle; // * (float)(Math.PI / 180); // radians -> degrees - // / Time.Elapsedf; // delta -> velocity + // / Time.Stepf; // delta -> velocity } public static void ToAxisAngle(this Quat q, out Vec3 axis, out float angle) { @@ -321,7 +321,7 @@ public static class PullRequest { float error = value - target; integral += error; float delta = ((p * error) + (i * integral)); - return value -= delta * Time.Elapsedf; + return value -= delta * Time.Stepf; } } @@ -333,7 +333,7 @@ public static class PullRequest { Vec3 error = value - target; integral += error; Vec3 delta = ((p * error) + (i * integral)); - return value -= delta * Time.Elapsedf; + return value -= delta * Time.Stepf; } } @@ -345,15 +345,15 @@ public static class PullRequest { public void Step(float to = 1, bool bounce = false) { float dir = to - t; - vel += dir * spring * Time.Elapsedf; + vel += dir * spring * Time.Stepf; if (Math.Sign(vel) != Math.Sign(dir)) { - vel *= 1 - (dampen * Time.Elapsedf); + vel *= 1 - (dampen * Time.Stepf); } else { - vel *= 1 - (dampen * 0.33f * Time.Elapsedf); + vel *= 1 - (dampen * 0.33f * Time.Stepf); } - float newt = t + vel * Time.Elapsedf; + float newt = t + vel * Time.Stepf; if (bounce && (newt < 0 || newt > 1)) { vel *= -0.5f; newt = Math.Clamp(newt, 0, 1); diff --git a/app/Rig/Rig.cs b/app/Rig/Rig.cs index 272e8c4..bc749d7 100644 --- a/app/Rig/Rig.cs +++ b/app/Rig/Rig.cs @@ -51,7 +51,7 @@ public class Rig { Vec2 stickL = Input.Controller(Handed.Left).stick; Vec2 stickR = Input.Controller(Handed.Right).stick; Quat delta = Quat.FromAngles( - Vec3.Up * stickR.x * 120f * Time.Elapsedf + Vec3.Up * stickR.x * 120f * Time.Stepf ) * ori; Vec3 headPos = Input.Head.position + Input.Head.Forward * -0.15f; // Input.Head -> Head() ? pos -= headPos; @@ -59,7 +59,7 @@ public class Rig { pos += headPos; ori = delta * ori; - Vec3 move = -stickL.X0Y * Time.Elapsedf * 0.5f; + Vec3 move = -stickL.X0Y * Time.Stepf * 0.5f; pos += (Input.Head.orientation * move).X0Z; Renderer.CameraRoot = Matrix.TR(pos, ori) * bounds.Inverse; diff --git a/app/Space/Mono.cs b/app/Space/Mono.cs index 306cf8b..3cfeb17 100644 --- a/app/Space/Mono.cs +++ b/app/Space/Mono.cs @@ -86,7 +86,7 @@ public class Mono { ); // fly player towards cursor: - // playerPos += (localCursor - playerPos).Normalized * 1f * Time.Elapsedf; + // playerPos += (localCursor - playerPos).Normalized * 1f * Time.Stepf; pidX.p = moveP; pidY.p = moveP; pidZ.p = moveP; pidX.i = moveI; pidY.i = moveI; pidZ.i = moveI; playerPos = new Vec3( @@ -172,7 +172,7 @@ public class Mono { Vec3 toPlayer = (playerPos - enemies[i]).Normalized; float variation = Oriels.Mono.inst.noise.D1(i); toPlayer *= Quat.FromAngles(0, MathF.Sin(Time.Totalf * variation) * 90 * variation, 0); - Vec3 newPos = enemies[i] + toPlayer * Time.Elapsedf * 0.5f; + Vec3 newPos = enemies[i] + toPlayer * Time.Stepf * 0.5f; // if far enough away from other enemies than set new pos bool setNewPos = true; diff --git a/app/_Init.cs b/app/_Init.cs index 53bf073..aa193b5 100644 --- a/app/_Init.cs +++ b/app/_Init.cs @@ -7,7 +7,7 @@ SKSettings settings = new SKSettings { assetsFolder = "add", depthMode = DepthMode.D32, disableUnfocusedSleep = true, - // displayPreference = DisplayMode.Flatscreen, + displayPreference = DisplayMode.Flatscreen, // disableFlatscreenMRSim = true, }; if (!SK.Initialize(settings)) diff --git a/app/dofs/oriel/Oriel.cs b/app/dofs/oriel/Oriel.cs index 64a8ae3..8da29e5 100644 --- a/app/dofs/oriel/Oriel.cs +++ b/app/dofs/oriel/Oriel.cs @@ -120,7 +120,7 @@ public class Oriel { // (Input.Key(Key.R).IsActive() ? 1 : 0) - (Input.Key(Key.W).IsActive() ? 1 : 0) // ); // if (input.Length > 0) { - // cursor += input.Normalized * Time.Elapsedf * 0.4f; + // cursor += input.Normalized * Time.Stepf * 0.4f; // } // } // cursorOri = Quat.FromAngles(MathF.Sin(Time.Totalf) * 15, 0, 0); @@ -163,7 +163,7 @@ public class Oriel { if (interacting) { if (detectCount == 1) { // Grab (face -> crown *face) Quat newOri = (cursorOri * qOffset.Inverse).Normalized; - ori = Quat.Slerp(ori, newOri, Time.Elapsedf * 9f); + ori = Quat.Slerp(ori, newOri, Time.Stepf * 9f); // gravity snapping (within 6 degrees) *horizontal // always? *here **tilt = nosnap if (Vec3.Dot(-Vec3.Up, ori * -Vec3.Up) > 0.9998f) { diff --git a/app/dofs/trackballer/Trackballer.cs b/app/dofs/trackballer/Trackballer.cs index 0edd85b..8c7510d 100644 --- a/app/dofs/trackballer/Trackballer.cs +++ b/app/dofs/trackballer/Trackballer.cs @@ -63,7 +63,7 @@ class Trackballer : dof { onTheBall ? 0.5f : 5f // 10x less integral when on the ball? ); // compliance; - // compliance = Vec3.Lerp(compliance, Vec3.Zero, Time.Elapsedf * 10f); + // compliance = Vec3.Lerp(compliance, Vec3.Zero, Time.Stepf * 10f); Matrix anchor = Matrix.TR(anchorPos, hand.palm.orientation); Matrix anchorInv = anchor.Inverse; @@ -129,7 +129,7 @@ class Trackballer : dof { point.Normalized ).Relative(hand.palm.orientation); - momentum = Quat.Slerp(momentum, delta, Time.Elapsedf * 10f); + momentum = Quat.Slerp(momentum, delta, Time.Stepf * 10f); Vec3 contact = point.Normalized * radius.value; Vec3 offset = point - contact; @@ -142,7 +142,7 @@ class Trackballer : dof { } else { PullRequest.ToAxisAngle(momentum, out Vec3 axis, out float angle); if (angle < stop.value) { - momentum = Quat.Slerp(momentum, Quat.Identity, Time.Elapsedf * 10f); + momentum = Quat.Slerp(momentum, Quat.Identity, Time.Stepf * 10f); } } diff --git a/oriels.csproj b/oriels.csproj index 03709e3..31e7c43 100644 --- a/oriels.csproj +++ b/oriels.csproj @@ -6,7 +6,7 @@ - +