# 科普一下

1983年先驱William T. Reeves在《Computer Graphics》上发表了《Particle Systems: A Technique for Modeling a Class of Fuzzy Objects》一文。他向人们介绍了在《Star Trek II: The Wrath of Khan》中使用的粒子系统，被认为是最早掌握此系统的人之一。

# 使用粒子系统

http://blog.sina.com.cn/s/blog_537cabb80100i0qu.html

http://4137613.blog.51cto.com/4127613/767801

## 1)基本用法

 1     emitter2 = CCParticleSun::node();
2     emitter2->retain();
4     emitter2->setPosVar(ccp(3, 3));
5     emitter2->setStartSize(20.0f);
6     emitter2->setStartSizeVar(2.0f);
7     emitter2->setEndSize(0.0f);
8     emitter2->setEndSizeVar(0.0f);
9     ccColor4F endColor2 = { 0.0f, 0.0f, 0.0f, 0.1f };
10     emitter2->setEndColor(endColor2);
11     emitter2->stopSystem();
12     addChild(emitter2);

 1 class CC_DLL CCParticleSun : public ARCH_OPTIMAL_PARTICLE_SYSTEM
2 {
3 public:
4     CCParticleSun(){}
5     virtual ~CCParticleSun(){}
6     // 使用node方法创建的对象实例默认350个粒子
7     bool init(){ return initWithTotalParticles(350); }
8     virtual bool initWithTotalParticles(unsigned int numberOfParticles);
9     static CCParticleSun * node()
10     {
11         CCParticleSun *pRet = new CCParticleSun();
12         if (pRet->init())
13         {
14             pRet->autorelease();
15             return pRet;
16         }
17         CC_SAFE_DELETE(pRet)
18         return NULL;
19     }
20 };

## 2)更灵活的应用

 1     emitter2 = new CCParticleSun();
2     emitter2->initWithTotalParticles(250);
4     emitter2->setPosVar(ccp(3, 3));
5     emitter2->setStartSize(20.0f);
6     emitter2->setStartSizeVar(2.0f);
7     emitter2->setEndSize(0.0f);
8     emitter2->setEndSizeVar(0.0f);
9     ccColor4F endColor2 = { 0.0f, 0.0f, 0.0f, 0.1f };
10     emitter2->setEndColor(endColor2);
11     emitter2->stopSystem();

# 小结

http://files.cnblogs.com/cocos2d-x/ZYG007.rar

posted @ 2012-06-10 21:12 Bugs Bunny 阅读(...) 评论(...) 编辑 收藏