Esempio n. 1
0
        public void Begin(PrimitiveType primitiveType)
        {
            if (this.hasBegun)
            {
                throw new InvalidOperationException("End must be called before Begin can be called again.");
            }
            if (primitiveType == PrimitiveType.LineStrip) // TODO: Validate. || primitiveType == 6 || primitiveType == 5)
            {
                throw new NotSupportedException("The specified primitiveType is not supported by PrimitiveBatch.");
            }
            this.primitiveType        = primitiveType;
            this.numVertsPerPrimitive = PrimitiveBatch.NumVertsPerPrimitive(primitiveType);
            //this.device.set_VertexDeclaration(this.vertexDeclaration); TODO: Validate.
            BasicEffect basicEffect = this.basicEffect;
            double      num1        = 0.0;
            Viewport    viewport    = this.device.Viewport;
            // ISSUE: explicit reference operation
            double width = (double)((Viewport)@viewport).Width;

            viewport = this.device.Viewport;
            // ISSUE: explicit reference operation
            double height = (double)((Viewport)@viewport).Height;
            double num2   = 0.0;
            double num3   = 0.0;
            double num4   = 1.0;
            Matrix orthographicOffCenter = Matrix.CreateOrthographicOffCenter((float)num1, (float)width, (float)height, (float)num2, (float)num3, (float)num4);

            basicEffect.Projection = orthographicOffCenter;
            // TODO: Validate.
            basicEffect.CurrentTechnique.Passes[0].Apply();
            //((Effect) this.basicEffect).Begin();
            //((Effect) this.basicEffect).get_CurrentTechnique().get_Passes().get_Item(0).Begin();
            // TODO: Validate.
            this.hasBegun = true;
        }
Esempio n. 2
0
 public void Draw(SpriteBatch spriteBatch, PrimitiveBatch primitiveBatch, bool animate, ListView.ListViewItemCollection entVis)
 {
     if (this.assetTexture != null)
     {
         spriteBatch.Begin(SpriteSortMode.Immediate); // TODO: Validate. (SpriteBlendMode) 1);
         for (int index1 = 0; (long)index1 < 1L + (long)this.Width / (long)this.assetTexture.Width; ++index1)
         {
             for (int index2 = 0; (long)index2 < 1L + (long)this.Height / (long)this.assetTexture.Height; ++index2)
             {
                 spriteBatch.Draw(this.assetTexture, new Vector2((float)(index1 * this.assetTexture.Width), (float)(index2 * this.assetTexture.Height)), Microsoft.Xna.Framework.Color.White);
             }
         }
         spriteBatch.End();
     }
     primitiveBatch.Begin((PrimitiveType)2);
     for (int index1 = 0; index1 < this.entities.Count; ++index1)
     {
         if (this.entities[index1].GetType() == typeof(EndangeredEd.Entities.MA_Node))
         {
             for (int index2 = 0; index2 < (this.entities[index1] as EndangeredEd.Entities.MA_Node).Neighbours.Count; ++index2)
             {
                 primitiveBatch.AddVertex(this.entities[index1].Position, Microsoft.Xna.Framework.Color.White);
                 for (int index3 = 0; index3 < this.entities.Count; ++index3)
                 {
                     if (this.entities[index3].GetType() == typeof(EndangeredEd.Entities.MA_Node) && (this.entities[index3] as EndangeredEd.Entities.MA_Node).NodeID == (this.entities[index1] as EndangeredEd.Entities.MA_Node).Neighbours[index2])
                     {
                         primitiveBatch.AddVertex(this.entities[index3].Position, Microsoft.Xna.Framework.Color.White);
                         break;
                     }
                 }
             }
         }
     }
     primitiveBatch.End();
     spriteBatch.Begin();
     for (int index1 = 0; index1 < this.entities.Count; ++index1)
     {
         for (int index2 = 0; index2 < entVis.Count; ++index2)
         {
             if (this.entities[index1].GetType().Name == entVis[index2].Text)
             {
                 if (entVis[index2].Checked)
                 {
                     this.entities[index1].Draw(spriteBatch, animate);
                 }
                 index2 = entVis.Count;
             }
         }
     }
     spriteBatch.End();
 }