コード例 #1
0
ファイル: GRandom.cs プロジェクト: akbiggs/Crash.net
        /**
         * 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);
        }
コード例 #2
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);
 }
コード例 #3
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)
 {
      
 }
コード例 #4
0
ファイル: Particle.cs プロジェクト: akbiggs/Crash.net
 /// <summary>
 /// Makes a new particle.
 /// </summary>
 /// <param name="parent">The emitter of the particle.</param>
 /// <param name="position">The starting position of the particle.</param>
 /// <param name="velocity">The initial velocity of the particle.</param>
 /// <param name="acceleration">The acceleration of the particle</param>
 /// <param name="angle">The angle of the particle.</param>
 /// <param name="angVel">The speed at which the particle's angle changes.</param>
 /// <param name="color">The color of the particle.</param>
 /// <param name="transparency">The transparency of the particle.</param>
 /// <param name="transDelta">The change in transperency of the particle.</param>
 /// <param name="size">The size of the particle.</param>
 /// <param name="sizeDelta">The change in size of the particle.</param>
 /// <param name="lifespan">How long the particle should remain alive for, in milliseconds.</param>
 /// <param name="textureIndex">The index of the texture this particle should have.</param>
 public Particle(
     ParticleEmitter parent,
     Vector3D position,
     Vector3D velocity,
     Vector3D acceleration,
     double angle,
     double angVel,
     Vector3D color,
     double transparency,
     double transDelta,
     double size,
     double sizeDelta,
     double lifespan,
     int txtIndex
     )
 {
     this.parentEmitter = parent;
     this.position = position;
     this.velocity = velocity;
     this.acceleration = acceleration;
     this.angle = angle;
     this.angularVelocity = angVel;
     this.color = color;
     this.transparency = transparency;
     this.transparencyDelta = transDelta;
     this.size = size;
     this.sizeDelta = sizeDelta;
     this.lifeLeft = lifespan;
     this.TextureIndex = txtIndex;
 }
コード例 #5
0
        /**
         * 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;
        }
コード例 #6
0
        /**
         * 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;   
        }
コード例 #7
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;
 }
コード例 #8
0
ファイル: ParticleEmitter.cs プロジェクト: akbiggs/Crash.net
 /// <summary>
 /// Make a new particle emitter taking a file for parameters.
 /// </summary>
 /// <param name="location">The initial location of the particle emitter.</param>
 /// <param name="paramFileName">The relative path to the file to get the parameters from.</param>
 /// <param name="pLevel">The particle level of the emitter.</param>
 /// <param name="pScaling">The factor by which to scale the particles.</param>
 public ParticleEmitter(Vector3D location, String paramFileName, double pLevel = 1.0, double pScaling = 1.0) 
     : this(pLevel, pScaling)
 {
     // TODO: get parameters from parameter file.
     Location = location;
 }
コード例 #9
0
ファイル: GRandom.cs プロジェクト: akbiggs/Crash.net
        /**
         * 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;
        }
コード例 #10
0
ファイル: GRandom.cs プロジェクト: akbiggs/Crash.net
 /** 
  * 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));
 }
コード例 #11
0
ファイル: GRandom.cs プロジェクト: akbiggs/Crash.net
        /**
         * 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;

        }
コード例 #12
0
 /**
  * Wrapper for Location Vector3D.
  **/
 public void SetLocation(Vector2 location)
 {
     Location = new Vector3D(location.X, location.Y, 0);
 }
