/// <summary>
        /// Zeichnet das 3D Modell auf den Bildschirm.
        /// </summary>
        /// <param name="spriteBatch">Wird zum Zeichnen von 2D Grafik benötigt</param>
        public override void Draw(SpriteBatch spriteBatch)
        {
            //aktuelle Position des des 3D Modells
            Vector3 currentPosition = PlaneProjector.Convert2DTo3D(GameItem.Position);
            Matrix  rotation        = Matrix.Identity;

            if (currentPosition.Z > this.lastPosition.Z || currentPosition.Z < this.lastPosition.Z)
            {
                /* Berechnet die neue Position des 3D Modells falls sich diese geändert haben sollte.
                 *
                 * Falsche Positionierung im 3D-Raum gefixt - TB
                 * */
                this.World = Matrix.CreateWorld(currentPosition, Vector3.Backward, Vector3.Up);
                //Position aktualisieren
                this.lastPosition = currentPosition;
            }
            //Je nach Bewegungsrichtung des Spielers wird das Schiff in die entsprechende Richtung geneigt.
            else if (currentPosition.X > this.lastPosition.X)
            {
                this.World        = Matrix.CreateWorld(currentPosition, Vector3.Backward, Vector3.Up);
                rotation          = Matrix.CreateRotationZ(MathHelper.ToRadians(15));
                this.lastPosition = currentPosition;
            }
            else if (currentPosition.X < this.lastPosition.X)
            {
                this.World        = Matrix.CreateWorld(currentPosition, Vector3.Backward, Vector3.Up);
                rotation          = Matrix.CreateRotationZ(MathHelper.ToRadians(-15));
                this.lastPosition = currentPosition;
            }
            ((ModelHitsphere)GameItem.BoundingVolume).World = this.World;

            /*
             * WICHTIG!
             * Zurücksetzen des DepthStencils um eine fehlerfreie Kombination von 2D-Sprite und 3D-Model
             * zeichnen zu können.
             * */
            this.graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.LightingEnabled = true;
                    effect.SpecularColor   = new Vector3(1.0f, 1.0f, 1.0f);
                    effect.SpecularPower   = 100.0f;
                    effect.DiffuseColor    = new Vector3(1.0f, 1.0f, 1.0f);
                    effect.Texture         = this.alienTexture;
                    effect.View            = Camera;
                    effect.Projection      = Projection;
                    effect.World           = rotation * this.World;
                }

                mesh.Draw();
            }
        }
        /*
         * <WAHL>
         * Wird benötigt wenn eine Partikel Engine eingebaut wird.
         *
         * private Explosion explosion;
         * */


        /// /// <summary>
        /// Erstellt eine Representation eines Aliens.
        /// </summary>
        /// <param name="alienGameItem">Alien Datenmodell</param>
        /// <param name="randomTexture">Wird zufällig generiert und kann unterschiedliche Texturen zuordnen.</param>
        /// <param name="graphics">Verbindungselement zu Grafikkarte</param>
        public AlienRepresentation(Alien alienGameItem, int randomTexture, GraphicsDeviceManager graphics)
        {
            this.graphics     = graphics;
            this.model        = ViewContent.RepresentationContent.AlienModel;
            GameItem          = alienGameItem; //Hält das zugehörige Datenmodel des Aliens, für die "isAlive"-Prüfung
            this.lastPosition = PlaneProjector.Convert2DTo3D(GameItem.Position);
            this.World        = Matrix.CreateWorld(this.lastPosition, Vector3.Backward, Vector3.Up);

            //zuweisen einer zufälligen Textur, die an Hand von 'randomTexture' vorher im ViewManager ausgewählt wurde
            this.alienTexture = ViewContent.RepresentationContent.AlienTextures[randomTexture];
        }
