/**
         * Loads a 3D Parameter from the specified XMLNode
         **/
        public Parameter3D LoadXMLParameter3D(XmlNode node)
        {
            Parameter3D newPar = new Parameter3D();

            newPar.alpha = LoadXMLVector3D(node.SelectSingleNode("alpha"));
            newPar.beta = LoadXMLVector3D(node.SelectSingleNode("beta"));
            newPar.distribution = (Distribution)Enum.Parse(typeof(Distribution),
                Convert.ToString(node.SelectSingleNode("distribution").Attributes.GetNamedItem("x").Value));

            return newPar;
        }
        /**
        * Loads emitter parameters from XML file.
        **/
        public void LoadXMLEmitter(XmlDocument emitter)
        {
            XmlNode emitterPars =
                emitter.SelectSingleNode("/ParticleSystem/EmitterParameters");
            XmlNode particlePars =
                emitter.SelectSingleNode("/ParticleSystem/ParticleParameters");
            /**
             * Load Emitter Parameters:
             **/
            //Location = LoadXMLVector3D(emitterPars.SelectSingleNode("location"));
            EmitDimensions = LoadXMLVector3D(emitterPars.SelectSingleNode("dimension"));
            MaxNumParticles =
                (int)(GlobalParticleLevels * Convert.ToInt32(emitterPars.SelectSingleNode("maxNumParticles").
                Attributes.GetNamedItem("x").Value));

            EmitRate =
                (int)(GlobalParticleLevels * Convert.ToInt32(emitterPars.SelectSingleNode("emitRate").
                Attributes.GetNamedItem("x").Value));
            MeanEmitDelay =
                Convert.ToDouble(emitterPars.SelectSingleNode("meanEmitDelay").
                Attributes.GetNamedItem("x").Value);
            EmitLifetime =
                Convert.ToDouble(emitterPars.SelectSingleNode("emitterLifetime").
                Attributes.GetNamedItem("x").Value);
            PermanentParticles =
                Convert.ToBoolean(emitterPars.SelectSingleNode("permanentParticles").
                Attributes.GetNamedItem("x").Value);

            /**
             * Load particle randomization parameters:
             **/
            position = LoadXMLParameter3D(particlePars.SelectSingleNode("position"));
            velocity = LoadXMLParameter3D(particlePars.SelectSingleNode("velocity"));
            /**
             * Speed and Direction: Not implemented yet. 
             **/
            // speed = LoadXMLParameterDouble(particlePars.SelectSingleNode("speed"));
            // direction = LoadXMLParameterDouble(particlePars.SelectSingleNode("direction"));
            acceleration = LoadXMLParameter3D(particlePars.SelectSingleNode("acceleration"));
            color = LoadXMLParameter3D(particlePars.SelectSingleNode("color"));
            angle = LoadXMLParameterDouble(particlePars.SelectSingleNode("angle"));
            angularVelocity = LoadXMLParameterDouble(particlePars.SelectSingleNode("angularVelocity"));
            transparency = LoadXMLParameterDouble(particlePars.SelectSingleNode("transparency"));
            transparencyDelta = LoadXMLParameterDouble(particlePars.SelectSingleNode("transparencyDelta"));
            size = LoadXMLParameterDouble(particlePars.SelectSingleNode("size"));
            size.alpha *= GlobalScaling;
            size.beta *= GlobalScaling;
            growth = LoadXMLParameterDouble(particlePars.SelectSingleNode("growth"));
            ttl = LoadXMLParameterDouble(particlePars.SelectSingleNode("ttl"));

        }
        /**
         * Transposes a parameter using magnitude and direction to 
         * one using a 3D vector.
         * TODO: Implement.
         **/
        public Parameter3D MagnitudeDirectionTo3DVector(
            ParameterDouble magnitude, 
            ParameterDouble direction) 
        {
            Parameter3D vector = new Parameter3D();
            
            /**
             * Randomly-distributed magnitude and direction variables
             * transformed to randomly-distributed 3d x,y,z vectors.
             **/

            return vector;
        }
Esempio n. 4
0
        /// <summary>
        /// UNIMPLEMENTED: Transpose magnitude and direction parameters to a 3D (x, y, z)-based one.
        /// </summary>
        /// <param name="magnitude">The magnitude parameter.</param>
        /// <param name="direction">The direction parameter.</param>
        /// <returns>Randomly-distributed magnitude and direction variables
        /// transformed to randomly-distributed 3D vectors.</returns>
        public Parameter3D MagnitudeDirectionTo3DVector(
            ParameterDouble magnitude, 
            ParameterDouble direction) 
        {
            Parameter3D vector = new Parameter3D();

            // TODO: Implement.

            return vector;
        }