From 458b9b53da88ed7126ff0817996abb41e6e02bd2 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Tue, 19 Nov 2013 11:16:14 +0800 Subject: [PATCH 1/4] HotFix: fix CCB particle alpha blend --- .../cocosbuilder/CCParticleSystemQuadLoader.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp b/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp index 472d1e8d91..d2333c599b 100644 --- a/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp @@ -127,6 +127,10 @@ void ParticleSystemQuadLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pP void ParticleSystemQuadLoader::onHandlePropTypeTexture(Node * pNode, Node * pParent, const char * pPropertyName, Texture2D * pTexture2D, CCBReader * ccbReader) { if(strcmp(pPropertyName, PROPERTY_TEXTURE) == 0) { + if(pTexture2D) + { + ((ParticleSystemQuad *)pNode)->setBlendAdditive(true); + } ((ParticleSystemQuad *)pNode)->setTexture(pTexture2D); } else { NodeLoader::onHandlePropTypeTexture(pNode, pParent, pPropertyName, pTexture2D, ccbReader); From fff851a8aafad4272097f3c98d80cdd28936a770 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Tue, 19 Nov 2013 11:17:02 +0800 Subject: [PATCH 2/4] HotFix: change tab to space --- cocos/2d/CCParticleSystemQuad.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cocos/2d/CCParticleSystemQuad.cpp b/cocos/2d/CCParticleSystemQuad.cpp index 36d2567809..80e48a0194 100644 --- a/cocos/2d/CCParticleSystemQuad.cpp +++ b/cocos/2d/CCParticleSystemQuad.cpp @@ -328,22 +328,22 @@ void ParticleSystemQuad::updateQuadWithParticle(tParticle* particle, const Point void ParticleSystemQuad::postStep() { glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]); - - // Option 1: Sub Data + + // Option 1: Sub Data glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(_quads[0])*_totalParticles, _quads); - - // Option 2: Data - // glBufferData(GL_ARRAY_BUFFER, sizeof(quads_[0]) * particleCount, quads_, GL_DYNAMIC_DRAW); - - // Option 3: Orphaning + glMapBuffer - // glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0])*_totalParticles, NULL, GL_STREAM_DRAW); - // void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); - // memcpy(buf, _quads, sizeof(_quads[0])*_totalParticles); - // glUnmapBuffer(GL_ARRAY_BUFFER); - glBindBuffer(GL_ARRAY_BUFFER, 0); + // Option 2: Data + // glBufferData(GL_ARRAY_BUFFER, sizeof(quads_[0]) * particleCount, quads_, GL_DYNAMIC_DRAW); - CHECK_GL_ERROR_DEBUG(); + // Option 3: Orphaning + glMapBuffer + // glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0])*_totalParticles, NULL, GL_STREAM_DRAW); + // void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); + // memcpy(buf, _quads, sizeof(_quads[0])*_totalParticles); + // glUnmapBuffer(GL_ARRAY_BUFFER); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + + CHECK_GL_ERROR_DEBUG(); } // overriding draw method From 49f34c533956feaa602f33a3270c4e64896bc17e Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Tue, 19 Nov 2013 11:19:12 +0800 Subject: [PATCH 3/4] HotFix: fix CCB particle alpha blend-> setBlendAddictive after set texture --- .../editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp b/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp index d2333c599b..06854df2ab 100644 --- a/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp @@ -127,11 +127,11 @@ void ParticleSystemQuadLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pP void ParticleSystemQuadLoader::onHandlePropTypeTexture(Node * pNode, Node * pParent, const char * pPropertyName, Texture2D * pTexture2D, CCBReader * ccbReader) { if(strcmp(pPropertyName, PROPERTY_TEXTURE) == 0) { + ((ParticleSystemQuad *)pNode)->setTexture(pTexture2D); if(pTexture2D) { ((ParticleSystemQuad *)pNode)->setBlendAdditive(true); } - ((ParticleSystemQuad *)pNode)->setTexture(pTexture2D); } else { NodeLoader::onHandlePropTypeTexture(pNode, pParent, pPropertyName, pTexture2D, ccbReader); } From 1fc928df417abe1f47e4189e1338d0035e9d8618 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Tue, 19 Nov 2013 11:32:12 +0800 Subject: [PATCH 4/4] HotFix: use static cast for format conversion --- .../cocosbuilder/CCParticleSystemQuadLoader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp b/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp index 06854df2ab..e019478ee7 100644 --- a/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp +++ b/cocos/editor-support/cocosbuilder/CCParticleSystemQuadLoader.cpp @@ -127,10 +127,10 @@ void ParticleSystemQuadLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pP void ParticleSystemQuadLoader::onHandlePropTypeTexture(Node * pNode, Node * pParent, const char * pPropertyName, Texture2D * pTexture2D, CCBReader * ccbReader) { if(strcmp(pPropertyName, PROPERTY_TEXTURE) == 0) { - ((ParticleSystemQuad *)pNode)->setTexture(pTexture2D); + static_cast(pNode)->setTexture(pTexture2D); if(pTexture2D) { - ((ParticleSystemQuad *)pNode)->setBlendAdditive(true); + static_cast(pNode)->setBlendAdditive(true); } } else { NodeLoader::onHandlePropTypeTexture(pNode, pParent, pPropertyName, pTexture2D, ccbReader);