Ejemplo n.º 1
0
    //---------------------------------------------------------------------
    PanelOverlayElement::PanelOverlayElement(const String& name)
        : OverlayContainer(name)
        , mTransparent(false)
        // Defer creation of texcoord buffer until we know how big it needs to be
        , mNumTexCoordsInBuffer(0)
        , mU1(0.0)
        , mV1(0.0)
        , mU2(1.0)
        , mV2(1.0)

    {
        // Init tiling
        for (ushort i = 0; i < OGRE_MAX_TEXTURE_COORD_SETS; ++i)
        {
            mTileX[i] = 1.0f;
            mTileY[i] = 1.0f;
        }

        // No normals or colours
        if (createParamDictionary("PanelOverlayElement"))
        {
            addBaseParameters();
        }

    }
	//-----------------------------------------------------------------------
	FireExtinguisherAffector::FireExtinguisherAffector(ParticleSystem* psys)
		: ParticleAffector(psys)
	{
		mType = "FireExtinguisher";

		// defaults
		mEffectiveness = 1.0;
		mEfaf = 0;

		// Set up parameters
		if (createParamDictionary("FireExtinguisherAffector"))
		{
			addBaseParameters();
			// Add extra paramaters
			ParamDictionary* dict = getParamDictionary();
			dict->addParameter(ParameterDef("effectiveness",
				"How effective is your fire extinguisher? Anything higher than one is more effective than water while everything lower than one is less effective than water.",
				PT_REAL), &msEffectivenessCmd);
		}

		// get fire affector factory
		ParticleSystemManager::ParticleAffectorFactoryIterator pafi = ParticleSystemManager::getSingleton().getAffectorFactoryIterator();
		ParticleAffectorFactory *paf;

		while(pafi.hasMoreElements())
		{
			paf = pafi.getNext();
			if ( paf->getName() == "ExtinguishableFire" )
			{
				mEfaf = (ExtinguishableFireAffectorFactory *)paf;
				break;
			}	
		}
		if (!mEfaf) LOG("ERROR: Couldn't find an ExtinguishableFireAffectorFactory instance. Was it registered in the content manager?");
	}
Ejemplo n.º 3
0
    //-----------------------------------------------------------------------
    LinearForceAffector::LinearForceAffector(ParticleSystem* psys)
        :ParticleAffector(psys)
    {
        mType = "LinearForce";

        // Default to gravity-like
        mForceApplication = FA_ADD;
        mForceVector.x = mForceVector.z = 0;
        mForceVector.y = -100;

        // Set up parameters
        if (createParamDictionary("LinearForceAffector"))
        {
            addBaseParameters();
            // Add extra paramaters
            ParamDictionary* dict = getParamDictionary();
            dict->addParameter(ParameterDef("force_vector",
                "The vector representing the force to apply.",
                PT_VECTOR3),&msForceVectorCmd);
            dict->addParameter(ParameterDef("force_application",
                "How to apply the force vector to particles.",
                PT_STRING),&msForceAppCmd);

        }

    }
    //-----------------------------------------------------------------------
    DirectionRandomiserAffector::DirectionRandomiserAffector(ParticleSystem* psys)
       : ParticleAffector(psys)
    {
        mType = "DirectionRandomiser";

        // defaults
        mRandomness = 1.0;
        mScope = 1.0;
        mKeepVelocity = false;

        // Set up parameters
        if (createParamDictionary("DirectionRandomiserAffector"))
        {
            addBaseParameters();
            // Add extra paramaters
            ParamDictionary* dict = getParamDictionary();
            dict->addParameter(ParameterDef("randomness",
                "The amount of randomness (chaos) to apply to the particle movement.",
                PT_REAL), &msRandomnessCmd);
            dict->addParameter(ParameterDef("scope",
                "The percentage of particles which is affected.",
                PT_REAL), &msScopeCmd);
            dict->addParameter(ParameterDef("keep_velocity",
                "Detemines whether the velocity of the particles is changed.",
                PT_BOOL), &msKeepVelocityCmd);
        }
    }
