/* * Particle.cs * Authors: Brian Murphy * Copyright (c) 2007-2008 Cornell University This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections.Generic; using System.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace TACParticleEngine.Particles { /// /// Particle structure for storing various non-graphical information of particles /// public struct Particle { /// /// Bool for whether the paricle is alive or not /// public bool alive; /// /// The amount of lifetime a particle will live for /// public float lifetime; /// /// The current lifetime of the particle /// public float currentLife; /// /// Vector used for the starting size of the particle via two-dimensions /// public Vector2 startSize; /// /// Vector used for the ending size of the particle via two-dimensions /// public Vector2 endSize; /// /// Vector used for the starting velocity of the particle via two-dimensions /// public Vector3 startVelocity; /// /// Vector used for the ending velocity of the particle via two-dimensions /// public Vector3 endVelocity; /// /// Vector used for the starting color of the particle via RGBA /// public Vector4 startColor; /// /// Vector used for the starting color of the particle via RGBA /// public Vector4 endColor; }; /// /// Particle structure for storing various graphical information of particles /// public struct VertexParticle { /// /// Vector used for the size of the particle via two-dimensions /// public Vector2 size; /// /// Current position of the particle via three-dimensions /// public Vector3 position; /// /// Vector used for the color of the particle via RGBA /// public Vector4 color; /// /// Describe the layout of this structure for data size for GPU /// public static readonly VertexElement[] VertexElements = { // Size data new VertexElement(0, 0, VertexElementFormat.Vector2, VertexElementMethod.Default, VertexElementUsage.PointSize, 0), // Position data new VertexElement(0, 8, VertexElementFormat.Vector3, VertexElementMethod.Default, VertexElementUsage.Position, 0), // Color data new VertexElement(0, 20, VertexElementFormat.Vector4, VertexElementMethod.Default, VertexElementUsage.Color, 0) }; } }