Ejemplo n.º 1
0
        /// <summary>
        /// This is called when the viewer should draw itself.
        /// </summary>
        /// <param name="time">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime time)
        {
            base.Draw(time);

            // overwrite the sidebar
            if (xnavigator.Online)
            {
                Graphics.SetRenderTarget(null);
                Flip.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.LinearClamp,
                           DepthStencilState.Default, RasterizerState.CullNone);

                Flip.Draw(SidebarHistory[preframeindex], SideDest, SidebarHistory[preframeindex].Bounds, Color.White);

                Flip.End();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is called when the manipulator should draw itself.
        /// </summary>
        /// <param name="time">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime time)
        {
            // visualization
            Graphics.SetRenderTarget(SceneBuffer);
            Graphics.Clear(Color.White);

            Graphics.DepthStencilState = DepthStencilState.Default;

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                Navigator.Render(camera);
            }

            Graphics.DepthStencilState = DepthStencilState.None;

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                RenderHUD(camera);
            }

            Flip.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.LinearClamp,
                       DepthStencilState.Default, RasterizerState.CullNone);

            double limit = Config.AxisLimit;

            renderAxisAnnotations(new double[3] {
                -limit, 0, 0
            }, new double[3] {
                +limit, 0, 0
            }, 2, "x [m]", false);
            renderAxisAnnotations(new double[3] {
                0, -limit, 0
            }, new double[3] {
                0, +limit, 0
            }, 2, "y [m]", true);
            renderAxisAnnotations(new double[3] {
                0, 0, -limit
            }, new double[3] {
                0, 0, +limit
            }, 2, "z [m]", false);

            Flip.End();

            // sidebar
            Graphics.SetRenderTarget(SideBuffer);
            Graphics.Clear(Color.Black);

            Flip.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.LinearClamp,
                       DepthStencilState.Default, RasterizerState.CullNone);

            Explorer.RenderSide();

            Flip.End();

            // HUD
            foreach (EffectPass pass in hudeffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                Explorer.RenderSideHUD();
            }

            // text and axes
            Graphics.SetRenderTarget(null);
            Flip.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, SamplerState.LinearClamp,
                       DepthStencilState.Default, RasterizerState.CullNone);

            Flip.Draw(SceneBuffer, SceneDest, SceneBuffer.Bounds, Color.White);
            Flip.Draw(SideBuffer, SideDest, SideBuffer.Bounds, Color.White);
            Flip.DrawString(font, Message, messagepos, Color.White);
            Flip.DrawString(font, TagMessage, TagMessagePos, TagColor);

            //double limit = Config.AxisLimit;
            //renderAxisAnnotations(new double[3] {-limit, 0, 0}, new double[3] {+limit, 0, 0}, 5);
            //renderAxisAnnotations(new double[3] {0, -limit, 0}, new double[3] {0, +limit, 0}, 5);
            //renderAxisAnnotations(new double[3] {0, 0, -limit}, new double[3] {0, 0, +limit}, 5);

            Flip.End();

            base.Draw(time);
        }