Exemplo n.º 3
0
        /// <summary>
        /// Zeichnet das Projektil
        /// </summary>
        /// <param name="spriteBatch">spriteBatch</param>
        public override void Draw(SpriteBatch spriteBatch)
        {
            //DephStencilState setzen damit 3D und 2D Objekte gleichzeitig richtig angezeigt werden können
            this.graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            //Rotationsmatrix für Projektile mit schräger Flugrichtung
            Matrix rotate = Matrix.Identity;

            //Neue, aktuelle Position des Projektil GameItems
            Vector3 newPosition = PlaneProjector.Convert2DTo3D(GameItem.Position);

            //Wenn sich die X-Richtung verändert, also das Projektil schräg fliegt soll es auch schräg gezeichnet werden
            if (newPosition.Z > this.position.Z || newPosition.Z < this.position.Z)
            {
                if (newPosition.X > this.position.X || newPosition.X < this.position.X)
                {
                    //Nach rechts/links drehen abhängig von der Flugrichtung
                    rotate = Matrix.CreateRotationZ(MathHelper.ToRadians((float)(Math.Atan((newPosition.X - this.position.X) / (newPosition.Z - this.position.Z)))));
                }
                this.position = newPosition;
            }


            //Skalierung
            float scaleWidth  = 0.1f;
            float scaleHeight = 0.1f;


            //Projektil nach 'unten' versetzen, damit es unter dem Schiff erscheint
            Vector3 lower = new Vector3(0, -6, 0);

            //Im Raum Positionieren
            this.World = rotate * Matrix.CreateScale(scaleWidth, 0.0f, scaleHeight) * Matrix.CreateTranslation(this.position + lower);

            //Hitsphere setzen
            ((ModelHitsphere)GameItem.BoundingVolume).World = World;


            effect.TextureEnabled = true;
            effect.Texture        = texture;
            effect.View           = Camera;
            effect.DiffuseColor   = this.colorProjectile;
            effect.Projection     = Projection;
            effect.World          = this.World;

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

                //Das Primitive-Rechteck zeichnen
                graphics.GraphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, vertices, 0, 4, indices, 0, 2);
            }
        }
Exemplo n.º 4
0
        /*
         * <WAHL>
         * Wird benötigt falls eine Partikel Engine eingebaut wird
         * private Explosion explosion;
         * */


        /// <summary>
        /// Erstellt eine Representation des Mutterschiff-Aliens.
        /// </summary>
        public MothershipRepresentation(Mothership mothershipGameItem, GraphicsDeviceManager graphics)
        {
            this.graphics          = graphics;
            this.model             = ViewContent.RepresentationContent.MothershipModel;
            GameItem               = mothershipGameItem;
            this.mothershipTexture = ViewContent.RepresentationContent.MothershipTexture;
            this.lastPosition      = PlaneProjector.Convert2DTo3D(GameItem.Position);
            this.World             = Matrix.CreateWorld(lastPosition, Vector3.Right, Vector3.Up);

            //[Anji] Schiffs-Antrieb
            this.mothershipEngine = (MothershipEngine)createParticleEngine(ViewContent.RepresentationContent.MothershipEngineTexture, PlaneProjector.ToScreenCoordinates(lastPosition, graphics), 1f, new Color(255, 96, 167));
        }
        /// <summary>
        ///  Erstellt anhand einer 2D Grafik eine Hitsphere, welche die komplette Grafik umgibt.
        /// </summary>
        /// <param name="graphic">Grafik von der die Hitsphere zu berechnen ist.</param>
        /// <returns>Hitsphere für die 2D Grafik</returns>
        private static ModelHitsphere computeBigTextureHitsphere(Texture2D graphic)
        {
            Debug.Assert(graphic != null, "Die Referenz auf die 2D Textur ist nicht vorhanden!");
            //Berechnen einer halben Diagonalen der Textur
            Vector2 corner = new Vector2(graphic.Width / 2.0f, graphic.Height / 2.0f);
            //Konvertierung von 2D in 3D
            Vector3 corner2 = PlaneProjector.Convert2DTo3D(corner);
            //Vektornorm bilden um den Radius der Hitsphere zu bestimmen
            float radius = corner2.Length();

            return(new ModelHitsphere(new BoundingSphere(Vector3.Zero, radius)));
        }
