コード例 #1
0
ファイル: Level.cs プロジェクト: bradleat/trafps
        public void Draw(FirstPersonCamera camera, float scale)
        {
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();

                    effect.World = boneTransforms[mesh.ParentBone.Index] * Matrix.CreateRotationY(rotation)
                                                                        * Matrix.CreateTranslation(position) * Matrix.CreateScale(scale);
                    //effect.SpecularColor = new Vector3(1, 0, 0);
                    effect.View = camera.ViewMatrix;
                    effect.Projection = camera.ProjectionMatrix;
                }

                mesh.Draw();
            }
        }
コード例 #2
0
ファイル: Flag.cs プロジェクト: bradleat/trafps
        public void Draw(GameTime gameTime, FirstPersonCamera camera)
        {
            // Draw the model. A model can have multiple meshes, so loop.
            foreach (ModelMesh mesh in model.Meshes)
            {

                // This is where the mesh orientation is set, as well as our camera and projection.
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.World = Matrix.CreateRotationY(this.rotation) * Matrix.CreateTranslation(this.position);
                    effect.View = camera.ViewMatrix;
                    float aspectRatio = 1.0f;
                    effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
                        aspectRatio, 1.0f, 10000.0f);
                }
                // Draw the mesh, using the effects set above.
                mesh.Draw();
            }
        }
コード例 #3
0
ファイル: BackgroundScreen.cs プロジェクト: bradleat/trafps
        /// <summary>
        /// Loads graphics content for this screen. The background texture is quite
        /// big, so we use our own local ContentManager to load it. This allows us
        /// to unload before going from the menus into the game itself, wheras if we
        /// used the shared ContentManager provided by the Game class, the content
        /// would remain loaded forever.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            camera = new FirstPersonCamera(ScreenManager.GraphicsDevice.Viewport);
            level = LevelCreator.CreateLevel(ScreenManager.Game, currentLevel);

            texture = content.Load<Texture2D>("title");
        }