From 2687ee8915bbb67c9df5c46e88637ea281ad569b Mon Sep 17 00:00:00 2001 From: bmanGH Date: Wed, 13 Nov 2013 14:52:16 +0800 Subject: [PATCH] put '{' in a new line to follow cocos2d-x coding style --- cocos/2d/CCDrawNode.cpp | 15 ++++++++----- cocos/2d/CCParticleSystemQuad.cpp | 36 ++++++++++++++++++++----------- cocos/2d/CCTextureAtlas.cpp | 21 ++++++++++++------ cocos/2d/ccGLStateCache.cpp | 3 ++- 4 files changed, 50 insertions(+), 25 deletions(-) diff --git a/cocos/2d/CCDrawNode.cpp b/cocos/2d/CCDrawNode.cpp index 0fb35408bf..67ba1075b1 100644 --- a/cocos/2d/CCDrawNode.cpp +++ b/cocos/2d/CCDrawNode.cpp @@ -115,7 +115,8 @@ DrawNode::~DrawNode() glDeleteBuffers(1, &_vbo); _vbo = 0; - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { glDeleteVertexArrays(1, &_vao); GL::bindVAO(0); _vao = 0; @@ -160,7 +161,8 @@ bool DrawNode::init() ensureCapacity(512); - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { glGenVertexArrays(1, &_vao); GL::bindVAO(_vao); } @@ -180,7 +182,8 @@ bool DrawNode::init() glBindBuffer(GL_ARRAY_BUFFER, 0); - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { GL::bindVAO(0); } @@ -207,10 +210,12 @@ void DrawNode::render() glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacity, _buffer, GL_STREAM_DRAW); _dirty = false; } - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { GL::bindVAO(_vao); } - else { + else + { GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX); glBindBuffer(GL_ARRAY_BUFFER, _vbo); diff --git a/cocos/2d/CCParticleSystemQuad.cpp b/cocos/2d/CCParticleSystemQuad.cpp index 9564ca3fbb..36d2567809 100644 --- a/cocos/2d/CCParticleSystemQuad.cpp +++ b/cocos/2d/CCParticleSystemQuad.cpp @@ -58,10 +58,12 @@ bool ParticleSystemQuad::initWithTotalParticles(unsigned int numberOfParticles) } initIndices(); - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { setupVBOandVAO(); } - else { + else + { setupVBO(); } @@ -95,7 +97,8 @@ ParticleSystemQuad::~ParticleSystemQuad() CC_SAFE_FREE(_quads); CC_SAFE_FREE(_indices); glDeleteBuffers(2, &_buffersVBO[0]); - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { glDeleteVertexArrays(1, &_VAOname); GL::bindVAO(0); } @@ -355,7 +358,8 @@ void ParticleSystemQuad::draw() CCASSERT( _particleIdx == _particleCount, "Abnormal error in particle quad"); - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { // // Using VBO and VAO // @@ -371,7 +375,8 @@ void ParticleSystemQuad::draw() glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); #endif } - else { + else + { // // Using VBO without VAO // @@ -453,10 +458,12 @@ void ParticleSystemQuad::setTotalParticles(int tp) } initIndices(); - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { setupVBOandVAO(); } - else { + else + { setupVBO(); } } @@ -527,10 +534,12 @@ void ParticleSystemQuad::setupVBO() void ParticleSystemQuad::listenBackToForeground(Object *obj) { - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { setupVBOandVAO(); } - else { + else + { setupVBO(); } } @@ -575,10 +584,12 @@ void ParticleSystemQuad::setBatchNode(ParticleBatchNode * batchNode) allocMemory(); initIndices(); setTexture(oldBatch->getTexture()); - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { setupVBOandVAO(); } - else { + else + { setupVBO(); } } @@ -595,7 +606,8 @@ void ParticleSystemQuad::setBatchNode(ParticleBatchNode * batchNode) glDeleteBuffers(2, &_buffersVBO[0]); memset(_buffersVBO, 0, sizeof(_buffersVBO)); - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { glDeleteVertexArrays(1, &_VAOname); GL::bindVAO(0); _VAOname = 0; diff --git a/cocos/2d/CCTextureAtlas.cpp b/cocos/2d/CCTextureAtlas.cpp index cc29126f85..ec42b9dbfd 100644 --- a/cocos/2d/CCTextureAtlas.cpp +++ b/cocos/2d/CCTextureAtlas.cpp @@ -62,7 +62,8 @@ TextureAtlas::~TextureAtlas() glDeleteBuffers(2, _buffersVBO); - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { glDeleteVertexArrays(1, &_VAOname); GL::bindVAO(0); } @@ -192,10 +193,12 @@ bool TextureAtlas::initWithTexture(Texture2D *texture, long capacity) this->setupIndices(); - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { setupVBOandVAO(); } - else { + else + { setupVBO(); } @@ -206,10 +209,12 @@ bool TextureAtlas::initWithTexture(Texture2D *texture, long capacity) void TextureAtlas::listenBackToForeground(Object *obj) { - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { setupVBOandVAO(); } - else { + else + { setupVBO(); } @@ -605,7 +610,8 @@ void TextureAtlas::drawNumberOfQuads(long numberOfQuads, long start) GL::bindTexture2D(_texture->getName()); - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { // // Using VBO and VAO // @@ -649,7 +655,8 @@ void TextureAtlas::drawNumberOfQuads(long numberOfQuads, long start) // glBindVertexArray(0); } - else { + else + { // // Using VBO without VAO // diff --git a/cocos/2d/ccGLStateCache.cpp b/cocos/2d/ccGLStateCache.cpp index 71a880c984..c4de9784b8 100644 --- a/cocos/2d/ccGLStateCache.cpp +++ b/cocos/2d/ccGLStateCache.cpp @@ -184,7 +184,8 @@ void deleteTextureN(GLuint textureUnit, GLuint textureId) void bindVAO(GLuint vaoId) { - if (Configuration::getInstance()->supportsShareableVAO()) { + if (Configuration::getInstance()->supportsShareableVAO()) + { #if CC_ENABLE_GL_STATE_CACHE if (s_uVAO != vaoId)