Пример #1
0
 public Particle(
     ParticleEmitter parent,
     Vector3D position,
     Vector3D velocity,
     Vector3D acceleration,
     double angle,
     double angVel,
     Vector3D col,
     double trans,
     double transDelta,
     double size,
     double sizeDelta,
     double ttl,
     int txtIndex
     )
 {
     this.parentEmitter = parent;
     this.position = position;
     this.velocity = velocity;
     this.acceleration = acceleration;
     this.angle = angle;
     this.angularVelocity = angVel;
     this.color = col;
     this.transparency = trans;
     this.transparencyDelta = transDelta;
     this.size = size;
     this.sizeDelta = sizeDelta;
     this.TTL = ttl;
     this.TextureIndex = txtIndex;
 }
Пример #2
0
 public Projectile(String fileName,
     Vector3D position,
     Vector3D velocity,
     Vector3D acceleration,
     double angle,
     double angVel,
     Vector3D color,
     double trans,
     double transDelta,
     double size,
     double sizeDelta,
     double ttl,
     int txtIndex)
     : base(null, 
     position,
     velocity,
     acceleration,
     angle,
     angVel,
     color,
     trans,
     transDelta,
     size,
     sizeDelta,
     ttl,
     txtIndex)
 {
     EmitterList = new List<ParticleEmitter>();
     XmlDocument doc = new XmlDocument();
     doc.Load(fileName);
     LoadFromXML(doc);
 }
Пример #3
0
 /**
  * XML-based contructor. Initializes emitter
  * with parameters from xmlFileName.
  **/
 public XNAEmitter(Game p, Vector2 location, String xmlFileName, double pLevel = 1.0, double pScaling = 1.0)
     : base(pLevel, pScaling)
 {
     XmlDocument doc = new XmlDocument();
     Location = new Vector3D(location.X, location.Y, 0);
     parent = p;
     doc.Load(xmlFileName);
     LoadXMLEmitter(doc);
     LoadXNAXMLParameters(doc);
 }
Пример #4
0
 /**
  * Explicit contructor initializes emitter with
  * specified parameters.
  **/
 public XNAEmitter(
     Vector3D positionMean, Vector3D positionVar, Distribution pDist,
     Vector3D velocityMean, Vector3D velocityVar, Distribution vDist,
     Vector3D accelerationMean, Vector3D accelerationVar, Distribution aDist,
     double angleMean, double angleVar, Distribution angDist,
     double angVelocityMean, double angVelocityVar, Distribution angVelDist,
     Vector3D colorMean, Vector3D colorVar, Distribution colDist,
     double alphaMean, double alphaVar, Distribution transDist,
     double alphaDeltaMean, double alphaDeltaVar, Distribution transDeltaDist,
     double sizeMean, double sizeVar, Distribution sizeDist,
     double sizeDeltaMean, double sizeDeltaVar, Distribution sizeGrowthDist,
     double ttlMean, double ttlVar, Distribution ttlDist,
     Vector3D location,
     Vector3D dimension,
     int maxNumPart,
     int emitRate,
     int emitDelay,
     int emitLife,
     bool permParts)
     : base(positionMean, positionVar, pDist,
     velocityMean, velocityVar, vDist,
     accelerationMean, accelerationVar, aDist,
     angleMean, angleVar, angDist,
     angVelocityMean, angVelocityVar, angVelDist,
     colorMean, colorVar, colDist,
     alphaMean, alphaVar, transDist,
     alphaDeltaMean, alphaDeltaVar, transDeltaDist,
     sizeMean, sizeVar, sizeDist,
     sizeDeltaMean, sizeDeltaVar, sizeGrowthDist,
     ttlMean, ttlVar,ttlDist,
     location,
     dimension,
      maxNumPart,
      emitRate,
      emitDelay,
      emitLife,
      permParts)
 {
 }
        /**
         * Explicit Constructor.
         **/
        public ParticleEmitter(
            /** Particle parameters **/
            Vector3D positionMean, Vector3D positionVar, Distribution pDist,
            Vector3D velocityMean, Vector3D velocityVar, Distribution vDist,
            Vector3D accelerationMean, Vector3D accelerationVar, Distribution aDist,
            double angleMean, double angleVar, Distribution angleDist,
            double angVelocityMean, double angVelocityVar, Distribution angVelDist,
            Vector3D colorMean, Vector3D colorVar, Distribution colDist,
            double alphaMean, double alphaVar, Distribution tranDist,
            double alphaDeltaMean, double alphaDeltaVar, Distribution tranDeltaDist,
            double sizeMean, double sizeVar, Distribution sizeDist,
            double sizeDeltaMean, double sizeDeltaVar, Distribution sizeDeltaDist,
            double ttlMean, double ttlVar, Distribution ttlDist,
            /** Emitter Parameters **/
            Vector3D location,
            Vector3D dimension,
            int maxNumPart,
            int emitRate,
            int emitDelay,
            int emitLife,
            bool permParts,
            double pLevel = 1.0
            )
            : this(pLevel)
        {
            this.position.alpha = positionMean;
            this.position.beta = positionVar;
            this.position.distribution = pDist;

            this.velocity.alpha = velocityMean;
            this.velocity.beta = velocityVar;
            this.velocity.distribution = vDist;

            this.acceleration.alpha = accelerationMean;
            this.acceleration.beta = accelerationVar;
            this.acceleration.distribution = aDist;

            this.angle.alpha = angleMean;
            this.angle.beta = angleVar;
            this.angle.distribution = angleDist;

            this.angularVelocity.alpha = angVelocityMean;
            this.angularVelocity.beta = angVelocityVar;
            this.angularVelocity.distribution = angVelDist;

            this.color.alpha = colorMean;
            this.color.beta = colorVar;
            this.color.distribution = colDist;

            this.transparency.alpha = alphaMean;
            this.transparency.beta = alphaVar;
            this.transparency.distribution = tranDist;

            this.transparencyDelta.alpha = alphaDeltaMean;
            this.transparencyDelta.beta = alphaDeltaVar;
            this.transparencyDelta.distribution = tranDeltaDist;

            this.size.alpha = sizeMean;
            this.size.beta = sizeVar;
            this.size.distribution = sizeDist;

            this.growth.alpha = sizeDeltaMean;
            this.growth.beta = sizeDeltaVar;
            this.growth.distribution = sizeDeltaDist;

            this.ttl.alpha = ttlMean;
            this.ttl.beta = ttlVar;
            this.ttl.distribution = ttlDist;

            this.Location = location;
            this.EmitDimensions = dimension;
            this.MaxNumParticles = maxNumPart;
            this.EmitRate = emitRate;
            this.MeanEmitDelay = emitDelay;
            this.EmitLifetime = emitLife;
            this.PermanentParticles = permParts;

            NumTextures = 0;
        }
 /**
  * Constructor taking filename with particle parameters.
  **/
 public ParticleEmitter(Vector3D location, String paramFileName, double pLevel = 1.0, double pScaling = 1.0)
     : this(pLevel, pScaling)
 {
     Location = location;
 }
        /**
         * Parses and returns a Vector3D from the specified xmlnode.
         **/
        public Vector3D LoadXMLVector3D(XmlNode node)
        {
            Vector3D vec = new Vector3D();

            vec.X = Convert.ToDouble(node.Attributes.GetNamedItem("x").Value);
            vec.Y = Convert.ToDouble(node.Attributes.GetNamedItem("y").Value);
            vec.Z = Convert.ToDouble(node.Attributes.GetNamedItem("z").Value);

            return vec;
        }