Exemplo n.º 6
0
        /*
         * <WAHL>
         * Wird benötigt wenn eine Partikel Engine eingebaut wird.
         * private Explosion explosion;
         * */

        /// <summary>
        /// Erstellt eine Representation der Spielerfigur.
        /// </summary>
        public PlayerRepresentation(Player playerGameItem, GraphicsDeviceManager graphics)
        {
            this.graphics        = graphics;
            this.model           = ViewContent.RepresentationContent.PlayerModel;
            GameItem             = playerGameItem;
            this.playerTexture   = ViewContent.RepresentationContent.PlayerTexture;
            this.shieldTexture   = ViewContent.RepresentationContent.ShipShieldTexture;
            this.lastPosition    = PlaneProjector.Convert2DTo3D(GameItem.Position);
            this.World           = Matrix.CreateWorld(this.lastPosition, Vector3.Forward, Vector3.Up);
            this.invincibleCount = 0;

            //[Anji] Schiffs-Antrieb
            this.playerShipEngine = (PlayerShipEngine)createParticleEngine(ViewContent.RepresentationContent.ShipEngineTexture, PlaneProjector.ToScreenCoordinates(lastPosition, graphics), 0.5f, Color.LightBlue); //new Color(190,195,217));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Erstellt eine Representation eines PowerUps.
        /// <param name="graphics">GraphicsDeviceManager</param>
        /// <param name="powerUp">übergebenes PowerUp-Objekt</param>
        /// <param name="texture">Textur des PowerUps</param>
        /// </summary>
        public PowerUpRepresentation(PowerUp powerUp, Texture2D texture, Color color, GraphicsDeviceManager graphics)
        {
            GameItem      = powerUp;
            this.texture  = texture;
            this.model    = ViewContent.RepresentationContent.PowerUp;
            this.position = PlaneProjector.Convert2DTo3D(GameItem.Position);
            this.graphics = graphics;

            //Winkel in °
            this.angle         = 0.0f;
            this.rotationSpeed = 1.0f;
            this.World         = Matrix.CreateWorld(this.position, Vector3.Forward, Vector3.Up);

            this.powerUpGlitter = (PowerUpGlitter)createParticleEngine(ViewContent.RepresentationContent.GlitterTexture, PlaneProjector.ToScreenCoordinates(position, graphics), 0.2f, color);
            this.color          = color;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Zeichnet das Mutterschiff auf den Bildschirm
        /// </summary>
        /// <param name="spriteBatch">SpriteBatch zum Zeichnen</param>
        public override void Draw(SpriteBatch spriteBatch)
        {
            Vector3 currentPosition = PlaneProjector.Convert2DTo3D(GameItem.Position);

            //Bei jeder Bewegung wird die Worldmatrix neu gesetzt und die Hitsphere angepasst.
            if (currentPosition.X > this.lastPosition.X || currentPosition.X < this.lastPosition.X)
            {
                this.World = Matrix.CreateWorld(currentPosition, Vector3.Right, Vector3.Up);
                ((ModelHitsphere)GameItem.BoundingVolume).World = World;
                this.lastPosition = currentPosition;
            }

            //[Anji]
            mothershipEngine.EmitterLocation = PlaneProjector.ToScreenCoordinates(lastPosition + new Vector3(-45, 0, 0), graphics);
            mothershipEngine.Draw(spriteBatch);

            /*
             * WICHTIG!
             * Zurücksetzen des DepthStencils um eine fehlerfreie Kombination von 2D-Sprite und 3D-Model
             * zeichnen zu können.
             * */
            this.graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.LightingEnabled = true;
                    effect.SpecularColor   = new Vector3(1.0f, 1.0f, 1.0f);
                    effect.SpecularPower   = 100.0f;
                    effect.DiffuseColor    = new Vector3(1.0f, 1.0f, 1.0f);
                    effect.Texture         = this.mothershipTexture;
                    effect.World           = this.World;
                    effect.View            = Camera;
                    effect.Projection      = Projection;
                }

                mesh.Draw();
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Erstellt eine Representation eines Projektils.
        /// </summary>
        /// <param name="projectile">Projektil(Typ)</param>
        /// <param name="texture">Projektiltextur</param>
        /// <param name="graphics">DeviceManager</param>
        /// <param name="effect">BasicEffect</param>
        /// <param name="color">Projektilfärbung</param>
        public ProjectileRepresentation(Projectile projectile, Texture2D texture, GraphicsDeviceManager graphics, BasicEffect effect, Vector3 color)
        {
            GameItem             = projectile;
            this.texture         = texture;
            this.colorProjectile = color;
            this.position        = PlaneProjector.Convert2DTo3D(GameItem.Position);
            this.graphics        = graphics;
            this.effect          = effect;
            this.World           = Matrix.CreateWorld(this.position, Vector3.Forward, Vector3.Up);

            //Eckpunkte des Rechtecks
            this.vertices = new VertexPositionColorTexture[4];

            //6 Punkte für zwei polygone, um ein Rechteck zu zeichnen
            this.indices = new int[6];

            //1. Polygon: Punkte 0,1,2 im Urzeigersinn
            indices[0] = 0;
            indices[1] = 1;
            indices[2] = 2;
            //2. Polygon: Punkte 1,3,2 im Urzeigersinn
            indices[3] = 1;
            indices[4] = 3;
            indices[5] = 2;

            //3-dimensionales Rechteck aufbauen für die 3 dimensionale Darstellung des Projektils (mit Hitsphere)
            Vector3 leftBot  = PlaneProjector.Convert2DTo3D(new Vector2(-texture.Width / 2.0f, -texture.Height / 2.0f));
            Vector3 leftTop  = PlaneProjector.Convert2DTo3D(new Vector2(-texture.Width / 2.0f, texture.Height / 2.0f));
            Vector3 rightBot = PlaneProjector.Convert2DTo3D(new Vector2(texture.Width / 2.0f, -texture.Height / 2.0f));
            Vector3 rightTop = PlaneProjector.Convert2DTo3D(new Vector2(texture.Width / 2.0f, texture.Height / 2.0f));

            vertices[0] = new VertexPositionColorTexture(leftBot, Color.Red, new Vector2(0, 0));
            vertices[1] = new VertexPositionColorTexture(leftTop, Color.Red, new Vector2(0, 1));
            vertices[2] = new VertexPositionColorTexture(rightBot, Color.Red, new Vector2(1, 0));
            vertices[3] = new VertexPositionColorTexture(rightTop, Color.Red, new Vector2(1, 1));
        }
Exemplo n.º 10
0
        /// <summary>
        /// Zeichnet das PowerUp.
        /// </summary>
        /// <param name="spriteBatch">spriteBatch</param>
        public override void Draw(SpriteBatch spriteBatch)
        {
            this.angle += rotationSpeed;

            Vector3 currentPosition = PlaneProjector.Convert2DTo3D(GameItem.Position);
            Matrix  rotation        = Matrix.CreateRotationZ(MathHelper.ToRadians(this.angle));

            this.World = rotation * Matrix.CreateWorld(currentPosition, Vector3.Backward, Vector3.Up);

            //Setzen der Hitsphere
            ((ModelHitsphere)GameItem.BoundingVolume).World = this.World;

            //DephStencilState setzen damit 3D und 2D Objekte gleichzeitig richtig angezeigt werden können
            this.graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.LightingEnabled = true;
                    effect.SpecularColor   = new Vector3(1.0f, 1.0f, 1.0f);
                    effect.SpecularPower   = 100.0f;
                    effect.DiffuseColor    = new Vector3(1.0f, 1.0f, 1.0f);
                    effect.Texture         = this.texture;
                    effect.View            = Camera;
                    effect.Projection      = Projection;
                    effect.World           = this.World;
                }

                mesh.Draw();
            }

            //Glitter
            powerUpGlitter.EmitterLocation = PlaneProjector.ToScreenCoordinates(currentPosition, graphics);
            powerUpGlitter.Draw(spriteBatch);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Zeichnet das Spielerschiff auf den Bildschirm.
        /// </summary>
        /// <param name="spriteBatch">SpriteBatch zum Zeichnen</param>
        public override void Draw(SpriteBatch spriteBatch)
        {
            Vector3 currentPosition = PlaneProjector.Convert2DTo3D(GameItem.Position);
            Matrix  rotation        = Matrix.Identity;

            //[Anji] ShipEngine
            playerShipEngine.EmitterLocation = PlaneProjector.ToScreenCoordinates(lastPosition + new Vector3(0, 0, 45), graphics);
            playerShipEngine.Draw(spriteBatch);

            bool invincible = ((Player)this.GameItem).IsInvincible;

            if (invincible)
            {
                if (this.invincibleCount > 8)
                {
                    this.invincibleCount = 0;
                }
                this.invincibleCount++;
            }

            //Je nach Bewegungsrichtung des Spielers wird das Schiff in die entsprechende Richtung geneigt.
            if (currentPosition.X > this.lastPosition.X)
            {
                this.World        = Matrix.CreateWorld(currentPosition, Vector3.Forward, Vector3.Up);
                rotation          = Matrix.CreateRotationZ(MathHelper.ToRadians(-25));
                this.lastPosition = currentPosition;
            }
            else if (currentPosition.X < this.lastPosition.X)
            {
                this.World        = Matrix.CreateWorld(currentPosition, Vector3.Forward, Vector3.Up);
                rotation          = Matrix.CreateRotationZ(MathHelper.ToRadians(25));
                this.lastPosition = currentPosition;
            }
            ((ModelHitsphere)GameItem.BoundingVolume).World = this.World;


            /*
             * WICHTIG!
             * Zurücksetzen des DepthStencils um eine fehlerfreie Kombination von 2D-Sprite und 3D-Model
             * zeichnen zu können.
             * */
            this.graphics.GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            if (invincible && this.invincibleCount == 8)
            {
            }
            else
            {
                foreach (ModelMesh mesh in model.Meshes)
                {
                    foreach (BasicEffect effect in mesh.Effects)
                    {
                        effect.LightingEnabled = true;
                        effect.SpecularColor   = new Vector3(1.0f, 1.0f, 1.0f);
                        effect.SpecularPower   = 100.0f;
                        effect.DiffuseColor    = new Vector3(1.0f, 1.0f, 1.0f);
                        effect.Texture         = this.playerTexture;
                        effect.View            = Camera;
                        effect.Projection      = Projection;
                        effect.World           = rotation * this.World;
                        //[Anji] Schifftextur ändern wenn Schild-PowerUp aktiv
                        if (GameItem.Hitpoints > GameItemConstants.PlayerHitpoints)
                        {
                            effect.Texture = this.shieldTexture;
                        }
                    }

                    mesh.Draw();
                }
            }
        }
Exemplo n.º 12
0
        float frameSize = 1 / 5f; // 1 wäre die Gesamtlänge vom Texture-Atlas



        /// <summary>
        /// Erstellt eine Representation eines stationären Schildes.
        /// </summary>
        public ShieldRepresentation(Shield shield, GraphicsDeviceManager graphics)
        {
            this.texture  = ViewContent.RepresentationContent.ShieldTexture;
            GameItem      = shield;
            this.position = PlaneProjector.Convert2DTo3D(GameItem.Position);
            this.graphics = graphics;
            this.World    = Matrix.CreateWorld(this.position, Vector3.Forward, Vector3.Up);
            this.effect   = new BasicEffect(graphics.GraphicsDevice);
            this.update   = 0;

            // UNDONE: alter Code - TB
            ////Eckpunkte des Rechtecks
            //this.vertices = new VertexPositionColorTexture[4];
            ////6 Punkte für zwei polygone, um ein Rechteck zu zeichnen
            //this.indices = new int[6];

            ////Skalierung
            //float scaleWidth = 0.03f;
            //float scaleHeight = 0.03f;

            ////Eckpunkte in 3D ebene "Aufstellen"
            //Vector3 erect = new Vector3(0, 50, 0);

            ////Viereck aufbauen
            //Vector3 leftBot = PlaneProjector.Convert2DTo3D(new Vector2(-texture.Width / 2.0f, -texture.Height / 2.0f));
            //Vector3 leftTop = PlaneProjector.Convert2DTo3D(new Vector2(-texture.Width / 2.0f, texture.Height / 2.0f));
            //Vector3 rightBot = PlaneProjector.Convert2DTo3D(new Vector2(texture.Width / 2.0f, -texture.Height/2.0f));
            //Vector3 rightTop = PlaneProjector.Convert2DTo3D(new Vector2(texture.Width / 2.0f, texture.Height / 2.0f));

            //Vector2 textureLeftBot = new Vector2(0, 0);
            //Vector2 textureLeftTop = new Vector2(0, 1 / 5f);
            //Vector2 textureRightBot = new Vector2(1 / 5f, 0);
            //Vector2 textureRightTop = new Vector2(1 / 5f, 1 / 5f);

            //Color color2 = new Color(0, 150, 255);
            //Color color1 = new Color(0, 210, 255);
            //vertices[0] = new VertexPositionColorTexture(leftBot, color1, textureLeftBot);
            //vertices[1] = new VertexPositionColorTexture(leftTop, color1, textureLeftTop);
            //vertices[2] = new VertexPositionColorTexture(rightBot, color2, textureRightBot);
            //vertices[3] = new VertexPositionColorTexture(rightTop, color2, textureRightTop);


            ////Positionieren
            //this.World = Matrix.CreateScale(scaleWidth, 0.0f, scaleHeight) * (Matrix.CreateRotationX(MathHelper.ToRadians(45)) * Matrix.CreateTranslation(this.position));

            ////1. Polygon: Punkte 0,1,2 im Urzeigersinn
            //indices[0] = 0;
            //indices[1] = 1;
            //indices[2] = 2;
            ////2. Polygon: Punkte 1,3,2 im Urzeigersinn
            //indices[3] = 1;
            //indices[4] = 3;
            //indices[5] = 2;


            // neuer Code - TB

            //Eckpunkte der Rechtecke
            this.vertices = new VertexPositionColorTexture[12];
            //18 Punkte für 6 polygone, um 3 Rechtecke zu zeichnen
            this.indices = new int[18];

            //Skalierung
            float scaleWidth  = 0.03f;
            float scaleHeight = 0.03f;

            //Größe des Schilds
            shieldSize = 750;
            //Größe des Schildrandes
            borderSize = 75;
            //Relative Größe des Randes zum ganzen Schild
            relBorderSize = (float)borderSize / (float)shieldSize;

            //Vierecke aufbauen
            Vector3[] leftRect   = new Vector3[4];
            Vector3[] middleRect = new Vector3[4];
            Vector3[] rightRect  = new Vector3[4];

            leftRect[0] = PlaneProjector.Convert2DTo3D(new Vector2(-texture.Width / 2.0f, -texture.Height / 2.0f));                //links unten
            leftRect[1] = PlaneProjector.Convert2DTo3D(new Vector2(-texture.Width / 2.0f, texture.Height / 2.0f));                 //links oben
            leftRect[2] = PlaneProjector.Convert2DTo3D(new Vector2(-texture.Width / 2.0f + borderSize, -texture.Height / 2.0f));   //rechts unten
            leftRect[3] = PlaneProjector.Convert2DTo3D(new Vector2(-texture.Width / 2.0f + borderSize, texture.Height / 2.0f));    //rechts oben

            middleRect[0] = PlaneProjector.Convert2DTo3D(new Vector2(-texture.Width / 2.0f + borderSize, -texture.Height / 2.0f)); //links unten
            middleRect[1] = PlaneProjector.Convert2DTo3D(new Vector2(-texture.Width / 2.0f + borderSize, texture.Height / 2.0f));  //links oben
            middleRect[2] = PlaneProjector.Convert2DTo3D(new Vector2(texture.Width / 2.0f - borderSize, -texture.Height / 2.0f));  //rechts unten
            middleRect[3] = PlaneProjector.Convert2DTo3D(new Vector2(texture.Width / 2.0f - borderSize, texture.Height / 2.0f));   //rechts oben

            rightRect[0] = PlaneProjector.Convert2DTo3D(new Vector2(texture.Width / 2.0f - borderSize, -texture.Height / 2.0f));   //links unten
            rightRect[1] = PlaneProjector.Convert2DTo3D(new Vector2(texture.Width / 2.0f - borderSize, texture.Height / 2.0f));    //links oben
            rightRect[2] = PlaneProjector.Convert2DTo3D(new Vector2(texture.Width / 2.0f, -texture.Height / 2.0f));                //rechts unten
            rightRect[3] = PlaneProjector.Convert2DTo3D(new Vector2(texture.Width / 2.0f, texture.Height / 2.0f));                 //rechts oben

            //Texturkoordinaten berechnen
            leftRectTexCoords   = new Vector2[4];
            middleRectTexCoords = new Vector2[4];
            rightRectTexCoords  = new Vector2[4];

            leftRectTexCoords[0] = new Vector2(0, 0);                                  //links unten
            leftRectTexCoords[1] = new Vector2(0, 1 / 5f);                             //links oben
            leftRectTexCoords[2] = new Vector2(relBorderSize / 5f, 0);                 //rechts unten
            leftRectTexCoords[3] = new Vector2(relBorderSize / 5f, 1 / 5f);            //rechts oben

            middleRectTexCoords[0] = new Vector2(relBorderSize / 5f, 0);               //links unten
            middleRectTexCoords[1] = new Vector2(relBorderSize / 5f, 1 / 5f);          //links oben
            middleRectTexCoords[2] = new Vector2((1.0f - relBorderSize) / 5f, 0);      //rechts unten
            middleRectTexCoords[3] = new Vector2((1.0f - relBorderSize) / 5f, 1 / 5f); //rechts oben

            rightRectTexCoords[0] = new Vector2((1.0f - relBorderSize) / 5f, 0);       //links unten
            rightRectTexCoords[1] = new Vector2((1.0f - relBorderSize) / 5f, 1 / 5f);  //links oben
            rightRectTexCoords[2] = new Vector2(1.0f / 5f, 0);                         //rechts unten
            rightRectTexCoords[3] = new Vector2(1.0f / 5f, 1 / 5f);                    //rechts oben


            //Vertices erstellen
            for (int i = 0; i < 4; i++)
            {
                //linkes Viereck
                vertices[i] = new VertexPositionColorTexture(leftRect[i], Color.White, leftRectTexCoords[i]);
                //mittleres Viereck
                vertices[i + 4] = new VertexPositionColorTexture(middleRect[i], new Color(0, 1.0f, 0), middleRectTexCoords[i]);
                //rechtes Viereck
                vertices[i + 8] = new VertexPositionColorTexture(rightRect[i], Color.White, rightRectTexCoords[i]);
            }

            //Indizes zuweisen
            for (int i = 0; i < 3; i++)
            {
                indices[6 * i + 0] = 0 + i * 4;
                indices[6 * i + 1] = 1 + i * 4;
                indices[6 * i + 2] = 2 + i * 4;
                indices[6 * i + 3] = 1 + i * 4;
                indices[6 * i + 4] = 3 + i * 4;
                indices[6 * i + 5] = 2 + i * 4;
            }

            //Positionieren
            this.World = Matrix.CreateScale(scaleWidth, 0.0f, scaleHeight) * (Matrix.CreateRotationX(MathHelper.ToRadians(45)) * Matrix.CreateTranslation(this.position));
        }