CapgeminiSurface.ParticleSystem.Update3DGeometry C# (CSharp) Méthode

Update3DGeometry() private méthode

private Update3DGeometry ( ) : void
Résultat void
        private void Update3DGeometry()
        {
            var positions = new Point3DCollection();
            var indices = new Int32Collection();
            var texcoords = new PointCollection();

            for (int i = 0; i < _particleList.Count; ++i)
            {
                int positionIndex = i*4;
                //int indexIndex = i*6;
                Particle particle = _particleList[i];

                var p1 = new Point3D(particle.Position.X, particle.Position.Y, particle.Position.Z);
                var p2 = new Point3D(particle.Position.X, particle.Position.Y + particle.Size, particle.Position.Z);
                var p3 = new Point3D(particle.Position.X + particle.Size, particle.Position.Y + particle.Size,
                                     particle.Position.Z);
                var p4 = new Point3D(particle.Position.X + particle.Size, particle.Position.Y, particle.Position.Z);

                positions.Add(p1);
                positions.Add(p2);
                positions.Add(p3);
                positions.Add(p4);

                var t1 = new Point(0.0, 0.0);
                var t2 = new Point(0.0, 1.0);
                var t3 = new Point(1.0, 1.0);
                var t4 = new Point(1.0, 0.0);

                texcoords.Add(t1);
                texcoords.Add(t2);
                texcoords.Add(t3);
                texcoords.Add(t4);

                indices.Add(positionIndex);
                indices.Add(positionIndex + 2);
                indices.Add(positionIndex + 1);
                indices.Add(positionIndex);
                indices.Add(positionIndex + 3);
                indices.Add(positionIndex + 2);
            }

            ((MeshGeometry3D) _particleModel.Geometry).Positions = positions;
            ((MeshGeometry3D) _particleModel.Geometry).TriangleIndices = indices;
            ((MeshGeometry3D) _particleModel.Geometry).TextureCoordinates = texcoords;
        }