/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); basicEffect = new BasicEffect(GraphicsDevice); LedorSystem = new ParticleSystem("Sans titre", 10000, 1, BlendState.NonPremultiplied, false, Content, GraphicsDevice); LedorSystem.SetViewProjection( Matrix.CreateLookAt( new Vector3(50 * (float)Math.Sin(angle), 2, 50 * (float)Math.Cos(angle)), new Vector3(0, 0, 0), Vector3.UnitY), projection); var sphere1 = Solids.Sphere(new SphereOptions { Radius = 1, Center = new Vector3(-0.5f, 0, 0), SolidColor = Color.White }); var sphere2 = Solids.Sphere(new SphereOptions { Radius = 1, Center = new Vector3(0.5f, 0, 0), SolidColor = Color.Red }); var sphere1XNA = sphere1.Substract(sphere2); ListMesh = Convertor.csgToMeshesWithCache(sphere1XNA); vertices = new VertexPositionColorNormal[ListMesh.Count][]; indices = new short[ListMesh.Count][]; for (int M = 0; M < ListMesh.Count; ++M) { Mesh ActiveMesh = ListMesh[M]; vertices[M] = new VertexPositionColorNormal[ActiveMesh.vertices.Count]; for (int V = 0; V < ActiveMesh.vertices.Count; ++V) { vertices[M][V] = new VertexPositionColorNormal() { Position = ActiveMesh.vertices[V], Color = Color.FromNonPremultiplied((int)ActiveMesh.colors[V][0], (int)ActiveMesh.colors[V][1], (int)ActiveMesh.colors[V][2], (int)ActiveMesh.colors[V][3]), Normal = new Vector3() }; } indices[M] = new short[ActiveMesh.triangles.Count * 3]; for (int T = 0; T < ActiveMesh.triangles.Count; ++T) { indices[M][T * 3] = (short)ActiveMesh.triangles[T][0]; indices[M][T * 3 + 1] = (short)ActiveMesh.triangles[T][1]; indices[M][T * 3 + 2] = (short)ActiveMesh.triangles[T][2]; } CalculateNormals(vertices[M], indices[M]); } }