Exemplo n.º 1
0
        public override void CreateVertices(float time)
        {
            explosionVertices = new VertexExplosion[count * 6];

            int i = 0;

            for (int partnr = 0; partnr < count; ++partnr)
            {
                float   r1            = (float)rand.NextDouble() - 0.5f;
                float   r2            = (float)rand.NextDouble() - 0.5f;
                float   r3            = (float)rand.NextDouble() - 0.5f;
                Vector3 moveDirection = new Vector3(r1, r2, r3);
                moveDirection.Normalize();

                float r4 = (float)rand.NextDouble();
                r4 = r4 / 4.0f * 3.0f + 0.25f;

                explosionVertices[i++] = new VertexExplosion(position,
                                                             new Vector4(1, 1, time, 1000), new Vector4(moveDirection, r4));
                explosionVertices[i++] = new VertexExplosion(position,
                                                             new Vector4(0, 0, time, 1000), new Vector4(moveDirection, r4));
                explosionVertices[i++] = new VertexExplosion(position,
                                                             new Vector4(1, 0, time, 1000), new Vector4(moveDirection, r4));

                explosionVertices[i++] = new VertexExplosion(position,
                                                             new Vector4(1, 1, time, 1000), new Vector4(moveDirection, r4));
                explosionVertices[i++] = new VertexExplosion(position,
                                                             new Vector4(0, 1, time, 1000), new Vector4(moveDirection, r4));
                explosionVertices[i++] = new VertexExplosion(position,
                                                             new Vector4(0, 0, time, 1000), new Vector4(moveDirection, r4));
            }
        }
Exemplo n.º 2
0
        public override void CreateVertices(float time)
        {
            explosionVertices = new VertexExplosion[count * 6];

            int i = 0;
            for (int partnr = 0; partnr < count; ++partnr)
            {
                float r1 = (float)rand.NextDouble() - 0.5f;
                float r2 = (float)rand.NextDouble() - 0.5f;
                float r3 = (float)rand.NextDouble() - 0.5f;
                Vector3 moveDirection = new Vector3(r1, r2, r3);
                moveDirection.Normalize();

                float r4 = (float)rand.NextDouble();
                r4 = r4 / 4.0f * 3.0f + 0.25f;

                explosionVertices[i++] = new VertexExplosion(position,
                    new Vector4(1, 1, time, 1000), new Vector4(moveDirection, r4));
                explosionVertices[i++] = new VertexExplosion(position,
                    new Vector4(0, 0, time, 1000), new Vector4(moveDirection, r4));
                explosionVertices[i++] = new VertexExplosion(position,
                    new Vector4(1, 0, time, 1000), new Vector4(moveDirection, r4));

                explosionVertices[i++] = new VertexExplosion(position,
                    new Vector4(1, 1, time, 1000), new Vector4(moveDirection, r4));
                explosionVertices[i++] = new VertexExplosion(position,
                    new Vector4(0, 1, time, 1000), new Vector4(moveDirection, r4));
                explosionVertices[i++] = new VertexExplosion(position,
                    new Vector4(0, 0, time, 1000), new Vector4(moveDirection, r4));
            }
        }