Merge branch 'improved_glprogram' of github.com:super626/cocos2d-x into improved_glprogram

This commit is contained in:
Ricardo Quesada 2014-05-09 12:00:33 -07:00
commit 9ffaeec515
4 changed files with 266 additions and 32 deletions

View File

@ -117,7 +117,7 @@ ParticleSystem::ParticleSystem()
, _texture(nullptr)
, _blendFunc(BlendFunc::ALPHA_PREMULTIPLIED)
, _opacityModifyRGB(false)
, _yCoordFlipped(0)
, _yCoordFlipped(1)
, _positionType(PositionType::FREE)
{
modeA.gravity = Vector2::ZERO;
@ -416,10 +416,7 @@ bool ParticleSystem::initWithDictionary(ValueMap& dictionary, const std::string&
}
}
if (!_configName.empty())
{
_yCoordFlipped = dictionary["yCoordFlipped"].asInt();
}
_yCoordFlipped = dictionary.find("yCoordFlipped") == dictionary.end() ? 1 : dictionary.at("yCoordFlipped").asInt();
if( !this->_texture)
CCLOGWARN("cocos2d: Warning: ParticleSystemQuad system without a texture");
@ -726,14 +723,12 @@ void ParticleSystem::update(float dt)
tmp = radial + tangential + modeA.gravity;
tmp = tmp * dt;
p->modeA.dir = p->modeA.dir + tmp;
if (_configName.length()>0 && _yCoordFlipped != -1)
{
tmp = p->modeA.dir * -dt;
}
else
{
tmp = p->modeA.dir * dt;
}
// this is cocos2d-x v3.0
// if (_configName.length()>0 && _yCoordFlipped != -1)
// this is cocos2d-x v3.0
tmp = p->modeA.dir * dt * _yCoordFlipped;
p->pos = p->pos + tmp;
}
@ -746,10 +741,7 @@ void ParticleSystem::update(float dt)
p->pos.x = - cosf(p->modeB.angle) * p->modeB.radius;
p->pos.y = - sinf(p->modeB.angle) * p->modeB.radius;
if (_yCoordFlipped == 1)
{
p->pos.y = -p->pos.y;
}
p->pos.y *= _yCoordFlipped;
}
// color

View File

@ -995,28 +995,30 @@ Layer* createParticleLayer(int nIndex)
case 30: return new DemoParticleFromFile("Galaxy");
case 31: return new DemoParticleFromFile("Phoenix");
case 32: return new DemoParticleFromFile("lines");
case 33: return new RadiusMode1();
case 34: return new RadiusMode2();
case 35: return new Issue704();
case 36: return new Issue870();
case 37: return new Issue1201();
case 33: return new DemoParticleFromFile("ButterFly");
case 34: return new DemoParticleFromFile("ButterFlyYFlipped");
case 35: return new RadiusMode1();
case 36: return new RadiusMode2();
case 37: return new Issue704();
case 38: return new Issue870();
case 39: return new Issue1201();
// v1.1 tests
case 38: return new MultipleParticleSystems();
case 39: return new MultipleParticleSystemsBatched();
case 40: return new AddAndDeleteParticleSystems();
case 41: return new ReorderParticleSystems();
case 42: return new PremultipliedAlphaTest();
case 43: return new PremultipliedAlphaTest2();
case 44: return new Issue3990();
case 45: return new ParticleAutoBatching();
case 46: return new ParticleVisibleTest();
case 40: return new MultipleParticleSystems();
case 41: return new MultipleParticleSystemsBatched();
case 42: return new AddAndDeleteParticleSystems();
case 43: return new ReorderParticleSystems();
case 44: return new PremultipliedAlphaTest();
case 45: return new PremultipliedAlphaTest2();
case 46: return new Issue3990();
case 47: return new ParticleAutoBatching();
case 48: return new ParticleVisibleTest();
default:
break;
}
return NULL;
}
#define MAX_LAYER 47
#define MAX_LAYER 49
Layer* nextParticleAction()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long