Ejemplo n.º 5
0
    //-----------------------------------------------------------------------
    bool AreaEmitter::initDefaults(const String& t)
    {
        // called by the constructor as initDefaults("Type")

        // Defaults
        mDirection = Vector3::UNIT_Z;
        mUp = Vector3::UNIT_Y;
        setSize(100,100,100);
        mType = t;

        // Set up parameters
        if (createParamDictionary(mType + "Emitter"))
        {

            addBaseParameters();
            ParamDictionary* dict = getParamDictionary();

            // Custom params
            dict->addParameter(ParameterDef("width", 
                "Width of the shape in world coordinates.",
                PT_REAL),&msWidthCmd);
            dict->addParameter(ParameterDef("height", 
                "Height of the shape in world coordinates.",
                PT_REAL),&msHeightCmd);
            dict->addParameter(ParameterDef("depth", 
                "Depth of the shape in world coordinates.",
                PT_REAL),&msDepthCmd);
            return true;

        }
        return false;
    }
    //-----------------------------------------------------------------------
    DeflectorPlaneAffector::DeflectorPlaneAffector(ParticleSystem* psys)
        : ParticleAffector(psys)
    {
        mType = "DeflectorPlane";

        // defaults
        mPlanePoint = Vector3::ZERO;
        mPlaneNormal = Vector3::UNIT_Y;
        mBounce = 1.0;

        // Set up parameters
        if (createParamDictionary("DeflectorPlaneAffector"))
        {
            addBaseParameters();
            // Add extra paramaters
            ParamDictionary* dict = getParamDictionary();
            dict->addParameter(ParameterDef("plane_point",
                "A point on the deflector plane. Together with the normal vector it defines the plane.",
                PT_VECTOR3), &msPlanePointCmd);
            dict->addParameter(ParameterDef("plane_normal",
                "The normal vector of the deflector plane. Together with the point it defines the plane.",
                PT_VECTOR3), &msPlaneNormalCmd);
            dict->addParameter(ParameterDef("bounce",
                "The amount of bouncing when a particle is deflected. 0 means no deflection and 1 stands for 100 percent reflection.",
                PT_REAL), &msBounceCmd);
        }
    }
Ejemplo n.º 7
0
 //-----------------------------------------------------------------------
 PointEmitter::PointEmitter(ParticleSystem* psys)
     :ParticleEmitter(psys)
 {
     mType = "Point";
     // Set up parameters
     if (createParamDictionary("PointEmitter"))
     {
         addBaseParameters();
     }
     // No custom parameters
 }
Ejemplo n.º 8
0
    /** Internal for initializing some defaults and parameters
    @return True if custom parameters need initialising
    */
    bool initDefaults(const Ogre::String &t)
    {
        // Defaults
        mDirection = Ogre::Vector3::UNIT_Z;
        mUp = Ogre::Vector3::UNIT_Y;
        setSize(100.0f, 100.0f, 100.0f);
        mType = t;

        // Set up parameters
        if(createParamDictionary(mType + "Emitter"))
        {
            addBaseParameters();
            Ogre::ParamDictionary *dict = getParamDictionary();

            // Custom params
            dict->addParameter(Ogre::ParameterDef("width",
                                                  "Width of the shape in world coordinates.",
                                                  Ogre::PT_REAL),
                               &msWidthCmd);
            dict->addParameter(Ogre::ParameterDef("height",
                                                  "Height of the shape in world coordinates.",
                                                  Ogre::PT_REAL),
                               &msHeightCmd);
            dict->addParameter(Ogre::ParameterDef("depth",
                                                  "Depth of the shape in world coordinates.",
                                                  Ogre::PT_REAL),
                               &msDepthCmd);

            dict->addParameter(Ogre::ParameterDef("vertical_direction",
                                                  "Vertical direction of emitted particles (in degrees).",
                                                  Ogre::PT_REAL),
                               &msVerticalDirCmd);
            dict->addParameter(Ogre::ParameterDef("vertical_angle",
                                                  "Vertical direction variance of emitted particles (in degrees).",
                                                  Ogre::PT_REAL),
                               &msVerticalAngleCmd);
            dict->addParameter(Ogre::ParameterDef("horizontal_direction",
                                                  "Horizontal direction of emitted particles (in degrees).",
                                                  Ogre::PT_REAL),
                               &msHorizontalDirCmd);
            dict->addParameter(Ogre::ParameterDef("horizontal_angle",
                                                  "Horizontal direction variance of emitted particles (in degrees).",
                                                  Ogre::PT_REAL),
                               &msHorizontalAngleCmd);

            return true;
        }
        return false;
    }
 //---------------------------------------------------------------------
 BorderPanelOverlayElement::BorderPanelOverlayElement(const String& name)
   : PanelOverlayElement(name), 
     mLeftBorderSize(0),
     mRightBorderSize(0),
     mTopBorderSize(0),
     mBottomBorderSize(0),
     mPixelLeftBorderSize(0),
     mPixelRightBorderSize(0),
     mPixelTopBorderSize(0),
     mPixelBottomBorderSize(0),
     mBorderMaterial(),
     mBorderRenderable(0)
 {   
     if (createParamDictionary("BorderPanelOverlayElement"))
     {
         addBaseParameters();
     }
 }
	//-----------------------------------------------------------------------
	ExtinguishableFireAffector::ExtinguishableFireAffector(ParticleSystem* psys)
		: ParticleAffector(psys), mPsys(psys)
	{
		mType = "ExtinguishableFire";

		// defaults
		mMiddlePoint = Vector3::ZERO;
		mRadius = 1.0;
		mIntensity = 3000.0;
		originalIntensity = mIntensity;
		mIntensityGrowth = 10;
		mMaxIntensity = 4000.0;
		updateIntensityRequired = false;
		firstFrame = true;
		
		// Set up parameters
		if (createParamDictionary("ExtinguishableFireAffector"))
		{
			addBaseParameters();
			// Add extra paramaters
			ParamDictionary* dict = getParamDictionary();
			dict->addParameter(ParameterDef("middle_point",
				"The middle point of the sphere on which water particles will interact.",
				PT_VECTOR3), &msMiddlePointCmd);
			dict->addParameter(ParameterDef("intensity",
				"The amount of water particles that a fire can withstand before being extinguished.",
				PT_REAL), &msIntensityCmd);
			dict->addParameter(ParameterDef("max_intensity",
				"The maximum intensity the fire can grow to.",
				PT_REAL), &msMaxIntensityCmd);
			dict->addParameter(ParameterDef("intensity_growth",
				"The amount by which the intensity of the fire grows per second.",
				PT_REAL), &msMaxIntensityCmd);
			dict->addParameter(ParameterDef("radius",
				"The radius of the sphere.",
				PT_REAL), &msRadiusCmd);
		}

		// predefine objectInstanceName
		objectInstanceName = "unknown";

		ScriptEngine::getSingleton().fireEvent(objectInstanceName, mIntensity);
	}
