Exemple #1
0
        // Token: 0x06000D4F RID: 3407 RVA: 0x003E2E9C File Offset: 0x003E109C
        private unsafe void InternalDraw(Texture2D texture, ref Vector4 destination, bool scaleDestination, ref Rectangle?sourceRectangle, ref VertexColors colors, ref Vector2 origin, SpriteEffects effects, float rotation)
        {
            if (this._queuedSpriteCount >= this._spriteDataQueue.Length)
            {
                Array.Resize <TileBatch.SpriteData>(ref this._spriteDataQueue, this._spriteDataQueue.Length << 1);
            }

            fixed(TileBatch.SpriteData *ptr = &this._spriteDataQueue[this._queuedSpriteCount])
            {
                float num  = destination.Z;
                float num2 = destination.W;

                if (sourceRectangle.HasValue)
                {
                    Rectangle value = sourceRectangle.Value;
                    ptr->Source.X = (float)value.X;
                    ptr->Source.Y = (float)value.Y;
                    ptr->Source.Z = (float)value.Width;
                    ptr->Source.W = (float)value.Height;
                    if (scaleDestination)
                    {
                        num  *= (float)value.Width;
                        num2 *= (float)value.Height;
                    }
                }
                else
                {
                    float num3 = (float)texture.Width;
                    float num4 = (float)texture.Height;
                    ptr->Source.X = 0f;
                    ptr->Source.Y = 0f;
                    ptr->Source.Z = num3;
                    ptr->Source.W = num4;
                    if (scaleDestination)
                    {
                        num  *= num3;
                        num2 *= num4;
                    }
                }
                ptr->Destination.X = destination.X;
                ptr->Destination.Y = destination.Y;
                ptr->Destination.Z = num;
                ptr->Destination.W = num2;
                ptr->Origin.X      = origin.X;
                ptr->Origin.Y      = origin.Y;
                ptr->Effects       = effects;
                ptr->Colors        = colors;
                ptr->Rotation      = rotation;
            }

            if (this._spriteTextures == null || this._spriteTextures.Length != this._spriteDataQueue.Length)
            {
                Array.Resize <Texture2D>(ref this._spriteTextures, this._spriteDataQueue.Length);
            }
            Texture2D[] arg_1E7_0         = this._spriteTextures;
            int         queuedSpriteCount = this._queuedSpriteCount;

            this._queuedSpriteCount      = queuedSpriteCount + 1;
            arg_1E7_0[queuedSpriteCount] = texture;
        }
