예제 #1
0
        public void Render(Track track, Timeline timeline, ICamera camera, DrawOptions options)
        {
            Rider drawrider = options.Rider;

            if (options.OverlayFrame != -1)
            {
                var offs = camera.GetFrameCamera(options.OverlayFrame);
                var diff = offs - camera.GetFrameCamera(game.Track.Offset);
                GL.PushMatrix();
                GL.Translate(new Vector3d(-diff * game.Track.Zoom));
                var overlayopts = new DrawOptions();
                overlayopts.Zoom       = options.Zoom;
                overlayopts.LineColors = false;
                overlayopts.Overlay    = true;
                _trackrenderer.Render(overlayopts);
                GL.PopMatrix();
            }
            _trackrenderer.Render(options);
            if (Settings.OnionSkinning)
            {
                float onionsf = (Settings.OnionSkinningFront + 1);
                float onionsb = -(Settings.OnionSkinningBack);
                for (int i = (int)Math.Round(onionsb); i < (int)Math.Round(onionsf); i++)
                {
                    var frame = game.Track.Offset + i;
                    if (frame > 0 && frame < game.Track.FrameCount && i != 0)
                    {
                        var onionskin = timeline.GetFrame(frame);
                        _riderrenderer.DrawRider(
                            0.2f,
                            onionskin,
                            false);
                        if (options.ShowMomentumVectors)
                        {
                            _riderrenderer.DrawMomentum(onionskin, 0.5f);
                        }
                        if (options.ShowContactLines)
                        {
                            _riderrenderer.DrawContacts(onionskin, timeline.DiagnoseFrame(frame), 0.5f);
                        }
                    }
                }
            }
            if (options.DrawFlag)
            {
                _riderrenderer.DrawRider(
                    0.3f,
                    options.FlagRider,
                    true);
            }

            _riderrenderer.DrawRider(
                options.ShowContactLines ? 0.5f : 1,
                options.Rider,
                true);
            if (options.ShowMomentumVectors)
            {
                _riderrenderer.DrawMomentum(options.Rider, 1);
                if (
                    !options.IsRunning &&
                    options.Iteration != 6 &&
                    options.Iteration != 0 &&
                    !Settings.OnionSkinning)
                {
                    var frame = timeline.GetFrame(game.Track.Offset + 1, 0);
                    _riderrenderer.DrawRider(0.1f, frame);
                    if (options.ShowContactLines)
                    {
                        _riderrenderer.DrawContacts(frame, timeline.DiagnoseFrame(game.Track.Offset + 1, 0), 0.5f);
                    }
                }
            }
            if (options.ShowContactLines)
            {
                _riderrenderer.DrawContacts(options.Rider, options.RiderDiagnosis, 1);
            }
            _riderrenderer.Scale = options.Zoom;
            _riderrenderer.Draw();
            CurrentTools.SelectedTool.Render();
            _riderrenderer.DrawLines();
            _riderrenderer.Clear();
        }
        public void Render(Track track, Timeline timeline, ICamera camera, DrawOptions options)
        {
            Rider drawrider = options.Rider;

            _trackrenderer.Render(options);
            if (Settings.Local.OnionSkinning && options.PlaybackMode)
            {
                const int onions = 20;
                for (int i = -onions; i < onions; i++)
                {
                    var frame = game.Track.Offset + i;
                    if (frame > 0 && frame < game.Track.FrameCount && i != 0)
                    {
                        var onionskin = timeline.GetFrame(frame);
                        _riderrenderer.DrawRider(
                            0.2f,
                            onionskin,
                            false);
                        if (options.ShowMomentumVectors)
                        {
                            _riderrenderer.DrawMomentum(onionskin, 0.5f);
                        }
                        if (options.ShowContactLines)
                        {
                            _riderrenderer.DrawContacts(onionskin, timeline.DiagnoseFrame(frame), 0.5f);
                        }
                    }
                }
            }
            if (options.DrawFlag)
            {
                _riderrenderer.DrawRider(
                    0.3f,
                    options.FlagRider,
                    true);
            }

            _riderrenderer.DrawRider(
                options.ShowContactLines ? 0.5f : 1,
                options.Rider,
                true);
            if (options.ShowMomentumVectors)
            {
                _riderrenderer.DrawMomentum(options.Rider, 1);
                if (
                    !options.IsRunning &&
                    options.Iteration != 6 &&
                    options.Iteration != 0 &&
                    !Settings.Local.OnionSkinning)
                {
                    var frame = timeline.GetFrame(game.Track.Offset + 1, 0);
                    _riderrenderer.DrawRider(0.1f, frame);
                    if (options.ShowContactLines)
                    {
                        _riderrenderer.DrawContacts(frame, timeline.DiagnoseFrame(game.Track.Offset + 1, 0), 0.5f);
                    }
                }
            }
            if (options.ShowContactLines)
            {
                _riderrenderer.DrawContacts(options.Rider, options.RiderDiagnosis, 1);
            }
            _riderrenderer.Scale = options.Zoom;
            _riderrenderer.Draw();
            _riderrenderer.Clear();
        }