2019-11-23 20:27:39 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (C) 2013 Henry van Merode. All rights reserved.
|
|
|
|
Copyright (c) 2015-2016 Chukong Technologies Inc.
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
https://axmolengine.github.io/
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
2021-12-25 10:04:45 +08:00
|
|
|
|
2019-11-23 20:27:39 +08:00
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2023-06-11 13:08:08 +08:00
|
|
|
#include "PUAffectorManager.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUAlignAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUBaseCollider.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUBaseForceAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUBoxCollider.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUCollisionAvoidanceAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUColorAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUFlockCenteringAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUForceFieldAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUGeometryRotator.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUGravityAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUInterParticleCollider.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUJetAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PULineAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PULinearForceAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUParticleFollower.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUPathFollower.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUPlaneCollider.h"
|
|
|
|
#include "extensions/Particle3D/PU/PURandomiser.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUScaleAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUScaleVelocityAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUSineForceAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUSphereCollider.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUTextureAnimator.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUTextureRotator.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUVelocityMatchingAffector.h"
|
|
|
|
#include "extensions/Particle3D/PU/PUVortexAffector.h"
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_BEGIN
|
2021-12-25 10:04:45 +08:00
|
|
|
PUAffectorManager::PUAffectorManager() {}
|
2019-11-23 20:27:39 +08:00
|
|
|
|
2021-12-25 10:04:45 +08:00
|
|
|
PUAffectorManager::~PUAffectorManager() {}
|
2019-11-23 20:27:39 +08:00
|
|
|
|
|
|
|
PUAffectorManager* PUAffectorManager::Instance()
|
|
|
|
{
|
|
|
|
static PUAffectorManager pam;
|
|
|
|
return &pam;
|
|
|
|
}
|
|
|
|
|
2021-12-31 12:12:40 +08:00
|
|
|
PUScriptTranslator* PUAffectorManager::getTranslator(std::string_view type)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (type == "Align")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_alignAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Dummy02")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_baseColliderTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Dummy01")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_baseForceAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "BoxCollider")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_boxColliderTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "CollisionAvoidance")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_collisionAvoidanceAffectorTranstor;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Colour")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_colorAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "FlockCentering")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_flockCenteringAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "ForceField")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_forceFieldAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "GeometryRotator")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_geometryRotatorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Gravity")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_gravityAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "InterParticleCollider")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_interParticleColliderTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Jet")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_jetAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Line")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_lineAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "LinearForce")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_linearForceAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "ParticleFollower")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_particleFollowerTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "PathFollower")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_pathFollowerTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "PlaneCollider")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_planeColliderTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Randomiser")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_randomiserTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Scale")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_scaleAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "ScaleVelocity")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_scaleVelocityAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "SineForce")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_sineForceAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "SphereCollider")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_sphereColliderTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "TextureAnimator")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_textureAnimatorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "TextureRotator")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_textureRotatorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "VelocityMatching")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_velocityMatchingAffectorTranslator;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Vortex")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return &_vortexAffectorTranslator;
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2021-12-31 12:12:40 +08:00
|
|
|
PUAffector* PUAffectorManager::createAffector(std::string_view type)
|
2019-11-23 20:27:39 +08:00
|
|
|
{
|
2021-12-25 10:04:45 +08:00
|
|
|
if (type == "Align")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUAlignAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Dummy02")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Dummy01")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return nullptr;
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "BoxCollider")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUBoxCollider::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "CollisionAvoidance")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUCollisionAvoidanceAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Colour")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUColorAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "FlockCentering")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUFlockCenteringAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "ForceField")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUForceFieldAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "GeometryRotator")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUGeometryRotator::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Gravity")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUGravityAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "InterParticleCollider")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUParticle3DInterParticleCollider::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Jet")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUJetAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Line")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PULineAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "LinearForce")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PULinearForceAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "ParticleFollower")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUParticleFollower::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "PathFollower")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUPathFollower::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "PlaneCollider")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUPlaneCollider::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Randomiser")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PURandomiser::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Scale")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUScaleAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "ScaleVelocity")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUScaleVelocityAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "SineForce")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUSineForceAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "SphereCollider")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUSphereCollider::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "TextureAnimator")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUTextureAnimator::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "TextureRotator")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUTextureRotator::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "VelocityMatching")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUVelocityMatchingAffector::create();
|
2021-12-25 10:04:45 +08:00
|
|
|
}
|
|
|
|
else if (type == "Vortex")
|
|
|
|
{
|
2019-11-23 20:27:39 +08:00
|
|
|
return PUVortexAffector::create();
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
NS_AX_END
|