/* * EmitterInfo.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 Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Storage; using Microsoft.Xna.Framework.Graphics; namespace TACParticleEngine.Emitters { /// /// This class is used for storing all the information used for the emitter object /// public class EmitterInfo { #region Fields /// /// The name of the emitter type /// private string mType; /// /// Drawing specific compontents /// private string mTextureName; private SpriteBlendMode mBlendEffect; // List of positions for when creating spline emitters private List mPositions; /// /// Values for the direction range in two-dimensional form /// private Vector3 mMinVel; private Vector3 mMaxVel; /// /// Values for determining lifetimes and the amounts of existing and spawning particles /// private float mEmitLifetime; private int mParticlePersSec; private int mParticleAmount; private float mParticleLifetime; /// /// Values for the starting and ending speed magnitude ranges /// private float mMinStartSpeed; private float mMaxStartSpeed; private float mMinEndSpeed; private float mMaxEndSpeed; /// /// Values used for starting and ending size ranges in two-dimensional form /// private Vector2 mMinStartSize; private Vector2 mMaxStartSize; private Vector2 mMinEndSize; private Vector2 mMaxEndSize; /// /// Values used for starting and ending color ranges in RGBA form /// private Vector4 mMinStartColor; private Vector4 mMaxStartColor; private Vector4 mMinEndColor; private Vector4 mMaxEndColor; // Direction for particles to move in. // *Note* if given with values < -1 or > 1, will just move randomly private Vector3 mDirection; // The box dimensions for determining where a particle spawns // *Note* each dimension value implies -/+ the value with 0 as the origin private Vector3 mSprayRange; // Scale size of positions in relation to origin private float mScale = 1f; // The speed at which the scaling occurs private float mScaleSpeed = 0.1f; #endregion #region Properties /// /// Gets/Sets the name of the emitter type /// public string Type { get { return mType; } set { mType = value; } } /// /// Gets/Sets the name of the texture to be used for drawing /// public string TextureName { get { return mTextureName; } set { mTextureName = value; } } /// /// Gets/Sets the blend effect to be used for drawing, usually either Additive or AlphaBlend /// public SpriteBlendMode BlendEffect { get { return mBlendEffect; } set { mBlendEffect = value; } } /// /// Gets/Sets the list of positions for when creating emitters /// *Note* multiple positions indicates a spline emitter /// public List Positions { get { return mPositions; } set { mPositions = value; } } /// /// Gets/Sets the box dimensions for determining where a particle spawns /// *Note* each dimension value implies -/+ the value with 0 as the origin /// public Vector3 SprayRange { get { return mSprayRange; } set { mSprayRange = value; } } /// /// Gets/Sets the direction of the emitter /// *Note* if given with values less than -1 or greater than 1, will just move randomly /// public Vector3 Direction { get { return mDirection; } set { mDirection = value; } } /// /// Gets/Sets the minimum end of the range of velocity /// public Vector3 MinVel { get { return mMinVel; } set { mMinVel = value; } } /// /// Gets/Sets the maximum end of the range of velocity /// public Vector3 MaxVel { get { return mMaxVel; } set { mMaxVel = value; } } /// /// Gets/Sets the lifetime of the emitter in seconds /// public float EmitLifetime { get { return mEmitLifetime; } set { mEmitLifetime = value; } } /// /// Gets/Sets the amount of particles created every second /// public int ParticlePersSec { get { return mParticlePersSec; } set { mParticlePersSec = value; } } /// /// Gets/Sets the maximum amount of particles that be stored in the emitter /// public int ParticleAmount { get { return mParticleAmount; } set { mParticleAmount = value; } } /// /// Gets/Sets the lifetime of a particle in seconds /// public float ParticleLifetime { get { return mParticleLifetime; } set { mParticleLifetime = value; } } /// /// Gets/Sets the minimum starting speed for the speed magnitude range /// public float MinStartSpeed { get { return mMinStartSpeed; } set { mMinStartSpeed = value; } } /// /// Gets/Sets the maximum starting speed for the speed magnitude range /// public float MaxStartSpeed { get { return mMaxStartSpeed; } set { mMaxStartSpeed = value; } } /// /// Gets/Sets the minimum ending speed for the speed magnitude range /// public float MinEndSpeed { get { return mMinEndSpeed; } set { mMinEndSpeed = value; } } /// /// Gets/Sets the maximum ending speed for the speed magnitude range /// public float MaxEndSpeed { get { return mMaxEndSpeed; } set { mMaxEndSpeed = value; } } /// /// Gets/Sets the minimum starting size in two-dimensional form for the size ranges /// public Vector2 MinStartSize { get { return mMinStartSize; } set { mMinStartSize = value; } } /// /// Gets/Sets the maximum starting size in two-dimensional form for the size ranges /// public Vector2 MaxStartSize { get { return mMaxStartSize; } set { mMaxStartSize = value; } } /// /// Gets/Sets the minimum ending size in two-dimensional form for the size ranges /// public Vector2 MinEndSize { get { return mMinEndSize; } set { mMinEndSize = value; } } /// /// Gets/Sets the maximum ending size in two-dimensional form for the size ranges /// public Vector2 MaxEndSize { get { return mMaxEndSize; } set { mMaxEndSize = value; } } /// /// Gets/Sets the minimum starting color in RGBA form for the color ranges /// public Vector4 MinStartColor { get { return mMinStartColor; } set { mMinStartColor = value; } } /// /// Gets/Sets the maximum starting color in RGBA form for the color ranges /// public Vector4 MaxStartColor { get { return mMaxStartColor; } set { mMaxStartColor = value; } } /// /// Gets/Sets the minimum ending color in RGBA form for the color ranges /// public Vector4 MinEndColor { get { return mMinEndColor; } set { mMinEndColor = value; } } /// /// Gets/Sets the maximum ending color in RGBA form for the color ranges /// public Vector4 MaxEndColor { get { return mMaxEndColor; } set { mMaxEndColor = value; } } /// /// Gets/Sets the scaling value for positions for every update /// public float Scale { get { return mScale; } set { mScale = value; } } /// /// Gets/Sets the speed at which the scaling occurs /// public float ScaleSpeed { get { return mScaleSpeed; } set { mScaleSpeed = value; } } #endregion #region Creation /// /// Default constuctor used to initialize all vectors and lists /// public EmitterInfo() { mPositions = new List(); mMinVel = new Vector3(); mMaxVel = new Vector3(); mMinStartSize = new Vector2(); mMaxStartSize = new Vector2(); mMinEndSize = new Vector2(); mMaxEndSize = new Vector2(); mMinStartColor = new Vector4(); mMaxStartColor = new Vector4(); mMinEndColor = new Vector4(); mMaxEndColor = new Vector4(); } #endregion } }