123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- #ifndef __CC_PARTICLE_SYSTEM_QUAD_H__
- #define __CC_PARTICLE_SYSTEM_QUAD_H__
- #include "2d/CCParticleSystem.h"
- #include "renderer/CCQuadCommand.h"
- NS_CC_BEGIN
- class SpriteFrame;
- class EventCustom;
- class CC_DLL ParticleSystemQuad : public ParticleSystem
- {
- public:
-
- static ParticleSystemQuad * create();
-
- static ParticleSystemQuad * createWithTotalParticles(int numberOfParticles);
-
- static ParticleSystemQuad * create(const std::string& filename);
-
- static ParticleSystemQuad * create(ValueMap &dictionary);
-
- void setDisplayFrame(SpriteFrame *spriteFrame);
-
- void setTextureWithRect(Texture2D *texture, const Rect& rect);
-
- void listenRendererRecreated(EventCustom* event);
-
- virtual void setTexture(Texture2D* texture) override;
-
-
- virtual void updateParticleQuads() override;
-
- virtual void postStep() override;
-
- virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
-
- virtual void setBatchNode(ParticleBatchNode* batchNode) override;
-
- virtual void setTotalParticles(int tp) override;
- virtual std::string getDescription() const override;
-
- CC_CONSTRUCTOR_ACCESS:
-
- ParticleSystemQuad();
-
- virtual ~ParticleSystemQuad();
-
-
-
- virtual bool initWithTotalParticles(int numberOfParticles) override;
-
- protected:
-
- void initIndices();
-
-
- void initTexCoordsWithRect(const Rect& rect);
-
-
- void updateTexCoords();
- void setupVBOandVAO();
- void setupVBO();
- bool allocMemory();
- V3F_C4B_T2F_Quad *_quads;
- GLushort *_indices;
- GLuint _VAOname;
- GLuint _buffersVBO[2];
- QuadCommand _quadCommand;
-
- private:
- CC_DISALLOW_COPY_AND_ASSIGN(ParticleSystemQuad);
- };
- NS_CC_END
- #endif
|