BulletSpeedOperator::BulletSpeedOperator(BulletEventSystem* eventSystem) : BulletOperator(), m_isOperated(false) { m_type = "speed"; m_parent = eventSystem; m_direction = Ogre::Vector3::ZERO; m_speed = 0.0; if (createParamDictionary("BulletSpeedOperator")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("mode", "The mode of bullet speed operator.", Ogre::PT_STRING),&ms_modeCmd); dict->addParameter(Ogre::ParameterDef("direction", "The direction of bullet speed operator.", Ogre::PT_VECTOR3),&ms_directionCmd); dict->addParameter(Ogre::ParameterDef("speed", "The speed of bullet speed operator.", Ogre::PT_REAL),&ms_speedCmd); } }
//--------------------------------------------------------------------- bool EffectElement::initDefaults(const String &mType) { if (createParamDictionary(mType + "EffectElement")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("StartTime", "the start time of this element.", Ogre::PT_REAL),&msStartTimeCmd); dict->addParameter(Ogre::ParameterDef("LifeTime", "the life time of this element.", Ogre::PT_REAL),&msLifeTimeCmd); dict->addParameter(Ogre::ParameterDef("Position", "the relative pos from parent.", Ogre::PT_VECTOR3),&msRelPosCmd); dict->addParameter(Ogre::ParameterDef("Orientation", "the relative orientation from parent.", Ogre::PT_QUATERNION),&msRelOrientationCmd); return true; } return false; }
/** Default constructor. */ GravityAffector(Ogre::ParticleSystem *psys) : ParticleAffector(psys) , mForce(0.0f) , mForceType(Type_Wind) , mPosition(0.0f) , mDirection(0.0f) { mType = "Gravity"; // Init parameters if(createParamDictionary("GravityAffector")) { Ogre::ParamDictionary *dict = getParamDictionary(); Ogre::String force_title("force"); Ogre::String force_descr("Amount of force applied to particles."); Ogre::String force_type_title("force_type"); Ogre::String force_type_descr("Type of force applied to particles (point or wind)."); Ogre::String direction_title("direction"); Ogre::String direction_descr("Direction of wind forces."); Ogre::String position_title("position"); Ogre::String position_descr("Position of point forces."); dict->addParameter(Ogre::ParameterDef(force_title, force_descr, Ogre::PT_REAL), &msForceCmd); dict->addParameter(Ogre::ParameterDef(force_type_title, force_type_descr, Ogre::PT_STRING), &msForceTypeCmd); dict->addParameter(Ogre::ParameterDef(direction_title, direction_descr, Ogre::PT_VECTOR3), &msDirectionCmd); dict->addParameter(Ogre::ParameterDef(position_title, position_descr, Ogre::PT_VECTOR3), &msPositionCmd); } }
/** Default constructor. */ GravityAffector(Ogre::ParticleSystem *psys) : ParticleAffector(psys) , mForce(0.0f) , mForceType(Type_Wind) , mPosition(0.0f) , mDirection(0.0f) { std::vector<Ogre::Bone*> bones = Ogre::any_cast<NiNodeHolder>(psys->getUserObjectBindings().getUserAny()).mBones; assert (!bones.empty()); mEmitterBone = bones[0]; Ogre::TagPoint* tag = static_cast<Ogre::TagPoint*>(mParent->getParentNode()); mParticleBone = static_cast<Ogre::Bone*>(tag->getParent()); mType = "Gravity"; // Init parameters if(createParamDictionary("GravityAffector")) { Ogre::ParamDictionary *dict = getParamDictionary(); Ogre::String force_title("force"); Ogre::String force_descr("Amount of force applied to particles."); Ogre::String force_type_title("force_type"); Ogre::String force_type_descr("Type of force applied to particles (point or wind)."); Ogre::String direction_title("direction"); Ogre::String direction_descr("Direction of wind forces."); Ogre::String position_title("position"); Ogre::String position_descr("Position of point forces."); dict->addParameter(Ogre::ParameterDef(force_title, force_descr, Ogre::PT_REAL), &msForceCmd); dict->addParameter(Ogre::ParameterDef(force_type_title, force_type_descr, Ogre::PT_STRING), &msForceTypeCmd); dict->addParameter(Ogre::ParameterDef(direction_title, direction_descr, Ogre::PT_VECTOR3), &msDirectionCmd); dict->addParameter(Ogre::ParameterDef(position_title, position_descr, Ogre::PT_VECTOR3), &msPositionCmd); } }
BulletScriptTester::BulletScriptTester(BulletEventSystem* eventSystem) : BulletTester() { m_type = "script"; m_parent = eventSystem; if (createParamDictionary("BulletScriptTester")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("output", "The output of bullet Tester.", Ogre::PT_STRING),&ms_outputCmd); } }
bool BulletFlowSystem::initParamDictionary(void) { if (createParamDictionary("BulletFlow")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("maxtime", "bullet flow max time", Ogre::PT_REAL),&ms_maxTimeCmd); return true; } return false; }
VBOOL VEffect::_initDefaults() { if (createParamDictionary("Effect")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("LifeTime", "the life time of this effect.", Ogre::PT_REAL),&msLifeTimeCmd); return VTRUE; } return VFALSE; }
BulletForceOperator::BulletForceOperator(BulletEventSystem* eventSystem) : BulletOperator() { m_type = "force"; m_parent = eventSystem; m_isOperated = false; m_forceVector = Ogre::Vector3::ZERO; if (createParamDictionary("BulletForceOperator")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("forceVector", "The mode of bullet speed operator.", Ogre::PT_VECTOR3),&ms_forceVectorCmd); } }
AnimationSound::AnimationSound() : mAttachTime(0.0f), mSoundName(""), mSoundHandle(-1), mPlayed(false) { if (createParamDictionary("AnimationSound")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("SoundName", "the file name of sound.", Ogre::PT_STRING),&msSoundNameCmd); dict->addParameter(Ogre::ParameterDef("AttachTime", "the time that play sound.", Ogre::PT_REAL),&msAttachTimeCmd); } }
DLightEffect::DLightEffect(Ogre::Entity* parent) :AttachEffectBase(parent) ,m_light(nullptr) ,m_dlType(eDLightType_None) ,m_fRadius(0) ,m_dlPointParam(1,0,0) { m_type = eAttachEffect_DLight; if (InitParamDict("DLight")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("lighttype", "Deferred light type", Ogre::PT_INT), &m_sCmdLightType); dict->addParameter(Ogre::ParameterDef("radius", "Radius of point light", Ogre::PT_REAL), &m_sCmdLightRadius); dict->addParameter(Ogre::ParameterDef("PointAtteParam", "Attenuation info of point light", Ogre::PT_VECTOR3), &m_sCmdPointAttenParam); } }
//--------------------------------------------------------------------- bool AnimationEffectInfo::initParamDictionary(void) { if (createParamDictionary("AnimationEffectInfo")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("AttachTime", "the time that showing the effect.", Ogre::PT_REAL),&msAttachTimeCmd); dict->addParameter(Ogre::ParameterDef("AttachPoint", "the attached bone or locator.", Ogre::PT_STRING),&msAttachPointCmd); dict->addParameter(Ogre::ParameterDef("EffectTemplateName", "name of effect template.", Ogre::PT_STRING),&msEffectTemplateNameCmd); dict->addParameter(Ogre::ParameterDef("OffsetPos", "offset position to the attach point.", Ogre::PT_VECTOR3),&msOffsetPosCmd); dict->addParameter(Ogre::ParameterDef("OffsetRotation", "offset orientation to the attach point.", Ogre::PT_QUATERNION),&msOffsetRotationCmd); dict->addParameter(Ogre::ParameterDef("Attach", "whether the effect will move along with the attach point.", Ogre::PT_BOOL),&msAttachCmd); return true; } return false; }
MeshElement::MeshElement(const String &type, System *system) : EffectElement(type, system), mEntity(NULL), mMeshName(""), mMaterialName("none") { if ( initDefaults(mElementType) ) { Ogre::ParamDictionary* dict = getParamDictionary(); // Custom params dict->addParameter(Ogre::ParameterDef("MeshName", "the name of mesh.", Ogre::PT_STRING),&msMeshNameCmd); dict->addParameter(Ogre::ParameterDef("Material", "the name of material.", Ogre::PT_STRING),&msMaterialNameCmd); } }
BulletBirthOperator::BulletBirthOperator(BulletEventSystem* eventSystem) : BulletOperator(), m_birthedTimes(0.0f),m_birthTimes(0.0f),m_isOperated(false) { m_type = "birth"; m_parent = eventSystem; if (createParamDictionary("BulletBirthOperator")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("bulletsystemname", "The bulletsystemname of bullet birth operator.", Ogre::PT_STRING),&ms_bulletTemplateCmd); dict->addParameter(Ogre::ParameterDef("birthtimes", "The times of bullet birth operator.", Ogre::PT_REAL),&ms_birthTimesCmd); } }
BulletHelixOperator::BulletHelixOperator(BulletEventSystem* eventSystem) : BulletOperator() { m_type = "helix"; m_parent = eventSystem; m_amplitude = 0.0; m_frequency = 0.0; if (createParamDictionary("BulletHelixOperator")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("amplitude", "The amplitude of bullet helix operator.", Ogre::PT_REAL),&ms_amplitudeCmd); dict->addParameter(Ogre::ParameterDef("frequency", "The frequency of bullet helix operator.", Ogre::PT_REAL),&ms_frequencyCmd); } }
/** Default constructor. */ GrowFadeAffector(Ogre::ParticleSystem *psys) : ParticleAffector(psys) { mGrowTime = 0.0f; mFadeTime = 0.0f; mType = "GrowFade"; // Init parameters if(createParamDictionary("GrowFadeAffector")) { Ogre::ParamDictionary *dict = getParamDictionary(); Ogre::String grow_title("grow_time"); Ogre::String fade_title("fade_time"); Ogre::String grow_descr("Time from begin to reach full size."); Ogre::String fade_descr("Time from end to shrink."); dict->addParameter(Ogre::ParameterDef(grow_title, grow_descr, Ogre::PT_REAL), &msGrowCmd); dict->addParameter(Ogre::ParameterDef(fade_title, fade_descr, Ogre::PT_REAL), &msFadeCmd); } }
//--------------------------------------------------------------------- bool Skill::initParamDictionary(void) { if (createParamDictionary("Skill")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("Animation", "name of animation.", Ogre::PT_STRING),&msAnimationNameCmd); dict->addParameter(Ogre::ParameterDef("BreakTime", "the break time of skill.", Ogre::PT_STRING),&msBreakTimeCmd); dict->addParameter(Ogre::ParameterDef("HitTime", "the hit time of skill.", Ogre::PT_STRING),&msHitTimeCmd); dict->addParameter(Ogre::ParameterDef("ShakeTime", "the shake time of skill.", Ogre::PT_STRING),&msShakeTimeCmd); dict->addParameter(Ogre::ParameterDef("RepeatEffect", "whether recreate effect when the animation is loop.", Ogre::PT_BOOL),&msRepeatEffectCmd); return true; } return false; }
AnimationSceneLightInfo::AnimationSceneLightInfo(void) : mAttachTime(0.0f), mLastTime(0.0f), mFadeInTime(0.0f), mFadeOutTime(0.0f), mDestColour(Ogre::ColourValue::Black) { if (createParamDictionary("AnimationSceneLightInfo")) { Ogre::ParamDictionary* dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("AttachTime", "the time that starting changing the light.", Ogre::PT_REAL),&msAttachTimeCmd); dict->addParameter(Ogre::ParameterDef("LastTime", "the last time that changing the light.", Ogre::PT_REAL),&msLastTimeCmd); dict->addParameter(Ogre::ParameterDef("FadeInTime", "the fade in time.", Ogre::PT_REAL),&msFadeInTimeCmd); dict->addParameter(Ogre::ParameterDef("FadeOutTime", "the fade out time.", Ogre::PT_REAL),&msFadeOutTimeCmd); dict->addParameter(Ogre::ParameterDef("DestColour", "the dest colour of light.", Ogre::PT_COLOURVALUE),&msDestColourCmd); } }
/** 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; }
VPointLightElement::VPointLightElement(const VString &type) : VEffectElement(type) , mLight(VNULL) , mDiffuse(Ogre::ColourValue::White) , mSpecular(Ogre::ColourValue::Black) , mRange(1000.0f) , mAttenuationConstant(1.0f) , mAttenuationLinear(0.0f) , mAttenuationQuadric(0.0f) { if (_initDefaults(mElementType)) { Ogre::ParamDictionary *dict = getParamDictionary(); dict->addParameter(Ogre::ParameterDef("Diffuse", "diffuse colour of point light.", Ogre::PT_COLOURVALUE), &msDiffuseCmd); dict->addParameter(Ogre::ParameterDef("Specular", "specular colour of point light.", Ogre::PT_COLOURVALUE), &msSpecularCmd); dict->addParameter(Ogre::ParameterDef("Range", "range of point light.", Ogre::PT_REAL), &msRangeCmd); dict->addParameter(Ogre::ParameterDef("AttenuationConstant", "attenuation constant of point light.", Ogre::PT_REAL), &msAttenuationConstantCmd); dict->addParameter(Ogre::ParameterDef("AttenuationLinear", "attenuation linear of point light.", Ogre::PT_REAL), &msAttenuationLinearCmd); dict->addParameter(Ogre::ParameterDef("AttenuationQuadric", "attenuation quadric of point light.", Ogre::PT_REAL), &msAttenuationQuadricCmd); } }
BeamElement::BeamElement(const String &type, System *system) : EffectElement(type, system), mNumBillboardElements(10), mNoiseXMin(0.0f), mNoiseXMax(0.0f), mNoiseYMin(0.0f), mNoiseYMax(0.0f), mNoiseZMin(0.0f), mNoiseZMax(0.0f), mDestPos(Ogre::Vector3::UNIT_Y), // 初始位置 mWidth(10.0f), mBillboardChain(NULL), mMaterialName("BaseWhiteNoLighting"), mFrequency(20.0f), mFrequencyTime(0.0f) { if ( initDefaults(mElementType) ) { Ogre::ParamDictionary* dict = getParamDictionary(); // Custom params dict->addParameter(Ogre::ParameterDef("NoiseXMin", "min noise of x axis.", Ogre::PT_REAL),&msNoiseXMinCmd); dict->addParameter(Ogre::ParameterDef("NoiseXMax", "max noise of x axis.", Ogre::PT_REAL),&msNoiseXMaxCmd); dict->addParameter(Ogre::ParameterDef("NoiseYMin", "min noise of y axis.", Ogre::PT_REAL),&msNoiseYMinCmd); dict->addParameter(Ogre::ParameterDef("NoiseYMax", "max noise of y axis.", Ogre::PT_REAL),&msNoiseYMaxCmd); dict->addParameter(Ogre::ParameterDef("NoiseZMin", "min noise of z axis.", Ogre::PT_REAL),&msNoiseZMinCmd); dict->addParameter(Ogre::ParameterDef("NoiseZMax", "max noise of z axis.", Ogre::PT_REAL),&msNoiseZMaxCmd); dict->addParameter(Ogre::ParameterDef("NumElements", "the num of billboard chain elements.", Ogre::PT_INT),&msNumElementsCmd); dict->addParameter(Ogre::ParameterDef("Width", "width of billboard.", Ogre::PT_REAL),&msWidthCmd); dict->addParameter(Ogre::ParameterDef("Colour", "The colour of emitted particles.", Ogre::PT_COLOURVALUE), &msColourCmd); dict->addParameter(Ogre::ParameterDef("ColourRangeStart", "The start of a range of colours to be assigned to emitted particles.", Ogre::PT_COLOURVALUE), &msColourRangeStartCmd); dict->addParameter(Ogre::ParameterDef("ColourRangeEnd", "The end of a range of colours to be assigned to emitted particles.", Ogre::PT_COLOURVALUE), &msColourRangeEndCmd); dict->addParameter(Ogre::ParameterDef("Material", "name of beam material.", Ogre::PT_STRING),&msMaterialCmd); dict->addParameter(Ogre::ParameterDef("Frequency", "frequency of billboard.", Ogre::PT_REAL),&msFrequencyCmd); } mColourRangeStart = mColourRangeEnd = Ogre::ColourValue::White; }
BillboardSetElement::BillboardSetElement(const String &type, System *system) : EffectElement(type, system), mBillboardSet(NULL), mBillboardColour(Ogre::ColourValue::White), mScaleIntervalTime(0.1f), mSizeChanged(false), mBillboardCount(5), mBillboardMaterial("BaseWhiteNoLighting"), mBillboardInterval(10.0f), mBillboardWidth(100.0f), mBillboardHeight(100.0f), mAlphaValue(1.0f), mColourChanged(false), mStacks(1), mSlices(1), mTexIntervalTime(0.1f), mCurrentTexIntervalTime(0.0f) { for (int i=0; i<MAX_STAGES; ++i) { mBillboardScale[i] = Ogre::Vector3(1.0f, 1.0f, 1.0f); } if ( initDefaults(mElementType) ) { Ogre::ParamDictionary* dict = getParamDictionary(); // Custom params dict->addParameter(Ogre::ParameterDef("BillboardColour", "BillboardColour", Ogre::PT_COLOURVALUE), &msBillboardColourCmd); dict->addParameter(Ogre::ParameterDef("BillboardAlpha", "Billboard Alpha Value of first point and second point.", Ogre::PT_REAL),&msBillboardAlphaCmd); dict->addParameter(Ogre::ParameterDef("BillboardCount", "the life time of the vertex.", Ogre::PT_INT),&msBillboardCountCmd); dict->addParameter(Ogre::ParameterDef("Material", "alpha factor of head point.", Ogre::PT_STRING),&msBillboardMaterialCmd); dict->addParameter(Ogre::ParameterDef("BillboardInterval", "alpha factor of tail point.", Ogre::PT_REAL),&msBillboardIntervalCmd); dict->addParameter(Ogre::ParameterDef("BillboardHeight", "alpha factor of tail point.", Ogre::PT_REAL),&msBillboardHeightCmd); dict->addParameter(Ogre::ParameterDef("BillboardWidth", "alpha factor of tail point.", Ogre::PT_REAL),&msBillboardWidthCmd); for (int i=0;i<MAX_STAGES;i++) { msBillboardScaleCmd[i].mIndex = i; Ogre::StringUtil::StrStreamType stage; stage << i; String colour_title = String("BillboardScale") + stage.str(); String colour_descr = String("Stage ") + stage.str() + String(" BillboardScale of first point and second point."); dict->addParameter(Ogre::ParameterDef(colour_title, colour_descr, Ogre::PT_VECTOR3), &msBillboardScaleCmd[i]); } dict->addParameter(Ogre::ParameterDef("ScaleIntervalTime", "the interval time of changing scale.", Ogre::PT_REAL),&msScaleIntervalTimeCmd); dict->addParameter(Ogre::ParameterDef("stacks", "the stacks of texture coordinates.", Ogre::PT_UNSIGNED_LONG), &msStacksCmd); dict->addParameter(Ogre::ParameterDef("slices", "the slices of texture coordinates.", Ogre::PT_UNSIGNED_LONG), &msSlicesCmd); dict->addParameter(Ogre::ParameterDef("TexIntervalTime", "the interval time of changing texture index.", Ogre::PT_REAL),&msTexIntervalTimeCmd); } }