Пример #1
0
        private void SetupVertex()
        {
            this.Length = this.GhostingCount;
            for (int index = this.GhostingCount - 1; index > 0 && Math.Sqrt(((double)this.LastPoints[index].X - (double)this.LastPoints[index - 1].X) * ((double)this.LastPoints[index].X - (double)this.LastPoints[index - 1].X) + ((double)this.LastPoints[index].Y - (double)this.LastPoints[index - 1].Y) * ((double)this.LastPoints[index].Y - (double)this.LastPoints[index - 1].Y)) < 1.0; --index)
            {
                --this.Length;
            }
            if (this.Length < 2)
            {
                this.Length = 2;
            }
            TexturedVertex[] data = new TexturedVertex[2 * this.Length];
            double           num  = Math.Atan2((double)this.LastPoints[0].Y - (double)this.LastPoints[1].Y, (double)this.LastPoints[0].X - (double)this.LastPoints[1].X);

            data[0] = new TexturedVertex(new Vector3(this.LastPoints[0].X - (float)(this.Width / 2) * (float)Math.Sin(num), this.LastPoints[0].Y + (float)(this.Width / 2) * (float)Math.Cos(num), 0.0f), new Vector2(0.0f, (float)this.ColorType / 16f));
            data[1] = new TexturedVertex(new Vector3(this.LastPoints[0].X + (float)(this.Width / 2) * (float)Math.Sin(num), this.LastPoints[0].Y - (float)(this.Width / 2) * (float)Math.Cos(num), 0.0f), new Vector2(0.0f, (float)(this.ColorType + 1) / 16f));
            for (int index = 1; index < this.Length; ++index)
            {
                data[2 * index]     = new TexturedVertex(new Vector3(this.LastPoints[index].X - (float)(this.Width / 2) * (float)Math.Sin(num), this.LastPoints[index].Y + (float)(this.Width / 2) * (float)Math.Cos(num), 0.0f), new Vector2((float)index / ((float)this.Length - 1f), (float)this.ColorType / 16f));
                data[2 * index + 1] = new TexturedVertex(new Vector3(this.LastPoints[index].X + (float)(this.Width / 2) * (float)Math.Sin(num), this.LastPoints[index].Y - (float)(this.Width / 2) * (float)Math.Cos(num), 0.0f), new Vector2((float)index / ((float)this.Length - 1f), (float)(this.ColorType + 1) / 16f));
                if (this.LastPoints[index - 1] != this.LastPoints[index])
                {
                    num = Math.Atan2((double)this.LastPoints[index - 1].Y - (double)this.LastPoints[index].Y, (double)this.LastPoints[index - 1].X - (double)this.LastPoints[index].X);
                }
            }
            this.vertexBuffer.Lock(0, 0, LockFlags.Discard).WriteRange <TexturedVertex>(data);
            this.vertexBuffer.Unlock();
        }
Пример #2
0
        public override void SetupVertex()
        {
            float x1 = (float)this.TxtureObject.PosRect.X / (float)this.TxtureObject.SrcWidth;
            float x2 = (float)(this.TxtureObject.PosRect.X + this.TxtureObject.Width) / (float)this.TxtureObject.SrcWidth;

            TexturedVertex[] data = new TexturedVertex[2 * (this.Length + 1)];
            for (int index = 0; index <= this.Length; ++index)
            {
                double num1 = (double)(index * 2) * Math.PI / (double)this.Length;
                int    num2 = this.Radius - this.Width / 2;
                float  y    = (float)(index % (this.Length / 3)) / (float)(this.Length / 3);
                data[2 * index] = new TexturedVertex(new Vector3((float)num2 * (float)Math.Cos(num1), (float)num2 * (float)Math.Sin(num1), 0.0f), new Vector2(x1, y));
                int num3 = this.Radius + this.Width / 2;
                data[2 * index + 1] = new TexturedVertex(new Vector3((float)num3 * (float)Math.Cos(num1), (float)num3 * (float)Math.Sin(num1), 0.0f), new Vector2(x2, y));
            }
            this.vertexBuffer.Lock(0, 0, LockFlags.Discard).WriteRange <TexturedVertex>(data);
            this.vertexBuffer.Unlock();
        }
Пример #3
0
        public override void SetupVertex()
        {
            float x1 = TxtureObject.PosRect.X / (float)TxtureObject.SrcWidth;
            float x2 = (TxtureObject.PosRect.X + TxtureObject.Width) / (float)TxtureObject.SrcWidth;

            TexturedVertex[] data = new TexturedVertex[2 * (Length + 1)];
            for (int index = 0; index <= Length; ++index)
            {
                double num1 = (index * 2) * Math.PI / Length;
                int    num2 = Radius - Width / 2;
                float  y    = index % (Length / 3) / (float)(Length / 3);
                data[2 * index] = new TexturedVertex(new Vector3(num2 * (float)Math.Cos(num1), num2 * (float)Math.Sin(num1), 0.0f), new Vector2(x1, y));
                int num3 = Radius + Width / 2;
                data[2 * index + 1] = new TexturedVertex(new Vector3(num3 * (float)Math.Cos(num1), num3 * (float)Math.Sin(num1), 0.0f), new Vector2(x2, y));
            }
            vertexBuffer.Lock(0, 0, LockFlags.Discard).WriteRange(data);
            vertexBuffer.Unlock();
        }
Пример #4
0
 public TexturedVertex(Vector3 position, Vector2 textureCoordinate)
 {
     this                   = new TexturedVertex();
     this.Position          = position;
     this.TextureCoordinate = textureCoordinate;
 }