Exemple #2
0
        private unsafe void InternalDraw(Texture2D texture, ref Vector4 destination, bool scaleDestination, ref Rectangle?sourceRectangle, ref VertexColors colors, ref Vector2 origin, SpriteEffects effects, float rotation)
        {
            if (this._queuedSpriteCount >= this._spriteDataQueue.Length)
            {
                Array.Resize <TileBatch.SpriteData>(ref this._spriteDataQueue, this._spriteDataQueue.Length << 1);
                fixed(TileBatch.SpriteData *spriteDataPtr = &this._spriteDataQueue[this._queuedSpriteCount])
                {
                    float z = destination.Z;
                    float w = destination.W;

                    if (sourceRectangle.HasValue)
                    {
                        Rectangle rectangle = sourceRectangle.Value;
                        spriteDataPtr->Source.X = (float)rectangle.X;
                        spriteDataPtr->Source.Y = (float)rectangle.Y;
                        spriteDataPtr->Source.Z = (float)rectangle.Width;
                        spriteDataPtr->Source.W = (float)rectangle.Height;
                        if (scaleDestination)
                        {
                            z *= (float)rectangle.Width;
                            w *= (float)rectangle.Height;
                        }
                    }
                    else
                    {
                        float width  = (float)texture.Width;
                        float height = (float)texture.Height;
                        spriteDataPtr->Source.X = 0.0f;
                        spriteDataPtr->Source.Y = 0.0f;
                        spriteDataPtr->Source.Z = width;
                        spriteDataPtr->Source.W = height;
                        if (scaleDestination)
                        {
                            z *= width;
                            w *= height;
                        }
                    }
                    spriteDataPtr->Destination.X = destination.X;
                    spriteDataPtr->Destination.Y = destination.Y;
                    spriteDataPtr->Destination.Z = z;
                    spriteDataPtr->Destination.W = w;
                    spriteDataPtr->Origin.X      = origin.X;
                    spriteDataPtr->Origin.Y      = origin.Y;
                    spriteDataPtr->Effects       = effects;
                    spriteDataPtr->Colors        = colors;
                    spriteDataPtr->Rotation      = rotation;
                }

                if (this._spriteTextures == null || this._spriteTextures.Length != this._spriteDataQueue.Length)
                {
                    Array.Resize <Texture2D>(ref this._spriteTextures, this._spriteDataQueue.Length);
                }
                Texture2D[] spriteTextures = this._spriteTextures;
                int queuedSpriteCount      = this._queuedSpriteCount;
                this._queuedSpriteCount = queuedSpriteCount + 1;
                int index           = queuedSpriteCount;
                Texture2D texture2D = texture;
                spriteTextures[index] = texture2D;
        }
Exemple #3
0
 public void Draw(
     Texture2D texture,
     Vector4 destination,
     Rectangle?sourceRectangle,
     VertexColors colors)
 {
     this.InternalDraw(texture, ref destination, false, ref sourceRectangle, ref colors, ref TileBatch._vector2Zero, SpriteEffects.None, 0.0f);
 }
        private unsafe void InternalDraw(Texture2D texture, Vector4 destination, bool scaleDestination, Rectangle?sourceRectangle, VertexColors colors, Vector2 origin, SpriteEffects effects, float rotation)
        {
            if (_queuedSpriteCount >= _spriteDataQueue.Length)
            {
                Array.Resize(ref _spriteDataQueue, _spriteDataQueue.Length << 1);
            }

            fixed(SpriteData *ptr = &_spriteDataQueue[_queuedSpriteCount])
            {
                float num  = destination.Z;
                float num2 = destination.W;

                if (sourceRectangle.HasValue)
                {
                    Rectangle value = sourceRectangle.Value;
                    ptr->Source.X = value.X;
                    ptr->Source.Y = value.Y;
                    ptr->Source.Z = value.Width;
                    ptr->Source.W = value.Height;
                    if (scaleDestination)
                    {
                        num  *= (float)value.Width;
                        num2 *= (float)value.Height;
                    }
                }
                else
                {
                    float num3 = texture.Width;
                    float num4 = texture.Height;
                    ptr->Source.X = 0f;
                    ptr->Source.Y = 0f;
                    ptr->Source.Z = num3;
                    ptr->Source.W = num4;
                    if (scaleDestination)
                    {
                        num  *= num3;
                        num2 *= num4;
                    }
                }
                ptr->Destination.X = destination.X;
                ptr->Destination.Y = destination.Y;
                ptr->Destination.Z = num;
                ptr->Destination.W = num2;
                ptr->Origin.X      = origin.X;
                ptr->Origin.Y      = origin.Y;
                ptr->Effects       = effects;
                ptr->Colors        = colors;
                ptr->Rotation      = rotation;
            }

            if (_spriteTextures == null || _spriteTextures.Length != _spriteDataQueue.Length)
            {
                Array.Resize(ref _spriteTextures, _spriteDataQueue.Length);
            }
            _spriteTextures[_queuedSpriteCount++] = texture;
        }
Exemple #5
0
 public void Draw(Texture2D texture, Vector2 position, VertexColors colors, Vector2 scale)
 {
     this.InternalDraw(texture, ref new Vector4()
     {
         X = position.X,
         Y = position.Y,
         Z = scale.X,
         W = scale.Y
     }, true, ref TileBatch._nullRectangle, ref colors, ref TileBatch._vector2Zero, SpriteEffects.None, 0.0f);
 }
        public void Draw(Texture2D texture, Vector2 position, VertexColors colors)
        {
            Vector4 destination = default(Vector4);

            destination.X = position.X;
            destination.Y = position.Y;
            destination.Z = 1f;
            destination.W = 1f;
            InternalDraw(texture, destination, scaleDestination: true, _nullRectangle, colors, _vector2Zero, SpriteEffects.None, 0f);
        }
Exemple #7
0
        public void Draw(Texture2D texture, Vector2 position, VertexColors colors)
        {
            Vector4 vector = default(Vector4);

            vector.X = position.X;
            vector.Y = position.Y;
            vector.Z = 1f;
            vector.W = 1f;
            InternalDraw(texture, ref vector, true, ref nullRectangle, ref colors, ref vector2Zero, SpriteEffects.None);
        }
Exemple #8
0
        public void Draw(Texture2D texture, Vector2 position, VertexColors colors, Vector2 scale)
        {
            Vector4 destination = (Vector4)null;

            destination.X = position.X;
            destination.Y = position.Y;
            destination.Z = scale.X;
            destination.W = scale.Y;
            this.InternalDraw(texture, ref destination, true, ref TileBatch._nullRectangle, ref colors, ref TileBatch._vector2Zero, (SpriteEffects)0, 0.0f);
        }
Exemple #9
0
        // Token: 0x06000D4A RID: 3402 RVA: 0x003E2D0C File Offset: 0x003E0F0C
        public void Draw(Texture2D texture, Vector2 position, VertexColors colors, Vector2 scale)
        {
            Vector4 vector = default(Vector4);

            vector.X = position.X;
            vector.Y = position.Y;
            vector.Z = scale.X;
            vector.W = scale.Y;
            this.InternalDraw(texture, ref vector, true, ref TileBatch._nullRectangle, ref colors, ref TileBatch._vector2Zero, SpriteEffects.None, 0f);
        }
Exemple #10
0
        public void Draw(Texture2D texture, Vector2 position, VertexColors colors, Vector2 scale)
        {
            Vector4 destination = default(Vector4);

            destination.X = position.X;
            destination.Y = position.Y;
            destination.Z = scale.X;
            destination.W = scale.Y;
            InternalDraw(texture, ref destination, true, ref nullRectangle, ref colors, ref vector2Zero, SpriteEffects.None);
        }
Exemple #11
0
        private unsafe void InternalDraw(Texture2D texture, ref Vector4 destination, bool scaleDestination, ref Rectangle?sourceRectangle, ref VertexColors colors, ref Vector2 origin, SpriteEffects effects)
        {
            if (queuedSpriteCount >= spriteDataQueue.Length)
            {
                Array.Resize <SpriteData>(ref spriteDataQueue, spriteDataQueue.Length << 1);

                fixed(SpriteData *ptr = &spriteDataQueue[queuedSpriteCount])
                {
                    float num  = destination.Z;
                    float num2 = destination.W;

                    if (sourceRectangle.HasValue)
                    {
                        Rectangle value = sourceRectangle.Value;
                        ptr->Source.X = (float)value.X;
                        ptr->Source.Y = (float)value.Y;
                        ptr->Source.Z = (float)value.Width;
                        ptr->Source.W = (float)value.Height;
                        if (scaleDestination)
                        {
                            num  *= (float)value.Width;
                            num2 *= (float)value.Height;
                        }
                    }
                    else
                    {
                        float num3 = (float)texture.Width;
                        float num4 = (float)texture.Height;
                        ptr->Source.X = 0f;
                        ptr->Source.Y = 0f;
                        ptr->Source.Z = num3;
                        ptr->Source.W = num4;
                        if (scaleDestination)
                        {
                            num  *= num3;
                            num2 *= num4;
                        }
                    }

                    ptr->Destination.X = destination.X;
                    ptr->Destination.Y = destination.Y;
                    ptr->Destination.Z = num;
                    ptr->Destination.W = num2;
                    ptr->Origin.X      = origin.X;
                    ptr->Origin.Y      = origin.Y;
                    ptr->Effects       = effects;
                    ptr->Colors        = colors;
                }

                if (spriteTextures == null || spriteTextures.Length != spriteDataQueue.Length)
                {
                    Array.Resize <Texture2D>(ref spriteTextures, spriteDataQueue.Length);
                }
                spriteTextures[queuedSpriteCount++] = texture;
        }
Exemple #12
0
 public void Draw(
     Texture2D texture,
     Vector4 destination,
     Rectangle?sourceRectangle,
     VertexColors colors,
     Vector2 origin,
     SpriteEffects effects,
     float rotation)
 {
     this.InternalDraw(texture, ref destination, false, ref sourceRectangle, ref colors, ref origin, effects, rotation);
 }
Exemple #13
0
        public void Draw(Texture2D texture, Vector2 position, VertexColors colors)
        {
            Vector4 v4 = new Vector4()
            {
                X = position.X,
                Y = position.Y,
                Z = 1f,
                W = 1f
            };

            this.InternalDraw(texture, ref v4, true, ref TileBatch._nullRectangle, ref colors, ref TileBatch._vector2Zero, SpriteEffects.None, 0.0f);
        }
Exemple #14
0
 public void Draw(
     Texture2D texture,
     Rectangle destinationRectangle,
     Rectangle?sourceRectangle,
     VertexColors colors)
 {
     this.InternalDraw(texture, ref new Vector4()
     {
         X = (float)destinationRectangle.X,
         Y = (float)destinationRectangle.Y,
         Z = (float)destinationRectangle.Width,
         W = (float)destinationRectangle.Height
     }, false, ref sourceRectangle, ref colors, ref TileBatch._vector2Zero, SpriteEffects.None, 0.0f);
 }
Exemple #15
0
 public void Draw(
     Texture2D texture,
     Vector2 position,
     Rectangle?sourceRectangle,
     VertexColors colors,
     Vector2 origin,
     float scale,
     SpriteEffects effects)
 {
     this.InternalDraw(texture, ref new Vector4()
     {
         X = position.X,
         Y = position.Y,
         Z = scale,
         W = scale
     }, true, ref sourceRectangle, ref colors, ref origin, effects, 0.0f);
 }
Exemple #16
0
        public void Draw(Texture2D texture, Vector2 position, Rectangle?sourceRectangle, VertexColors colors, Vector2 origin, float scale, SpriteEffects effects)
        {
            Vector4 destination = default(Vector4);

            destination.X = position.X;
            destination.Y = position.Y;
            destination.Z = scale;
            destination.W = scale;
            InternalDraw(texture, ref destination, true, ref sourceRectangle, ref colors, ref origin, effects);
        }
Exemple #17
0
        public void Draw(Texture2D texture, Vector2 position, Rectangle?sourceRectangle, VertexColors colors, Vector2 origin, float scale, SpriteEffects effects)
        {
            Vector4 destination = (Vector4)null;

            destination.X = position.X;
            destination.Y = position.Y;
            destination.Z = (__Null)(double)scale;
            destination.W = (__Null)(double)scale;
            this.InternalDraw(texture, ref destination, true, ref sourceRectangle, ref colors, ref origin, effects, 0.0f);
        }
Exemple #18
0
 public void Draw(Texture2D texture, Vector4 destination, VertexColors colors)
 {
     this.InternalDraw(texture, ref destination, false, ref TileBatch._nullRectangle, ref colors, ref TileBatch._vector2Zero, (SpriteEffects)0, 0.0f);
 }
Exemple #19
0
        public void Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle?sourceRectangle, VertexColors colors)
        {
            Vector4 destination = (Vector4)null;

            destination.X = (__Null)(double)(float)destinationRectangle.X;
            destination.Y = (__Null)(double)(float)destinationRectangle.Y;
            destination.Z = (__Null)(double)(float)destinationRectangle.Width;
            destination.W = (__Null)(double)(float)destinationRectangle.Height;
            this.InternalDraw(texture, ref destination, false, ref sourceRectangle, ref colors, ref TileBatch._vector2Zero, (SpriteEffects)0, 0.0f);
        }
Exemple #20
0
        public void Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle?sourceRectangle, VertexColors colors)
        {
            Vector4 vector = default(Vector4);

            vector.X = (float)destinationRectangle.X;
            vector.Y = (float)destinationRectangle.Y;
            vector.Z = (float)destinationRectangle.Width;
            vector.W = (float)destinationRectangle.Height;
            InternalDraw(texture, ref vector, false, ref sourceRectangle, ref colors, ref vector2Zero, SpriteEffects.None);
        }
