mirror of https://github.com/axmolengine/axmol.git
Merge branch 'particle_merge' of https://github.com/super626/cocos2d-x into particle_merge
This commit is contained in:
commit
9e06a4b848
|
@ -511,6 +511,8 @@ void PUParticleSystem3D::prepared()
|
|||
|
||||
_prepared = true;
|
||||
_timeElapsedSinceStart = 0.0f;
|
||||
if (_parentParticleSystem)
|
||||
_particleSystemScaleVelocity = _parentParticleSystem->getParticleSystemScaleVelocity();
|
||||
}
|
||||
|
||||
notifyRescaled(getDerivedScale());
|
||||
|
|
|
@ -165,18 +165,18 @@ void PUParticleSystem3DTranslator::translate(PUScriptCompiler* compiler, PUAbstr
|
|||
}
|
||||
}
|
||||
}
|
||||
// else if (prop->name == token[TOKEN_PS_SCALE_VELOCITY])
|
||||
// {
|
||||
// // Property: scale_velocity
|
||||
// if (passValidateProperty(compiler, prop, token[TOKEN_PS_ITERATION_INTERVAL], VAL_REAL))
|
||||
// {
|
||||
// Real val = 0.0f;
|
||||
// if(getReal(prop->values.front(), &val))
|
||||
// {
|
||||
// mSystem->setScaleVelocity(val);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
else if (prop->name == token[TOKEN_PS_SCALE_VELOCITY])
|
||||
{
|
||||
// Property: scale_velocity
|
||||
if (passValidateProperty(compiler, prop, token[TOKEN_PS_ITERATION_INTERVAL], VAL_REAL))
|
||||
{
|
||||
float val = 0.0f;
|
||||
if(getFloat(*prop->values.front(), &val))
|
||||
{
|
||||
_system->setParticleSystemScaleVelocity(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
// else if (prop->name == token[TOKEN_PS_SCALE_TIME])
|
||||
// {
|
||||
// // Property: scale_time
|
||||
|
|
|
@ -54,6 +54,7 @@ static std::function<Layer*()> createFunctions[] =
|
|||
CL(Particle3DCanOfWormsDemo),
|
||||
CL(Particle3DRibbonTrailDemo),
|
||||
CL(Particle3DWeaponTrailDemo),
|
||||
CL(Particle3DWithSprite3DDemo),
|
||||
};
|
||||
|
||||
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
||||
|
@ -357,22 +358,6 @@ bool Particle3DLineStreakDemo::init()
|
|||
if (!Particle3DTestDemo::init())
|
||||
return false;
|
||||
|
||||
|
||||
std::string c3bfileName = "Sprite3DTest/orc.c3b";
|
||||
auto sprite = Sprite3D::create(c3bfileName);
|
||||
this->addChild(sprite);
|
||||
//sprite->setPosition3D(Vec3(0, -20, -25));
|
||||
//sprite->setScale(5, 5);
|
||||
sprite->setRotation3D(Vec3(0, 180, 0));
|
||||
sprite->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||
//sprite->setOpacity(100);
|
||||
auto animation = Animation3D::create(c3bfileName);
|
||||
if (animation)
|
||||
{
|
||||
auto animate = Animate3D::create(animation);
|
||||
sprite->runAction(RepeatForever::create(animate));
|
||||
}
|
||||
|
||||
auto rootps = PUParticleSystem3D::create("lineStreak.pu", "pu_mediapack_01.material");
|
||||
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||
rootps->setScale(5.0f);
|
||||
|
@ -546,3 +531,42 @@ bool Particle3DWeaponTrailDemo::init()
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string Particle3DWithSprite3DDemo::subtitle() const
|
||||
{
|
||||
return "Particle3DWithSprite3D";
|
||||
}
|
||||
|
||||
bool Particle3DWithSprite3DDemo::init()
|
||||
{
|
||||
if (!Particle3DTestDemo::init())
|
||||
return false;
|
||||
|
||||
std::string c3bfileName = "Sprite3DTest/orc.c3b";
|
||||
auto sprite = Sprite3D::create(c3bfileName);
|
||||
this->addChild(sprite);
|
||||
sprite->setPosition3D(Vec3(-20.0f, 0.0f, 0.0f));
|
||||
sprite->setRotation3D(Vec3(0, 180, 0));
|
||||
sprite->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||
//sprite->setOpacity(100);
|
||||
auto animation = Animation3D::create(c3bfileName);
|
||||
if (animation)
|
||||
{
|
||||
auto animate = Animate3D::create(animation);
|
||||
sprite->runAction(RepeatForever::create(animate));
|
||||
}
|
||||
|
||||
auto billboard = BillBoard::create("Images/Icon.png");
|
||||
billboard->setPosition3D(Vec3(20.0f, 0.0f, 0.0f));
|
||||
billboard->setScale(0.2f);
|
||||
billboard->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||
this->addChild(billboard);
|
||||
|
||||
|
||||
auto rootps = PUParticleSystem3D::create("star.pu");
|
||||
rootps->setCameraMask((unsigned short)CameraFlag::USER1);
|
||||
rootps->startParticleSystem();
|
||||
this->addChild(rootps, 0, PARTICLE_SYSTEM_TAG);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -253,6 +253,19 @@ public:
|
|||
virtual bool init() override;
|
||||
};
|
||||
|
||||
class Particle3DWithSprite3DDemo : public Particle3DTestDemo
|
||||
{
|
||||
public:
|
||||
|
||||
CREATE_FUNC(Particle3DWithSprite3DDemo);
|
||||
Particle3DWithSprite3DDemo(){};
|
||||
virtual ~Particle3DWithSprite3DDemo(){};
|
||||
|
||||
virtual std::string subtitle() const override;
|
||||
|
||||
virtual bool init() override;
|
||||
};
|
||||
|
||||
class Particle3DTestScene : public TestScene
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue