예제 #1
0
        private void ParseParametric(idLexer lexer, idParticleParameter parm)
        {
            idToken token;

            if ((token = lexer.ReadToken()) == null)
            {
                lexer.Error("not enough parameters");
                return;
            }

            if (token.IsNumeric == true)
            {
                // can have a to + 2nd parm.
                float tmp;
                float.TryParse(token.ToString(), out tmp);

                parm.From = tmp;
                parm.To   = tmp;

                if ((token = lexer.ReadToken()) != null)
                {
                    if (token.ToString().ToLower() == "to")
                    {
                        if ((token = lexer.ReadToken()) == null)
                        {
                            lexer.Error("missing second parameter");
                            return;
                        }

                        float.TryParse(token.ToString(), out tmp);
                        parm.To = tmp;
                    }
                    else
                    {
                        lexer.UnreadToken = token;
                    }
                }
            }
            else
            {
                parm.Table = (idDeclTable)idE.DeclManager.FindType(DeclType.Table, token.ToString(), false);
            }
        }
예제 #2
0
		private void ParseParametric(idLexer lexer, idParticleParameter parm)
		{
			idToken token;

			if((token = lexer.ReadToken()) == null)
			{
				lexer.Error("not enough parameters");
				return;
			}

			if(token.IsNumeric == true)
			{
				// can have a to + 2nd parm.
				float tmp;
				float.TryParse(token.ToString(), out tmp);

				parm.From = tmp;
				parm.To = tmp;

				if((token = lexer.ReadToken()) != null)
				{
					if(token.ToString().ToLower() == "to")
					{
						if((token = lexer.ReadToken()) == null)
						{
							lexer.Error("missing second parameter");
							return;
						}

						float.TryParse(token.ToString(), out tmp);
						parm.To = tmp;
					}
					else
					{
						lexer.UnreadToken = token;
					}
				}
			}
			else
			{
				parm.Table = (idDeclTable) idE.DeclManager.FindType(DeclType.Table, token.ToString(), false);
			}
		}
예제 #3
0
        /// <summary>
        /// Sets the stage to a default state.
        /// </summary>
        public void Default()
        {
            _material       = idE.DeclManager.FindMaterial("_default");
            _totalParticles = 100;
            _spawnBunching  = 1.0f;
            _particleLife   = 1.5f;
            _timeOffset     = 0.0f;
            _deadTime       = 0.0f;

            _distribution         = ParticleDistribution.Rectangle;
            _distributionParms[0] = 8.0f;
            _distributionParms[1] = 8.0f;
            _distributionParms[2] = 8.0f;
            _distributionParms[3] = 0.0f;

            _direction         = ParticleDirection.Cone;
            _directionParms[0] = 90.0f;
            _directionParms[1] = 0.0f;
            _directionParms[2] = 0.0f;
            _directionParms[3] = 0.0f;

            _orientation         = ParticleOrientation.View;
            _orientationParms[0] = 0.0f;
            _orientationParms[1] = 0.0f;
            _orientationParms[2] = 0.0f;
            _orientationParms[3] = 0.0f;

            _customPath         = ParticleCustomPath.Standard;
            _customPathParms[0] = 0.0f;
            _customPathParms[1] = 0.0f;
            _customPathParms[2] = 0.0f;
            _customPathParms[3] = 0.0f;
            _customPathParms[4] = 0.0f;
            _customPathParms[5] = 0.0f;
            _customPathParms[6] = 0.0f;
            _customPathParms[7] = 0.0f;

            _gravity      = 1.0f;
            _worldGravity = false;

            _offset = Vector3.Zero;

            _animationFrames = 0;
            _animationRate   = 0.0f;
            _initialAngle    = 0.0f;

            _speed         = new idParticleParameter(150.0f, 150.0f, null);
            _rotationSpeed = new idParticleParameter(0.0f, 0.0f, null);
            _size          = new idParticleParameter(4.0f, 4.0f, null);
            _aspect        = new idParticleParameter(1.0f, 1.0f, null);

            _color              = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
            _fadeColor          = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
            _fadeInFraction     = 0.1f;
            _fadeOutFraction    = 0.25f;
            _fadeIndexFraction  = 0.0f;
            _boundsExpansion    = 0.0f;
            _randomDistribution = true;
            _entityColor        = false;
            _cycleTime          = (int)(_particleLife + _deadTime) * 1000;
        }
예제 #4
0
		/// <summary>
		/// Sets the stage to a default state.
		/// </summary>
		public void Default()
		{
			_material = idE.DeclManager.FindMaterial("_default");
			_totalParticles = 100;
			_spawnBunching = 1.0f;
			_particleLife = 1.5f;
			_timeOffset = 0.0f;
			_deadTime = 0.0f;

			_distribution = ParticleDistribution.Rectangle;
			_distributionParms[0] = 8.0f;
			_distributionParms[1] = 8.0f;
			_distributionParms[2] = 8.0f;
			_distributionParms[3] = 0.0f;

			_direction = ParticleDirection.Cone;
			_directionParms[0] = 90.0f;
			_directionParms[1] = 0.0f;
			_directionParms[2] = 0.0f;
			_directionParms[3] = 0.0f;

			_orientation = ParticleOrientation.View;
			_orientationParms[0] = 0.0f;
			_orientationParms[1] = 0.0f;
			_orientationParms[2] = 0.0f;
			_orientationParms[3] = 0.0f;

			_customPath = ParticleCustomPath.Standard;
			_customPathParms[0] = 0.0f;
			_customPathParms[1] = 0.0f;
			_customPathParms[2] = 0.0f;
			_customPathParms[3] = 0.0f;
			_customPathParms[4] = 0.0f;
			_customPathParms[5] = 0.0f;
			_customPathParms[6] = 0.0f;
			_customPathParms[7] = 0.0f;

			_gravity = 1.0f;
			_worldGravity = false;

			_offset = Vector3.Zero;

			_animationFrames = 0;
			_animationRate = 0.0f;
			_initialAngle = 0.0f;

			_speed = new idParticleParameter(150.0f, 150.0f, null);
			_rotationSpeed = new idParticleParameter(0.0f, 0.0f, null);
			_size = new idParticleParameter(4.0f, 4.0f, null);
			_aspect = new idParticleParameter(1.0f, 1.0f, null);

			_color = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
			_fadeColor = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
			_fadeInFraction = 0.1f;
			_fadeOutFraction = 0.25f;
			_fadeIndexFraction = 0.0f;
			_boundsExpansion = 0.0f;
			_randomDistribution = true;
			_entityColor = false;
			_cycleTime = (int) (_particleLife + _deadTime) * 1000;
		}