コード例 #13
0
ファイル: XNAEmitter.cs プロジェクト: akbiggs/Crash.net
 /// <summary>
 /// Initializes emitter with specified parameters.
 /// </summary>
 /// <param name="positionMean">The mean position of particles.</param>
 /// <param name="positionVar">The variance of the position of particles.</param>
 /// <param name="positionDist">The distribution of the position of particles.</param>
 /// <param name="velocityMean">The mean velocity of particles.</param>
 /// <param name="velocityVar">The variance of the velocity of particles.</param>
 /// <param name="velocityDist">The distribution of the velocity of particles.</param>
 /// <param name="accelerationMean">The mean acceleration of particles.</param>
 /// <param name="accelerationVar">The variance of the acceleration of particles.</param>
 /// <param name="accelerationDist">The distribution of the acceleration of particles.</param>
 /// <param name="angleMean">The mean angle of particles.</param>
 /// <param name="angleVar">The variance of the angle of particles.</param>
 /// <param name="angleDist">The distribution of the angle of particles.</param>
 /// <param name="angleVelocityMean">The mean velocity of the change of angle of a particle.
 /// Positive for clockwise, negative for counterclockwise.</param>
 /// <param name="angleVelocityVar">The variance of the velocity of the change of angle 
 /// of particles. Positive for clockwise, negative for counterclockwise.</param>
 /// <param name="angleVelDist">The distribution of the velocity of the change of angle
 /// of particles. Positive for clockwise, negative for counterclockwise.</param>
 /// <param name="colorMean">The mean color of a particle.</param>
 /// <param name="colorVar">The variance of the color of particles.</param>
 /// <param name="colorDist">The distribution of the color of particles.</param>
 /// <param name="alphaMean">The mean transparency of particles.</param>
 /// <param name="alphaVar">The variance of transparency of particles.</param>
 /// <param name="alphaDist">The distribution of transparency of particles.</param>
 /// <param name="alphaDeltaMean">The mean change in transparency of particles.</param>
 /// <param name="alphaDeltaVar">The variation of change in transparency of particles.</param>
 /// <param name="alphaDeltaDist">The distribution of change in transparency of particles.</param>
 /// <param name="sizeMean">The mean size of particles.</param>
 /// <param name="sizeVar">The variance of size of particles.</param>
 /// <param name="sizeDist">The distribution of size of particles.</param>
 /// <param name="sizeDeltaMean">The mean change in size of particles.</param>
 /// <param name="sizeDeltaVar">The variance of change in size of particles.</param>
 /// <param name="sizeDeltaDist">The distribution of change in size of particles.</param>
 /// <param name="ttlMean">The mean lifespan of particles.</param>
 /// <param name="ttlVar">The variance of lifespan of particles.</param>
 /// <param name="ttlDist">The distribution of lifespan of particles.</param>
 /// <param name="location">The location of the emitter.</param>
 /// <param name="dimension">The area from which the emitter should send particles.</param>
 /// <param name="maxNumParticles">The max number of particles that can be queued by the emitter.</param>
 /// <param name="emitRate">The emission rate of the emitter, in milliseconds.</param>
 /// <param name="emitDelay">The delay between emissions, in milliseconds.</param>
 /// <param name="emitLife">How long the emitter should emit for, in milliseconds.</param>
 /// <param name="permanentParticles">Whether or not the particles this emitter emits
 /// are permanent(do not disappear).</param>
 public XNAEmitter(
     Vector3D positionMean, Vector3D positionVar, Distribution positionDist,
     Vector3D velocityMean, Vector3D velocityVar, Distribution velocityDist,
     Vector3D accelerationMean, Vector3D accelerationVar, Distribution accelerationDist,
     double angleMean, double angleVar, Distribution angleDist,
     double angleVelocityMean, double angleVelocityVar, Distribution angleVelDist,
     Vector3D colorMean, Vector3D colorVar, Distribution colorDist,
     double alphaMean, double alphaVar, Distribution alphaDist,
     double alphaDeltaMean, double alphaDeltaVar, Distribution alphaDeltaDist,
     double sizeMean, double sizeVar, Distribution sizeDist,
     double sizeDeltaMean, double sizeDeltaVar, Distribution sizeDeltaDist,
     double lifespanMean, double lifespanVar, Distribution lifespanDist,
     Vector3D location,
     Vector3D dimension,
     int maxNumPart,
     int emitRate,
     int emitDelay,
     int emitLife,
     bool permanentParticles)
     : base(positionMean, positionVar, positionDist,
     velocityMean, velocityVar, velocityDist,
     accelerationMean, accelerationVar, accelerationDist,
     angleMean, angleVar, angleDist,
     angleVelocityMean, angleVelocityVar, angleVelDist,
     colorMean, colorVar, colorDist,
     alphaMean, alphaVar, alphaDist,
     alphaDeltaMean, alphaDeltaVar, alphaDeltaDist,
     sizeMean, sizeVar, sizeDist,
     sizeDeltaMean, sizeDeltaVar, sizeDeltaDist,
     lifespanMean, lifespanVar,lifespanDist,
     location,
     dimension,
      maxNumPart,
      emitRate,
      emitDelay,
      emitLife,
      permanentParticles)
 {
      
 }