Exemple #21
0
 public void Draw(Texture2D texture, Vector2 position, VertexColors colors, Vector2 scale)
 {
     Vector4 vector = default(Vector4);
     vector.X = position.X;
     vector.Y = position.Y;
     vector.Z = scale.X;
     vector.W = scale.Y;
     InternalDraw(texture, ref vector, true, ref nullRectangle, ref colors, ref vector2Zero, SpriteEffects.None);
 }
 public void Draw(Texture2D texture, Vector4 destination, Rectangle?sourceRectangle, VertexColors colors)
 {
     InternalDraw(texture, destination, scaleDestination: false, sourceRectangle, colors, _vector2Zero, SpriteEffects.None, 0f);
 }
 public void Draw(Texture2D texture, Vector4 destination, Rectangle?sourceRectangle, VertexColors colors, Vector2 origin, SpriteEffects effects, float rotation)
 {
     InternalDraw(texture, destination, scaleDestination: false, sourceRectangle, colors, origin, effects, rotation);
 }
		public void Draw(Texture2D texture, Vector2 position, VertexColors colors)
		{
			Vector4 vector = default(Vector4);
			vector.X = position.X;
			vector.Y = position.Y;
			vector.Z = 1f;
			vector.W = 1f;
			this.InternalDraw(texture, ref vector, true, ref TileBatch.nullRectangle, ref colors, ref TileBatch.vector2Zero, SpriteEffects.None);
		}
		private unsafe void InternalDraw(Texture2D texture, ref Vector4 destination, bool scaleDestination, ref Rectangle? sourceRectangle, ref VertexColors colors, ref Vector2 origin, SpriteEffects effects)
		{
			if (this.queuedSpriteCount >= this.spriteDataQueue.Length)
			{
				Array.Resize<TileBatch.SpriteData>(ref this.spriteDataQueue, this.spriteDataQueue.Length << 1);
			}
			fixed (TileBatch.SpriteData* ptr = &this.spriteDataQueue[this.queuedSpriteCount])
			{
				float num = destination.Z;
				float num2 = destination.W;
				if (sourceRectangle.HasValue)
				{
					Rectangle value = sourceRectangle.Value;
					ptr->Source.X = (float)value.X;
					ptr->Source.Y = (float)value.Y;
					ptr->Source.Z = (float)value.Width;
					ptr->Source.W = (float)value.Height;
					if (scaleDestination)
					{
						num *= (float)value.Width;
						num2 *= (float)value.Height;
					}
				}
				else
				{
					float num3 = (float)texture.Width;
					float num4 = (float)texture.Height;
					ptr->Source.X = 0f;
					ptr->Source.Y = 0f;
					ptr->Source.Z = num3;
					ptr->Source.W = num4;
					if (scaleDestination)
					{
						num *= num3;
						num2 *= num4;
					}
				}
				ptr->Destination.X = destination.X;
				ptr->Destination.Y = destination.Y;
				ptr->Destination.Z = num;
				ptr->Destination.W = num2;
				ptr->Origin.X = origin.X;
				ptr->Origin.Y = origin.Y;
				ptr->Effects = effects;
				ptr->Colors = colors;
			}
			if (this.spriteTextures == null || this.spriteTextures.Length != this.spriteDataQueue.Length)
			{
				Array.Resize<Texture2D>(ref this.spriteTextures, this.spriteDataQueue.Length);
			}
			this.spriteTextures[this.queuedSpriteCount++] = texture;
		}
		public void Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle? sourceRectangle, VertexColors colors)
		{
			Vector4 vector = default(Vector4);
			vector.X = (float)destinationRectangle.X;
			vector.Y = (float)destinationRectangle.Y;
			vector.Z = (float)destinationRectangle.Width;
			vector.W = (float)destinationRectangle.Height;
			this.InternalDraw(texture, ref vector, false, ref sourceRectangle, ref colors, ref TileBatch.vector2Zero, SpriteEffects.None);
		}
		public void Draw(Texture2D texture, Vector4 destination, VertexColors colors)
		{
			this.InternalDraw(texture, ref destination, false, ref TileBatch.nullRectangle, ref colors, ref TileBatch.vector2Zero, SpriteEffects.None);
		}
