예제 #1
0
        /// <summary>
        /// See BlWindow3D for details.
        /// </summary>
        /// <param name="timeInfo">Provides a snapshot of timing values.</param>
        protected override void FrameDraw(GameTime timeInfo)
        {
            //
            // Draw things here using BlSprite.Draw(), graphics.DrawText(), etc.
            //

            MySprite.Draw();

            var MyMenuText = String.Format("{0}\nEye: {1}\nLookAt: {2}\nMaxDistance: {3}\nMinistance: {4}\nViewAngle: {5}\nModelLod: {6}\nModelApparentSize: {7}",
                                           Help,
                                           Graphics.Eye,
                                           Graphics.LookAt,
                                           Graphics.MaxCamDistance,
                                           Graphics.MinCamDistance,
                                           Graphics.Zoom,
                                           MySprite.LodTarget,
                                           MySprite.ApparentSize
                                           );

            // handle undrawable characters for the specified font(like the infinity symbol)
            try
            {
                Graphics.DrawText(MyMenuText, Font, new Vector2(50, 50));
            }
            catch { }
        }
예제 #2
0
        /// <summary>
        /// See BlWindow3D for details.
        /// </summary>
        /// <param name="timeInfo">Provides a snapshot of timing values.</param>
        protected override void FrameDraw(GameTime timeInfo)
        {
            //
            // Put your periodic code here
            //

            // Handle the standard mouse and keystroke functions. (This is very configurable)
            Graphics.DoDefaultGui();

            //
            // Draw things here using BlSprite.Draw(), graphics.DrawText(), etc.
            //

            Torus.Draw();

            /*
             * // This is another way to draw the text instead of assigning the BlSprite.Text member.
             * // If torus is in view, draw its text
             * var coords = Torus.GetViewCoords();
             * if(coords!=null)
             * {
             *      // This is how you would draw dynamic text. If the text is constant, you can do it faster by
             *      // creating a texture of the text (see Graphics.TextToTexture) in Setup, and then drawing that texture here with
             *      // Graphics.DrawTexture.
             *      // (You can also make text for the sprite if you add a subsprite that is a 'plane' model, has a texture that
             *      // is text, has billboard enabled, and maybe has constant size enabled. In that case, the text can be
             *      // occluded by closer sprites unless depth testing is disabled for that sprite, and the text size will vary
             *      // with the window size. But that's  more complicated.)
             *      Graphics.DrawText("This is the model", Font, (Vector2)coords);
             * }
             */

            // handle undrawable characters for the specified font (like the infinity symbol)
            try
            {
                var MyHud = $@"
Camera controls:
Dolly  -  Wheel
Zoom   -  Left-CTRL-wheel
Truck  -  Left-drag 
Rotate -  Right-drag
Pan    -  Left-ALT-left-drag
Reset  -  Esc
Fine control  -  Left-Shift

Eye: {Graphics.Eye}
LookAt: {Graphics.LookAt}
MaxDistance: {Graphics.MaxCamDistance}
MinDistance: {Graphics.MinCamDistance}
ViewAngle: {Graphics.Zoom}
ModelLod: {Torus.LodTarget}
ModelApparentSize: {Torus.ApparentSize}";

                Graphics.DrawText(MyHud, Font, new Vector2(50, 50));
            }
            catch { }
        }
