示例#1
0
        /// <summary>
        /// Draws the entity as a billboard sprite.
        /// </summary>
        public void Draw(QuadDrawer quadDrawer, Vector3 cameraPosition,
                         Matrix view, Matrix projection, Matrix world)
        {
            Matrix worldModifiers = Matrix.CreateScale(texture.Width / 2, texture.Height / 2, 1)
                                    * Matrix.CreateRotationX(Up.X) * Matrix.CreateRotationY(Up.Y) * Matrix.CreateRotationZ(Up.Z) * Matrix.CreateRotationZ(MathHelper.Pi)
                                    * (Matrix.CreateTranslation(position + new Vector3(texture.Width / 2, texture.Height / 2, 0)));

            quadDrawer.DrawQuad(Texture, 1, world * worldModifiers, view, projection);
            quadDrawer.DrawQuad(Texture, 1, world * Matrix.CreateRotationY(MathHelper.Pi) * worldModifiers, view, projection);
        }
示例#2
0
        private void DrawPlayer(Player player, ContentManager Content, QuadDrawer quadDrawer, Vector3 cameraPosition, Matrix view, Matrix projection, Matrix groundTransform)
        {
            _3DSprite playerSprite = new _3DSprite();

            playerSprite.Texture  = player.sprite.getTintedTexture();
            playerSprite.Position = new Vector3(player.sprite.vector - new Vector2(player.sprite.getTexture().Width / 2, player.sprite.getTexture().Height / 2), 0);
            playerSprite.Up       = new Vector3(0, 0, player.playerRotation);
            playerSprite.Draw(quadDrawer, cameraPosition, view, projection, groundTransform);
            _3DSprite weaponSprite   = new _3DSprite();
            Sprite    weapon2DSprite = GetPlayerWeaponTexture(player, Content);

            weaponSprite.Texture  = weapon2DSprite.getTexture();
            weaponSprite.Position = new Vector3(weapon2DSprite.vector - new Vector2(player.sprite.getTexture().Width, player.sprite.getTexture().Height), 0);
            weaponSprite.Up       = new Vector3(0, 0, player.playerRotation);
            weaponSprite.Draw(quadDrawer, cameraPosition, view, projection, groundTransform);
        }
示例#3
0
 public _3DView(GraphicsDevice device)
 {
     quadDrawer = new QuadDrawer(device);
 }
示例#4
0
 /// <summary>
 /// Draws the entity as a billboard sprite.
 /// </summary>
 public void Draw(QuadDrawer quadDrawer, Vector3 cameraPosition,
                  Matrix view, Matrix projection)
 {
     quadDrawer.DrawQuad(Texture, 1, Matrix.Identity, view, projection);
 }