Exemple #28
0
        public void Draw(Texture2D texture, Rectangle destinationRectangle, Rectangle?sourceRectangle, VertexColors colors)
        {
            Vector4 destination = default(Vector4);

            destination.X = destinationRectangle.X;
            destination.Y = destinationRectangle.Y;
            destination.Z = destinationRectangle.Width;
            destination.W = destinationRectangle.Height;
            InternalDraw(texture, ref destination, false, ref sourceRectangle, ref colors, ref vector2Zero, SpriteEffects.None);
        }
Exemple #29
0
 public void Draw(Texture2D texture, Vector4 destination, VertexColors colors)
 {
     InternalDraw(texture, ref destination, false, ref nullRectangle, ref colors, ref vector2Zero, SpriteEffects.None);
 }
Exemple #30
0
 public static void GetColor4Slice_New(int centerX, int centerY, out VertexColors vertices, Color centerColor, float scale = 1f)
 {
     int num = centerX - Lighting.firstTileX + Lighting.offScreenTiles;
     int num2 = centerY - Lighting.firstTileY + Lighting.offScreenTiles;
     if (num <= 0 || num2 <= 0 || num >= Main.screenWidth / 16 + Lighting.offScreenTiles * 2 + 10 - 1 || num2 >= Main.screenHeight / 16 + Lighting.offScreenTiles * 2 - 1)
     {
         vertices.BottomLeftColor = Color.Black;
         vertices.BottomRightColor = Color.Black;
         vertices.TopLeftColor = Color.Black;
         vertices.TopRightColor = Color.Black;
         return;
     }
     float num3 = (float)centerColor.R / 255f;
     float num4 = (float)centerColor.G / 255f;
     float num5 = (float)centerColor.B / 255f;
     Lighting.LightingState lightingState = Lighting.states[num][num2 - 1];
     Lighting.LightingState lightingState2 = Lighting.states[num][num2 + 1];
     Lighting.LightingState lightingState3 = Lighting.states[num - 1][num2];
     Lighting.LightingState lightingState4 = Lighting.states[num + 1][num2];
     Lighting.LightingState lightingState5 = Lighting.states[num - 1][num2 - 1];
     Lighting.LightingState lightingState6 = Lighting.states[num + 1][num2 - 1];
     Lighting.LightingState lightingState7 = Lighting.states[num - 1][num2 + 1];
     Lighting.LightingState lightingState8 = Lighting.states[num + 1][num2 + 1];
     float num6 = Lighting.brightness * scale * 255f * 0.25f;
     float num7 = (lightingState.r + lightingState5.r + lightingState3.r + num3) * num6;
     float num8 = (lightingState.g + lightingState5.g + lightingState3.g + num4) * num6;
     float num9 = (lightingState.b + lightingState5.b + lightingState3.b + num5) * num6;
     if (num7 > 255f)
     {
         num7 = 255f;
     }
     if (num8 > 255f)
     {
         num8 = 255f;
     }
     if (num9 > 255f)
     {
         num9 = 255f;
     }
     vertices.TopLeftColor = new Color((int)((byte)num7), (int)((byte)num8), (int)((byte)num9), 255);
     num7 = (lightingState.r + lightingState6.r + lightingState4.r + num3) * num6;
     num8 = (lightingState.g + lightingState6.g + lightingState4.g + num4) * num6;
     num9 = (lightingState.b + lightingState6.b + lightingState4.b + num5) * num6;
     if (num7 > 255f)
     {
         num7 = 255f;
     }
     if (num8 > 255f)
     {
         num8 = 255f;
     }
     if (num9 > 255f)
     {
         num9 = 255f;
     }
     vertices.TopRightColor = new Color((int)((byte)num7), (int)((byte)num8), (int)((byte)num9), 255);
     num7 = (lightingState2.r + lightingState7.r + lightingState3.r + num3) * num6;
     num8 = (lightingState2.g + lightingState7.g + lightingState3.g + num4) * num6;
     num9 = (lightingState2.b + lightingState7.b + lightingState3.b + num5) * num6;
     if (num7 > 255f)
     {
         num7 = 255f;
     }
     if (num8 > 255f)
     {
         num8 = 255f;
     }
     if (num9 > 255f)
     {
         num9 = 255f;
     }
     vertices.BottomLeftColor = new Color((int)((byte)num7), (int)((byte)num8), (int)((byte)num9), 255);
     num7 = (lightingState2.r + lightingState8.r + lightingState4.r + num3) * num6;
     num8 = (lightingState2.g + lightingState8.g + lightingState4.g + num4) * num6;
     num9 = (lightingState2.b + lightingState8.b + lightingState4.b + num5) * num6;
     if (num7 > 255f)
     {
         num7 = 255f;
     }
     if (num8 > 255f)
     {
         num8 = 255f;
     }
     if (num9 > 255f)
     {
         num9 = 255f;
     }
     vertices.BottomRightColor = new Color((int)((byte)num7), (int)((byte)num8), (int)((byte)num9), 255);
 }
		public void Draw(Texture2D texture, Vector2 position, Rectangle? sourceRectangle, VertexColors colors, Vector2 origin, float scale, SpriteEffects effects)
		{
			Vector4 vector = default(Vector4);
			vector.X = position.X;
			vector.Y = position.Y;
			vector.Z = scale;
			vector.W = scale;
			this.InternalDraw(texture, ref vector, true, ref sourceRectangle, ref colors, ref origin, effects);
		}