예제 #3
0
        /// <summary>
        /// 'FrameDraw' is automatically called once per frame if there is enough CPU. Otherwise its called more slowly.
        /// This is where you would typically draw the scene.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void FrameDraw(GameTime timeInfo)
        {
            Skybox.Draw();

            var hudDist = (float)-(Graphics.CurrentNearClip + Graphics.CurrentFarClip) / 2;

            HudBackground.Matrix = Matrix.CreateScale(.4f, .4f, .4f) * Matrix.CreateTranslation(0, 0, hudDist);

            TopSprite.Draw();

            Graphics.SetSpriteToCamera(TopHudSprite);
            Graphics.GraphicsDevice.DepthStencilState = DepthStencilState.None;
            TopHudSprite.Draw();
            Graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            var MyMenuText = String.Format("{0}\nEye: {1}\nLookAt: {2}\nMaxDistance: {3}\nMinistance: {4}\nViewAngle: {5}\nModelLod: {6}\nModelApparentSize: {7}",
                                           Help,
                                           Graphics.Eye,
                                           Graphics.LookAt,
                                           Graphics.MaxCamDistance,
                                           Graphics.MinCamDistance,
                                           Graphics.Zoom,
                                           Model.LodTarget,
                                           Model.ApparentSize
                                           );

            try
            {
                // handle undrawable characters for the specified font(like the infinity symbol)
                try
                {
                    Graphics.DrawText(MyMenuText, Font, new Vector2(50, 50));
                }
                catch { }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            /*
             * Console.WriteLine("{0}  {1}  {2}  {3}  {4}",
             *      graphics.CurrentNearClip,
             *      graphics.CurrentFarClip,
             *      graphics.MinCamDistance,
             *      graphics.MaxCamDistance,
             *      hudDist
             * );
             */
            //Console.WriteLine(model.LodCurrentIndex);
        }
예제 #4
0
        /// <summary>
        /// See BlWindow3D for details.
        /// </summary>
        /// <param name="timeInfo">Provides a snapshot of timing values.</param>
        protected override void FrameDraw(GameTime timeInfo)
        {
            // Change the rotation of the torus
            Radians += .05f;

            // There are many static and instance methods of the Matrix class that let you define
            // various rotations, translations, etc.
            Torus.Matrix = Matrix.CreateRotationX(Radians);

            // Handle the standard mouse and keystroke functions. (This is very configurable)
            Graphics.DoDefaultGui();

            //
            // Draw things here using BlSprite.Draw(), graphics.DrawText(), etc.
            //

            Torus.Draw();

            // handle undrawable characters for the specified font (like the infinity symbol)
            try
            {
                var MyHud = $@"
Camera controls:
Dolly  -  Wheel
Zoom   -  Left-CTRL-wheel
Truck  -  Left-drag 
Rotate -  Right-drag
Pan    -  Left-CTRL-left-drag
Reset  -  Esc
Fine control  -  Left-Shift

Eye: {Graphics.Eye}
LookAt: {Graphics.LookAt}
MaxDistance: {Graphics.MaxCamDistance}
MinDistance: {Graphics.MinCamDistance}
ViewAngle: {Graphics.Zoom}
ModelLod: {Torus.LodTarget}
ModelApparentSize: {Torus.ApparentSize}";

                Graphics.DrawText(MyHud, Font, new Vector2(50, 50));
            }
            catch { }
        }
예제 #5
0
        /// <summary>
        /// See BlWindow3D for details.
        /// </summary>
        /// <param name="timeInfo">Provides a snapshot of timing values.</param>
        protected override void FrameDraw(GameTime timeInfo)
        {
            //
            // Draw things here using BlSprite.Draw(), graphics.DrawText(), etc.
            //

            Torus.Draw();

            // If torus is in view, draw its text
            var coords = Torus.GetViewCoords();

            if (coords != null)
            {
                // This is how you would draw dynamic text. If the text is constant, you can do it faster by
                // creating a texture of the text (see Graphics.TextToTexture) in Setup, and then drawing that texture here with
                // Graphics.DrawTexture.
                // (You can also make text for the sprite if you add a subsprite that is a 'plane' model, has a texture that
                // is text, has billboard enabled, and maybe has constant size enabled. In that case, the text can be
                // occluded by closer sprites unless depth testing is disabled for that sprite, and the text size will vary
                // with the window size. But that's  more complicated.)
                Graphics.DrawText("This is the model", Font, (Vector2)coords);
            }

            var MyMenuText = String.Format("{0}\nEye: {1}\nLookAt: {2}\nMaxDistance: {3}\nMinistance: {4}\nViewAngle: {5}\nModelLod: {6}\nModelApparentSize: {7}",
                                           Help,
                                           Graphics.Eye,
                                           Graphics.LookAt,
                                           Graphics.MaxCamDistance,
                                           Graphics.MinCamDistance,
                                           Graphics.Zoom,
                                           Torus.LodTarget,
                                           Torus.ApparentSize
                                           );

            // handle undrawable characters for the specified font(like the infinity symbol)
            try
            {
                Graphics.DrawText(MyMenuText, Font, new Vector2(50, 50));
            }
            catch { }
        }
예제 #6
0
        /// <summary>
        /// See BlWindow3D for details.
        /// </summary>
        /// <param name="timeInfo">Provides a snapshot of timing values.</param>
        protected override void FrameDraw(GameTime timeInfo)
        {
            //
            // Put your periodic code here
            //

            // Handle the standard mouse and keystroke functions. (This is very configurable)
            Graphics.DoDefaultGui();

            //
            // Draw things here using BlSprite.Draw(), graphics.DrawText(), etc.
            //

            GeoObj.Draw();

            // handle undrawable characters for the specified font (like the infinity symbol)
            try
            {
                var MyHud = $@"
Camera controls:
Dolly  -  Wheel
Zoom   -  Left-CTRL-wheel
Truck  -  Left-drag 
Rotate -  Right-drag
Pan    -  Left-CTRL-left-drag
Reset  -  Esc
Fine control  -  Left-Shift

Eye: {Graphics.Eye}
LookAt: {Graphics.LookAt}
MaxDistance: {Graphics.MaxCamDistance}
MinDistance: {Graphics.MinCamDistance}
ViewAngle: {Graphics.Zoom}
ModelLod: {GeoObj.LodTarget}
ModelApparentSize: {GeoObj.ApparentSize}";

                Graphics.DrawText(MyHud, Font, new Vector2(50, 50));
            }
            catch { }
        }
예제 #7
0
        /// <summary>
        /// 'FrameDraw' is automatically called once per frame if there is enough CPU. Otherwise its called more slowly.
        /// This is where you would typically draw the scene.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void FrameDraw(GameTime timeInfo)
        {
            // handle the standard mouse and key commands for controlling the 3D view
            var mouseRay = Graphics.DoDefaultGui();

            if (Graphics.Zoom > 150)
            {
                Graphics.Zoom = 150;
            }

            // Did user CTRL-leftClick in the 3D display?
            if (mouseRay != null)
            {
                // search the sprite tree for sprites that had a radius within the selection ray
                var sprites = TopSprite.GetRayIntersections((Ray)mouseRay);
                foreach (var s in sprites)
                {
                    Console.WriteLine(s);
                }
            }

            Skybox.Draw();

            var hudDist = (float)-(Graphics.CurrentNearClip + Graphics.CurrentFarClip) / 2;

            HudBackground.Matrix = Matrix.CreateScale(.4f, .4f, .4f) * Matrix.CreateTranslation(0, 0, hudDist);

            TopSprite.Draw();

            Graphics.SetSpriteToCamera(TopHudSprite);
            Graphics.GraphicsDevice.DepthStencilState = DepthStencilState.None;
            TopHudSprite.Draw();
            Graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            var MyMenuText = String.Format("{0}\nEye: {1}\nLookAt: {2}\nMaxDistance: {3}\nMinDistance: {4}\nViewAngle: {5}\nModelLod: {6}\nModelApparentSize: {7}",
                                           Help,
                                           Graphics.Eye,
                                           Graphics.LookAt,
                                           Graphics.MaxCamDistance,
                                           Graphics.MinCamDistance,
                                           Graphics.Zoom,
                                           Model.LodTarget,
                                           Model.ApparentSize
                                           );

            try
            {
                // handle undrawable characters for the specified font(like the infinity symbol)
                try
                {
                    Graphics.DrawText(MyMenuText, Font, new Vector2(50, 50));
                }
                catch { }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            /*
             * Console.WriteLine("{0}  {1}  {2}  {3}  {4}",
             *      graphics.CurrentNearClip,
             *      graphics.CurrentFarClip,
             *      graphics.MinCamDistance,
             *      graphics.MaxCamDistance,
             *      hudDist
             * );
             */
            //Console.WriteLine(model.LodCurrentIndex);
        }