예제 #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            if (_showWireframe)
            {
                var rasterizerState = new RasterizerState {
                    FillMode = FillMode.WireFrame
                };
                GraphicsDevice.RasterizerState = rasterizerState;
            }
            else
            {
                var rasterizerState = new RasterizerState {
                    FillMode = FillMode.Solid
                };
                GraphicsDevice.RasterizerState = rasterizerState;
            }

            /*
             * var world = Matrix.CreateRotationX(_modelRotation) * Matrix.CreateRotationY(_modelRotation) * Matrix.CreateTranslation(_modelPosition);
             * var view = Matrix.CreateLookAt(_cameraPosition, Vector3.Zero, Vector3.Up);
             * var projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), _aspectRatio, 1.0f, 10000.0f);
             */
            var world =
                Matrix.CreateRotationX(_cameraPosition.Y) *
                Matrix.CreateRotationY(_cameraPosition.X) *
                Matrix.CreateTranslation(0.0f, 0f, 5f);
            var view       = Matrix.CreateLookAt(new Vector3(0, 0, _cameraPosition.Z), Vector3.Zero, Vector3.Up);
            var projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), _aspectRatio, 1.0f, 10000.0f);

            _testRsm.Draw(GraphicsDevice, _modelEffect, view, projection, world);
            //_testRsw.DrawAll(GraphicsDevice, _modelEffect, view, projection, world);

            base.Draw(gameTime);
        }
예제 #2
0
 public void Draw(GraphicsDevice device, BasicEffect effect, Matrix view, Matrix projection, Matrix world)
 {
     RsmModel.Draw(device, effect, view, projection, world);
 }