Exemple #32
0
 public static void GetColor4Slice_New(int centerX, int centerY, out VertexColors vertices, Color centerColor, float scale = 1f)
 {
     int index1 = centerX - Lighting.firstTileX + Lighting.offScreenTiles;
     int index2 = centerY - Lighting.firstTileY + Lighting.offScreenTiles;
     if (index1 <= 0 || index2 <= 0 || (index1 >= Main.screenWidth / 16 + Lighting.offScreenTiles * 2 + 10 - 1 || index2 >= Main.screenHeight / 16 + Lighting.offScreenTiles * 2 - 1))
     {
         vertices.BottomLeftColor = Color.Black;
         vertices.BottomRightColor = Color.Black;
         vertices.TopLeftColor = Color.Black;
         vertices.TopRightColor = Color.Black;
     }
     else
     {
         float num1 = (float)centerColor.R / (float)byte.MaxValue;
         float num2 = (float)centerColor.G / (float)byte.MaxValue;
         float num3 = (float)centerColor.B / (float)byte.MaxValue;
         Lighting.LightingState lightingState1 = Lighting.states[index1][index2 - 1];
         Lighting.LightingState lightingState2 = Lighting.states[index1][index2 + 1];
         Lighting.LightingState lightingState3 = Lighting.states[index1 - 1][index2];
         Lighting.LightingState lightingState4 = Lighting.states[index1 + 1][index2];
         Lighting.LightingState lightingState5 = Lighting.states[index1 - 1][index2 - 1];
         Lighting.LightingState lightingState6 = Lighting.states[index1 + 1][index2 - 1];
         Lighting.LightingState lightingState7 = Lighting.states[index1 - 1][index2 + 1];
         Lighting.LightingState lightingState8 = Lighting.states[index1 + 1][index2 + 1];
         float num4 = (float)((double)Lighting.brightness * (double)scale * (double)byte.MaxValue * 0.25);
         float num5 = (lightingState1.r + lightingState5.r + lightingState3.r + num1) * num4;
         float num6 = (lightingState1.g + lightingState5.g + lightingState3.g + num2) * num4;
         float num7 = (lightingState1.b + lightingState5.b + lightingState3.b + num3) * num4;
         if ((double)num5 > (double)byte.MaxValue)
             num5 = (float)byte.MaxValue;
         if ((double)num6 > (double)byte.MaxValue)
             num6 = (float)byte.MaxValue;
         if ((double)num7 > (double)byte.MaxValue)
             num7 = (float)byte.MaxValue;
         vertices.TopLeftColor = new Color((int)(byte)num5, (int)(byte)num6, (int)(byte)num7, (int)byte.MaxValue);
         float num8 = (lightingState1.r + lightingState6.r + lightingState4.r + num1) * num4;
         float num9 = (lightingState1.g + lightingState6.g + lightingState4.g + num2) * num4;
         float num10 = (lightingState1.b + lightingState6.b + lightingState4.b + num3) * num4;
         if ((double)num8 > (double)byte.MaxValue)
             num8 = (float)byte.MaxValue;
         if ((double)num9 > (double)byte.MaxValue)
             num9 = (float)byte.MaxValue;
         if ((double)num10 > (double)byte.MaxValue)
             num10 = (float)byte.MaxValue;
         vertices.TopRightColor = new Color((int)(byte)num8, (int)(byte)num9, (int)(byte)num10, (int)byte.MaxValue);
         float num11 = (lightingState2.r + lightingState7.r + lightingState3.r + num1) * num4;
         float num12 = (lightingState2.g + lightingState7.g + lightingState3.g + num2) * num4;
         float num13 = (lightingState2.b + lightingState7.b + lightingState3.b + num3) * num4;
         if ((double)num11 > (double)byte.MaxValue)
             num11 = (float)byte.MaxValue;
         if ((double)num12 > (double)byte.MaxValue)
             num12 = (float)byte.MaxValue;
         if ((double)num13 > (double)byte.MaxValue)
             num13 = (float)byte.MaxValue;
         vertices.BottomLeftColor = new Color((int)(byte)num11, (int)(byte)num12, (int)(byte)num13, (int)byte.MaxValue);
         float num14 = (lightingState2.r + lightingState8.r + lightingState4.r + num1) * num4;
         float num15 = (lightingState2.g + lightingState8.g + lightingState4.g + num2) * num4;
         float num16 = (lightingState2.b + lightingState8.b + lightingState4.b + num3) * num4;
         if ((double)num14 > (double)byte.MaxValue)
             num14 = (float)byte.MaxValue;
         if ((double)num15 > (double)byte.MaxValue)
             num15 = (float)byte.MaxValue;
         if ((double)num16 > (double)byte.MaxValue)
             num16 = (float)byte.MaxValue;
         vertices.BottomRightColor = new Color((int)(byte)num14, (int)(byte)num15, (int)(byte)num16, (int)byte.MaxValue);
     }
 }
Exemple #33
0
        // Token: 0x06000D48 RID: 3400 RVA: 0x003E2C88 File Offset: 0x003E0E88
        public void Draw(Texture2D texture, Vector2 position, Rectangle?sourceRectangle, VertexColors colors, Vector2 origin, float scale, SpriteEffects effects)
        {
            Vector4 vector = default(Vector4);

            vector.X = position.X;
            vector.Y = position.Y;
            vector.Z = scale;
            vector.W = scale;
            this.InternalDraw(texture, ref vector, true, ref sourceRectangle, ref colors, ref origin, effects, 0f);
        }