Ejemplo n.º 11
0
    //---------------------------------------------------------------------
    TextAreaOverlayElement::TextAreaOverlayElement(const String& name)
        : OverlayElement(name), mColourBottom(ColourValue::White), mColourTop(ColourValue::White)
    {
        mTransparent = false;
        mAlignment = Left;

        mColoursChanged = true;

        mAllocSize = 0;

        mCharHeight = 0.02;
        mPixelCharHeight = 12;
        mSpaceWidthOverridden = false;
        mSpaceWidth = 0;
        mPixelSpaceWidth = 0;
        mViewportAspectCoef = 1;

        if (createParamDictionary("TextAreaOverlayElement"))
        {
            addBaseParameters();
        }
    }
Ejemplo n.º 12
0
    PolarEmitter::PolarEmitter(ParticleSystem* psys)
        : ParticleEmitter(psys)
		, mRadiusMin(0.0f)
		, mRadiusStep(0.0f)
		, mRadiusMax(0.0f)
	    , mThetaMin(0.0f)
		, mThetaStep(0.0f)
		, mThetaMax(0.0f)
	    , mPhiMin(0.0f)
	    , mPhiStep(0.0f)
		, mPhiMax(0.0f)
		, mThetaTotal(0.0f)
		, mPhiTotal(0.0f)
		, mRadiusTotal(0.0f)
		, mUsePolarStep(false)
		, mFlipYZAxis(false)
        , mResetRadiusCount(0)
        , mResetRadius(false)
        , mCurrentResetRadiusCount(0)

    {
        mType = "PolarEmitter";

        // Set up parameters
        if (createParamDictionary("PolarEmitter"))
        {
            addBaseParameters();

            // Add extra paramaters
            ParamDictionary* dict = getParamDictionary();
            dict->addParameter(ParameterDef("radius_start", 
                "The vector representing the force to apply.",
                PT_REAL),&msRadiusMinCmd);

			dict->addParameter(ParameterDef("radius_step", 
				"The vector representing the force to apply.",
				PT_REAL),&msRadiusStepCmd);

			dict->addParameter(ParameterDef("radius_end", 
				"The vector representing the force to apply.",
				PT_REAL),&msRadiusMaxCmd);

            dict->addParameter(ParameterDef("theta_start", 
                "The vector representing the force to apply.",
                PT_REAL),&msThetaMinCmd);

            dict->addParameter(ParameterDef("theta_step", 
                "The vector representing the force to apply.",
                PT_REAL),&msThetaStepCmd);

			dict->addParameter(ParameterDef("theta_end", 
				"The vector representing the force to apply.",
				PT_REAL),&msThetaMaxCmd);

			dict->addParameter(ParameterDef("phi_start", 
				"The vector representing the force to apply.",
				PT_REAL),&msPhiMinCmd);

            dict->addParameter(ParameterDef("phi_step", 
                "The vector representing the force to apply.",
                PT_REAL),&msPhiStepCmd);

			dict->addParameter(ParameterDef("phi_end", 
				"The vector representing the force to apply.",
				PT_REAL),&msPhiMaxCmd);

			dict->addParameter(ParameterDef("use_polar_step", 
				"The vector representing the force to apply.",
				PT_BOOL),&msUsePolarStepCmd);

			dict->addParameter(ParameterDef("flip_yz_axis", 
				"The vector representing the force to apply.",
				PT_BOOL),&msFlipYZAxisCmd);

            dict->addParameter(ParameterDef("reset_radius_count", 
                "when you use the radius step, this value can control the radius reset"
                "by emitting reset_radius_count particles.",
                PT_INT),&msResetRadiusCountCmd);

            dict->addParameter(ParameterDef("reset_radius", 
                "when you use the radius step, this value can control the radius reset.",
                PT_BOOL),&msResetRadiusCmd);
        }
    }  
    //-----------------------------------------------------------------------
    RevolutionAffector::RevolutionAffector(ParticleSystem* psys)
        :ParticleAffector(psys)
    {
        mType = "Revolution";

		mRotateAxis = Ogre::Vector3::UNIT_Y;
		mRotationSpeed = 0.0f;

		for (int i=0;i<MAX_STAGES;i++)
		{
			// set default colour to transparent grey, transparent since we might not want to display the particle here
			// grey because when a colour component is 0.5f the maximum difference to another colour component is 0.5f
			mRadiusIncrementAdj[i]	= 0.0f;
			mTimeAdj[i]		= 1.0f;
		}

		mRepeatTimes = 1.0f;

		mCenterOffsetMin = Ogre::Vector3::ZERO;
		mCenterOffsetMax = Ogre::Vector3::ZERO;

		mUseRadiusIncrementScale = false;

		mRadiusIncrement = 0.0f;

        // Default to gravity-like

        // Set up parameters
        if (createParamDictionary("RevolutionAffector"))
        {
            addBaseParameters();
            // Add extra paramaters
            ParamDictionary* dict = getParamDictionary();

			dict->addParameter(ParameterDef("rotation_speed", 
                "the speed of particle circle rotation.",
                PT_REAL),&msRotationSpeedCmd);

            dict->addParameter(ParameterDef("rotation_axis", 
                "The vector representing the force to apply.",
                PT_VECTOR3),&msRotationAxisCmd);

			dict->addParameter(ParameterDef("radius_increment", 
				"the speed of particle circle rotation.",
				PT_REAL),&msRadiusIncrementCmd);

			dict->addParameter(ParameterDef("center_offset_min", 
				"The vector representing the force to apply.",
				PT_VECTOR3),&msCenterOffsetMinCmd);

			dict->addParameter(ParameterDef("center_offset_max", 
				"The vector representing the force to apply.",
				PT_VECTOR3),&msCenterOffsetMaxCmd);

			for (int i=0;i<MAX_STAGES;i++)
			{
				msRadiusIncrementAdjustCmd[i].mIndex	= i;
				msTimeCmd[i].mIndex		= i;

				StringUtil::StrStreamType stage;
				stage << i;
				String	speed_title	= String("radius_increment_scale") + stage.str();
				String	time_title		= String("time") + stage.str();
				String	speed_descr	= String("Stage ") + stage.str() + String(" RadiusIncrementScale.");
				String	time_descr		= String("Stage ") + stage.str() + String(" time.");

				dict->addParameter(ParameterDef(speed_title, speed_descr, PT_REAL), &msRadiusIncrementAdjustCmd[i]);
				dict->addParameter(ParameterDef(time_title,   time_descr,   PT_REAL),		 &msTimeCmd[i]);
			}		

			dict->addParameter(ParameterDef("use_radius_increment_scale", 
				"the repeat times of the colour interpolate.",
				PT_BOOL), &msUseRadiusIncrementScaleCmd);

			dict->addParameter(ParameterDef("repeat_times", 
				"the repeat times of the colour interpolate.",
				PT_REAL), &msRepeatTimesCmd);
        }

    }