Esempio n. 1
0
 public TexturedColoredVertex(Vector3 position, Vector2 textureCoordinate, int color)
 {
     this              = new TexturedColoredVertex();
     Position          = position;
     TextureCoordinate = textureCoordinate;
     Color             = color;
 }
Esempio n. 2
0
        public virtual void SetupVertex()
        {
            DataStream dataStream = this.vertexBuffer.Lock(0, 0, LockFlags.Discard);
            float      x1         = -this.TxtureObject.RotatingCenter.X;
            float      x2         = (float)this.TxtureObject.Width - this.TxtureObject.RotatingCenter.X;
            float      num1       = -this.TxtureObject.RotatingCenter.Y;
            float      num2       = (float)this.TxtureObject.Height - this.TxtureObject.RotatingCenter.Y;
            float      x3         = (float)this.TxtureObject.PosRect.X / (float)this.TxtureObject.SrcWidth;
            float      x4         = (float)(this.TxtureObject.PosRect.X + this.TxtureObject.Width) / (float)this.TxtureObject.SrcWidth;
            float      num3       = (float)this.TxtureObject.PosRect.Y / (float)this.TxtureObject.SrcHeight;
            float      num4       = (float)(this.TxtureObject.PosRect.Y + this.TxtureObject.Height) / (float)this.TxtureObject.SrcHeight;

            TexturedColoredVertex[] data = new TexturedColoredVertex[2 * this.Length];
            for (int index = 0; index < this.Length; ++index)
            {
                int alpha = -10 * index + this.Time * 3;
                if (alpha < 0)
                {
                    alpha = 0;
                }
                else if (alpha > this.TransparentValue)
                {
                    alpha = this.TransparentValue;
                }
                data[2 * index]     = new TexturedColoredVertex(new Vector3(x1, num1 + (num2 - num1) * (float)index / (float)this.Length, 0.0f), new Vector2(x3, num3 + (num4 - num3) * (float)index / (float)this.Length), Color.FromArgb(alpha, this.ColorValue).ToArgb());
                data[2 * index + 1] = new TexturedColoredVertex(new Vector3(x2, num1 + (num2 - num1) * (float)index / (float)this.Length, 0.0f), new Vector2(x4, num3 + (num4 - num3) * (float)index / (float)this.Length), Color.FromArgb(alpha, this.ColorValue).ToArgb());
            }
            dataStream.WriteRange <TexturedColoredVertex>(data);
            this.vertexBuffer.Unlock();
        }