Пример #8
0
        /**
         * Returns a random vector3d from the normal distribution
         * with Vector3d mean and Vector3d variance.
         **/
        public Vector3D GetNormalVector3D(Vector3D mean, Vector3D variance)
        {
            Vector3D vector = new Vector3D();
            vector.X = GetNormalDouble(mean.X, variance.X);
            vector.Y = GetNormalDouble(mean.Y, variance.Y);
            vector.Z = GetNormalDouble(mean.Z, variance.Z);

            return vector;
        }
Пример #9
0
 /**
  * Returns a Vector3D with each component drawn from
  * an exponential distribution of given parameters in alpha.
  **/
 public Vector3D GetExpVector3D(Vector3D alpha)
 {
     return new Vector3D(GetExpDouble(alpha.X), GetExpDouble(alpha.X), GetExpDouble(alpha.X));
 }
Пример #10
0
        /**
         * Returns a random Vector3D with each component
         * drawn from a uniform distribution of specified
         * min and max.
         * **/
        public Vector3D GetUniformVector3D(Vector3D min, Vector3D max)
        {
            Vector3D newVector = new Vector3D();

            newVector.X = GetUniformDouble(min.X, max.X);
            newVector.Y = GetUniformDouble(min.Y, max.Y);
            newVector.Z = GetUniformDouble(min.Z, max.Z);

            return newVector;
        }
Пример #11
0
        /**
         * Returns a random Vector3D from specified
         * random distribution.
         **/
        public Vector3D GetRandomVector3D(Distribution type, Vector3D alpha, Vector3D beta)
        {
            if (type == Distribution.Uniform)
            {
                return GetUniformVector3D(alpha, beta);
            }

            if (type == Distribution.Normal)
            {
                return GetNormalVector3D(alpha, beta);
            }

            if (type == Distribution.Exponential)
            {
                return GetExpVector3D(alpha);
            }

            if (type == Distribution.Fixed)
            {
                return alpha;
            }

            return new Vector3D(0, 0, 0);
        }
Пример #12
0
 /**
  * Wrapper for Location Vector3D.
  **/
 public void SetLocation(Vector2 location)
 {
     Location = new Vector3D(location.X, location.Y, 0);
 }