| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- /*
- * Copyright (C) 2022 The V-Gears Team
- *
- * This file is part of V-Gears
- *
- * V-Gears is free software: you can redistribute it and/or modify it under
- * terms of the GNU General Public License as published by the Free Software
- * Foundation, version 3.0 (GPLv3) of the License.
- *
- * V-Gears is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
- #include <OgreStringConverter.h>
- #include "engine/particles/ParticleEmitterDictionary.h"
- #include "engine/particles/ParticleEmitter.h"
- #include "common/Logger.h"
- #include "common/Utilities.h"
- namespace ParticleEmitterDictionary{
- void EmissionRate::doSet(void* target, const Ogre::String& val){
- static_cast<ParticleEmitter*>(target)->SetEmissionRate(
- Ogre::StringConverter::parseInt(val)
- );
- }
- void TotalTimeToLive::doSet(void* target, const Ogre::String& val){
- static_cast<ParticleEmitter*>(target)->SetEmitTotalTimeToLive(
- Ogre::StringConverter::parseReal(val)
- );
- }
- void Direction::doSet(void* target, const Ogre::String& val){
- Ogre::StringVector strings = StringTokenise(val);
- if (strings.size() == 1){
- static_cast<ParticleEmitter*>(target)->SetEmitDirection(
- Ogre::StringConverter::parseVector3(strings[0])
- );
- }
- else if (strings.size() > 1){
- static_cast<ParticleEmitter*>(target)->SetEmitDirectionRange(
- Ogre::StringConverter::parseVector3(strings[0]),
- Ogre::StringConverter::parseVector3(strings[1])
- );
- }
- else{
- LOG_WARNING(
- "The direction of a particle emitter must have at least a value."
- );
- }
- }
- }
|