AcTools.Render.Kn5SpecificDeferred.Kn5ObjectRenderer.OnTick C# (CSharp) Method

OnTick() protected method

protected OnTick ( float dt ) : void
dt float
return void
        protected override void OnTick(float dt) {
            const float threshold = 0.001f;
            if (_resetState > threshold) {
                if (!AutoRotate) {
                    _resetState = 0f;
                    return;
                }

                _resetState += (-0f - _resetState) / 10f;
                if (_resetState <= threshold) {
                    AutoRotate = false;
                }

                var cam = CameraOrbit;
                if (cam != null) {
                    cam.Alpha += (_resetCamera.Alpha - cam.Alpha) / 10f;
                    cam.Beta += (_resetCamera.Beta - cam.Beta) / 10f;
                    cam.Radius += (_resetCamera.Radius - cam.Radius) / 10f;
                    cam.FovY += (_resetCamera.FovY - cam.FovY) / 10f;
                    // cam.Target += (_resetCamera.Target - cam.Target) / 10f;
                }

                _elapsedCamera = 0f;

                IsDirty = true;
            } else if (AutoRotate && CameraOrbit != null) {
                CameraOrbit.Alpha += dt * 0.29f;
                CameraOrbit.Beta += (MathF.Sin(_elapsedCamera * 0.39f) * 0.2f + 0.15f - CameraOrbit.Beta) / 10f;
                _elapsedCamera += dt;
            }

            if (AutoAdjustTarget && CameraOrbit != null) {
                var t = _resetCamera.Target + new Vector3(-0.05f * CameraOrbit.Position.X, -0.02f * CameraOrbit.Position.Y, 0f);
                CameraOrbit.Target += (t - CameraOrbit.Target) / 2f;
            }

            if (AutoRotateSun && Sun != null) {
                var dir = Sun.Direction;
                dir.X += (MathF.Sin(_elapsedSun * 0.15f) - dir.X) / 10f;
                dir.Y += (-1.5f - dir.Y) / 10f;
                dir.Z += (MathF.Sin(_elapsedSun * 0.23f + 0.07f) - dir.Z) / 10f;

                Sun.Direction = dir;
                _elapsedSun += dt;
            }

            foreach (var i in _pointLights) {
                i.Light.Position = new Vector3(
                        MathF.Sin(Elapsed * i.B + i.D) * i.C, i.A,
                        MathF.Sin(Elapsed * i.E + i.F) * i.G) * 0.3f;
            }
        }