From c4ecff9804dacf8983a026a0edcadb9c80f0ab5a Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Wed, 27 Aug 2014 14:54:35 +0800 Subject: [PATCH 01/30] temp backup --- cocos/renderer/CCRenderer.cpp | 63 +++++++++++++++++------------------ cocos/renderer/CCRenderer.h | 13 +++++--- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/cocos/renderer/CCRenderer.cpp b/cocos/renderer/CCRenderer.cpp index 2eca2d9ead..cbf09e6ca4 100644 --- a/cocos/renderer/CCRenderer.cpp +++ b/cocos/renderer/CCRenderer.cpp @@ -110,7 +110,8 @@ static const int DEFAULT_RENDER_QUEUE = 0; Renderer::Renderer() :_lastMaterialID(0) ,_lastBatchedMeshCommand(nullptr) -,_numQuads(0) +,_filledVertex(0) +,_filledIndex(0) ,_glViewAssigned(false) ,_isRendering(false) #if CC_ENABLE_CACHE_TEXTURE_DATA @@ -163,7 +164,7 @@ void Renderer::initGLView() void Renderer::setupIndices() { - for( int i=0; i < VBO_SIZE; i++) + for( int i=0; i < INDEX_VBO_SIZE / 6; i++) { _indices[i*6+0] = (GLushort) (i*4+0); _indices[i*6+1] = (GLushort) (i*4+1); @@ -194,7 +195,7 @@ void Renderer::setupVBOAndVAO() glGenBuffers(2, &_buffersVBO[0]); glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]); - glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * VBO_SIZE, _quads, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, sizeof(_verts[0]) * VBO_SIZE, _verts, GL_DYNAMIC_DRAW); // vertices glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION); @@ -209,7 +210,7 @@ void Renderer::setupVBOAndVAO() glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V3F_C4B_T2F), (GLvoid*) offsetof( V3F_C4B_T2F, texCoords)); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _buffersVBO[1]); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(_indices[0]) * VBO_SIZE * 6, _indices, GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(_indices[0]) * INDEX_VBO_SIZE, _indices, GL_STATIC_DRAW); // Must unbind the VAO before changing the element buffer. GL::bindVAO(0); @@ -232,11 +233,11 @@ void Renderer::mapBuffers() GL::bindVAO(0); glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]); - glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * VBO_SIZE, _quads, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, sizeof(_verts[0]) * VBO_SIZE, _verts, GL_DYNAMIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _buffersVBO[1]); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(_indices[0]) * VBO_SIZE * 6, _indices, GL_STATIC_DRAW); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(_indices[0]) * INDEX_VBO_SIZE, _indices, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); CHECK_GL_ERROR_DEBUG(); @@ -288,7 +289,7 @@ void Renderer::visitRenderQueue(const RenderQueue& queue) flush3D(); auto cmd = static_cast(command); //Batch quads - if(_numQuads + cmd->getQuadCount() > VBO_SIZE) + if( _filledVertex + cmd->getQuadCount() * 4 > VBO_SIZE || _filledIndex + cmd->getQuadCount() * 6 > INDEX_VBO_SIZE) { CCASSERT(cmd->getQuadCount()>= 0 && cmd->getQuadCount() < VBO_SIZE, "VBO is not big enough for quad data, please break the quad data down or use customized render command"); @@ -298,10 +299,11 @@ void Renderer::visitRenderQueue(const RenderQueue& queue) _batchedQuadCommands.push_back(cmd); - memcpy(_quads + _numQuads, cmd->getQuads(), sizeof(V3F_C4B_T2F_Quad) * cmd->getQuadCount()); - convertToWorldCoordinates(_quads + _numQuads, cmd->getQuadCount(), cmd->getModelView()); + memcpy(_verts + _filledVertex, cmd->getQuads(), sizeof(V3F_C4B_T2F) * cmd->getQuadCount() * 4); + fillQuadVertices(_verts + _filledVertex, cmd->getQuadCount() * 4, cmd->getModelView()); - _numQuads += cmd->getQuadCount(); + _filledVertex += cmd->getQuadCount() * 4; + _filledIndex += cmd->getQuadCount() * 6; } else if(RenderCommand::Type::GROUP_COMMAND == commandType) @@ -392,31 +394,22 @@ void Renderer::clean() // Clear batch quad commands _batchedQuadCommands.clear(); - _numQuads = 0; - + _filledVertex = 0; + _filledIndex = 0; _lastMaterialID = 0; _lastBatchedMeshCommand = nullptr; } -void Renderer::convertToWorldCoordinates(V3F_C4B_T2F_Quad* quads, ssize_t quantity, const Mat4& modelView) +void Renderer::fillQuadVertices(V3F_C4B_T2F* verts, ssize_t quantity, const Mat4& modelView) { // kmMat4 matrixP, mvp; // kmGLGetMatrix(KM_GL_PROJECTION, &matrixP); // kmMat4Multiply(&mvp, &matrixP, &modelView); for(ssize_t i=0; ibl.vertices; + V3F_C4B_T2F *q = &verts[i]; + Vec3 *vec1 = (Vec3*)&q->vertices; modelView.transformPoint(vec1); - - Vec3 *vec2 = (Vec3*)&q->br.vertices; - modelView.transformPoint(vec2); - - Vec3 *vec3 = (Vec3*)&q->tr.vertices; - modelView.transformPoint(vec3); - - Vec3 *vec4 = (Vec3*)&q->tl.vertices; - modelView.transformPoint(vec4); } } @@ -428,13 +421,15 @@ void Renderer::drawBatchedQuads() int startQuad = 0; //Upload buffer to VBO - if(_numQuads <= 0 || _batchedQuadCommands.empty()) + if(_filledVertex <= 0 || _filledIndex <= 0 || _batchedQuadCommands.empty()) { return; } if (Configuration::getInstance()->supportsShareableVAO()) { + //Bind VAO + GL::bindVAO(_quadVAO); //Set VBO data glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]); @@ -445,22 +440,22 @@ void Renderer::drawBatchedQuads() // glBufferData(GL_ARRAY_BUFFER, sizeof(quads_[0]) * (n-start), &quads_[start], GL_DYNAMIC_DRAW); // option 3: orphaning + glMapBuffer - glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * (_numQuads), nullptr, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, sizeof(_verts[0]) * _filledVertex, nullptr, GL_DYNAMIC_DRAW); void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); - memcpy(buf, _quads, sizeof(_quads[0])* (_numQuads)); + memcpy(buf, _verts, sizeof(_verts[0])* _filledVertex); glUnmapBuffer(GL_ARRAY_BUFFER); glBindBuffer(GL_ARRAY_BUFFER, 0); - - //Bind VAO - GL::bindVAO(_quadVAO); + + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _buffersVBO[1]); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(_indices[0]) * _filledIndex, _indices, GL_STATIC_DRAW); } else { -#define kQuadSize sizeof(_quads[0].bl) +#define kQuadSize sizeof(_verts[0]) glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]); - glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * _numQuads , _quads, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, sizeof(_verts[0]) * _filledVertex , _verts, GL_DYNAMIC_DRAW); GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX); @@ -474,6 +469,7 @@ void Renderer::drawBatchedQuads() glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, kQuadSize, (GLvoid*) offsetof(V3F_C4B_T2F, texCoords)); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _buffersVBO[1]); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(_indices[0]) * _filledIndex, _indices, GL_STATIC_DRAW); } //Start drawing verties in batch @@ -521,7 +517,8 @@ void Renderer::drawBatchedQuads() } _batchedQuadCommands.clear(); - _numQuads = 0; + _filledVertex = 0; + _filledIndex = 0; } void Renderer::flush() diff --git a/cocos/renderer/CCRenderer.h b/cocos/renderer/CCRenderer.h index 0c56b989e0..00fc2cec8c 100644 --- a/cocos/renderer/CCRenderer.h +++ b/cocos/renderer/CCRenderer.h @@ -75,7 +75,9 @@ Whenever possible prefer to use `QuadCommand` objects since the renderer will au class CC_DLL Renderer { public: - static const int VBO_SIZE = 65536 / 6; + static const int VBO_SIZE = 65536; + static const int INDEX_VBO_SIZE = 65536 * 6 / 4; + static const int BATCH_QUADCOMMAND_RESEVER_SIZE = 64; Renderer(); @@ -139,7 +141,7 @@ protected: void visitRenderQueue(const RenderQueue& queue); - void convertToWorldCoordinates(V3F_C4B_T2F_Quad* quads, ssize_t quantity, const Mat4& modelView); + void fillQuadVertices(V3F_C4B_T2F* verts, ssize_t quantity, const Mat4& modelView); std::stack _commandGroupStack; @@ -150,12 +152,13 @@ protected: MeshCommand* _lastBatchedMeshCommand; std::vector _batchedQuadCommands; - V3F_C4B_T2F_Quad _quads[VBO_SIZE]; - GLushort _indices[6 * VBO_SIZE]; + V3F_C4B_T2F _verts[VBO_SIZE]; + GLushort _indices[INDEX_VBO_SIZE]; GLuint _quadVAO; GLuint _buffersVBO[2]; //0: vertex 1: indices - int _numQuads; + int _filledVertex; + int _filledIndex; bool _glViewAssigned; From 91e332c253f1e164b800e27419bc103f926d4ebf Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Wed, 27 Aug 2014 16:43:14 +0800 Subject: [PATCH 02/30] dynamic update index for quad command --- cocos/renderer/CCRenderer.cpp | 71 +++++++++++++++++------------------ cocos/renderer/CCRenderer.h | 3 +- 2 files changed, 35 insertions(+), 39 deletions(-) diff --git a/cocos/renderer/CCRenderer.cpp b/cocos/renderer/CCRenderer.cpp index cbf09e6ca4..a7509a1c1f 100644 --- a/cocos/renderer/CCRenderer.cpp +++ b/cocos/renderer/CCRenderer.cpp @@ -154,27 +154,12 @@ void Renderer::initGLView() Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_cacheTextureListener, -1); #endif - - setupIndices(); setupBuffer(); _glViewAssigned = true; } -void Renderer::setupIndices() -{ - for( int i=0; i < INDEX_VBO_SIZE / 6; i++) - { - _indices[i*6+0] = (GLushort) (i*4+0); - _indices[i*6+1] = (GLushort) (i*4+1); - _indices[i*6+2] = (GLushort) (i*4+2); - _indices[i*6+3] = (GLushort) (i*4+3); - _indices[i*6+4] = (GLushort) (i*4+2); - _indices[i*6+5] = (GLushort) (i*4+1); - } -} - void Renderer::setupBuffer() { if(Configuration::getInstance()->supportsShareableVAO()) @@ -299,11 +284,7 @@ void Renderer::visitRenderQueue(const RenderQueue& queue) _batchedQuadCommands.push_back(cmd); - memcpy(_verts + _filledVertex, cmd->getQuads(), sizeof(V3F_C4B_T2F) * cmd->getQuadCount() * 4); - fillQuadVertices(_verts + _filledVertex, cmd->getQuadCount() * 4, cmd->getModelView()); - - _filledVertex += cmd->getQuadCount() * 4; - _filledIndex += cmd->getQuadCount() * 6; + fillQuadVertices(cmd); } else if(RenderCommand::Type::GROUP_COMMAND == commandType) @@ -400,25 +381,41 @@ void Renderer::clean() _lastBatchedMeshCommand = nullptr; } -void Renderer::fillQuadVertices(V3F_C4B_T2F* verts, ssize_t quantity, const Mat4& modelView) +void Renderer::fillQuadVertices(const QuadCommand* cmd) { -// kmMat4 matrixP, mvp; -// kmGLGetMatrix(KM_GL_PROJECTION, &matrixP); -// kmMat4Multiply(&mvp, &matrixP, &modelView); - for(ssize_t i=0; igetQuads(), sizeof(V3F_C4B_T2F) * cmd->getQuadCount() * 4); + const Mat4& modelView = cmd->getModelView(); + + for(ssize_t i=0; i< cmd->getQuadCount() * 4; ++i) { - V3F_C4B_T2F *q = &verts[i]; + V3F_C4B_T2F *q = &_verts[i + _filledVertex]; Vec3 *vec1 = (Vec3*)&q->vertices; modelView.transformPoint(vec1); } + + //fill index + for(ssize_t i=0; i< cmd->getQuadCount(); ++i) + { + _indices[_filledIndex + i * 6 + 0] = _filledVertex + i * 4 + 0; + _indices[_filledIndex + i * 6 + 1] = _filledVertex + i * 4 + 1; + _indices[_filledIndex + i * 6 + 2] = _filledVertex + i * 4 + 2; + _indices[_filledIndex + i * 6 + 3] = _filledVertex + i * 4 + 3; + _indices[_filledIndex + i * 6 + 4] = _filledVertex + i * 4 + 2; + _indices[_filledIndex + i * 6 + 5] = _filledVertex + i * 4 + 1; + } + + _filledVertex += cmd->getQuadCount() * 4; + _filledIndex += cmd->getQuadCount() * 6; } void Renderer::drawBatchedQuads() { //TODO we can improve the draw performance by insert material switching command before hand. - int quadsToDraw = 0; - int startQuad = 0; +// int quadsToDraw = 0; +// int startQuad = 0; + int indexToDraw = 0; + int startIndex = 0; //Upload buffer to VBO if(_filledVertex <= 0 || _filledIndex <= 0 || _batchedQuadCommands.empty()) @@ -479,14 +476,14 @@ void Renderer::drawBatchedQuads() if(_lastMaterialID != newMaterialID || newMaterialID == QuadCommand::MATERIAL_ID_DO_NOT_BATCH) { //Draw quads - if(quadsToDraw > 0) + if(indexToDraw > 0) { - glDrawElements(GL_TRIANGLES, (GLsizei) quadsToDraw*6, GL_UNSIGNED_SHORT, (GLvoid*) (startQuad*6*sizeof(_indices[0])) ); + glDrawElements(GL_TRIANGLES, (GLsizei) indexToDraw, GL_UNSIGNED_SHORT, (GLvoid*) (startIndex*sizeof(_indices[0])) ); _drawnBatches++; - _drawnVertices += quadsToDraw*6; + _drawnVertices += indexToDraw; - startQuad += quadsToDraw; - quadsToDraw = 0; + startIndex += indexToDraw; + indexToDraw = 0; } //Use new material @@ -494,15 +491,15 @@ void Renderer::drawBatchedQuads() _lastMaterialID = newMaterialID; } - quadsToDraw += cmd->getQuadCount(); + indexToDraw += cmd->getQuadCount() * 6; } //Draw any remaining quad - if(quadsToDraw > 0) + if(indexToDraw > 0) { - glDrawElements(GL_TRIANGLES, (GLsizei) quadsToDraw*6, GL_UNSIGNED_SHORT, (GLvoid*) (startQuad*6*sizeof(_indices[0])) ); + glDrawElements(GL_TRIANGLES, (GLsizei) indexToDraw, GL_UNSIGNED_SHORT, (GLvoid*) (startIndex*sizeof(_indices[0])) ); _drawnBatches++; - _drawnVertices += quadsToDraw*6; + _drawnVertices += indexToDraw; } if (Configuration::getInstance()->supportsShareableVAO()) diff --git a/cocos/renderer/CCRenderer.h b/cocos/renderer/CCRenderer.h index 00fc2cec8c..85db7cc108 100644 --- a/cocos/renderer/CCRenderer.h +++ b/cocos/renderer/CCRenderer.h @@ -123,7 +123,6 @@ public: protected: - void setupIndices(); //Setup VBO or VAO based on OpenGL extensions void setupBuffer(); void setupVBOAndVAO(); @@ -141,7 +140,7 @@ protected: void visitRenderQueue(const RenderQueue& queue); - void fillQuadVertices(V3F_C4B_T2F* verts, ssize_t quantity, const Mat4& modelView); + void fillQuadVertices(const QuadCommand* cmd); std::stack _commandGroupStack; From c627affa5ea02a56b0b843dcb1924c868091baee Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Wed, 27 Aug 2014 18:39:49 +0800 Subject: [PATCH 03/30] add triangles command, make quad command inherit from triangles command --- cocos/renderer/CCQuadCommand.cpp | 117 +++++++++++++++++++++++-------- cocos/renderer/CCQuadCommand.h | 65 ++++++++++++----- cocos/renderer/CCRenderCommand.h | 1 + cocos/renderer/CCRenderer.cpp | 26 +++---- 4 files changed, 147 insertions(+), 62 deletions(-) diff --git a/cocos/renderer/CCQuadCommand.cpp b/cocos/renderer/CCQuadCommand.cpp index d5cff627f6..1b12e06f0b 100644 --- a/cocos/renderer/CCQuadCommand.cpp +++ b/cocos/renderer/CCQuadCommand.cpp @@ -29,15 +29,78 @@ #include "renderer/CCGLProgram.h" #include "renderer/CCGLProgramState.h" #include "xxhash.h" +#include "renderer/CCRenderer.h" NS_CC_BEGIN - -QuadCommand::QuadCommand() +TrianglesCommand::TrianglesCommand() :_materialID(0) ,_textureID(0) ,_glProgramState(nullptr) ,_blendType(BlendFunc::DISABLE) +{ + _type = RenderCommand::Type::TRIANGLES_COMMAND; +} + +void TrianglesCommand::init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, const Triangles& triangles,const Mat4& mv) +{ + CCASSERT(glProgramState, "Invalid GLProgramState"); + CCASSERT(glProgramState->getVertexAttribsFlags() == 0, "No custom attributes are supported in QuadCommand"); + + _globalOrder = globalOrder; + + _triangles = triangles; + if(_triangles.indexCount % 3 != 0) + { + ssize_t count = _triangles.indexCount; + _triangles.indexCount = count / 3 * 3; + CCLOGERROR("Resize indexCount from %zd to %zd, size must be multiple times of 3", count, _triangles.indexCount); + } + _mv = mv; + + if( _textureID != textureID || _blendType.src != blendType.src || _blendType.dst != blendType.dst || _glProgramState != glProgramState) { + + _textureID = textureID; + _blendType = blendType; + _glProgramState = glProgramState; + + generateMaterialID(); + } +} + +TrianglesCommand::~TrianglesCommand() +{ +} + +void TrianglesCommand::generateMaterialID() +{ + + if(_glProgramState->getUniformCount() > 0) + { + _materialID = TrianglesCommand::MATERIAL_ID_DO_NOT_BATCH; + } + else + { + int glProgram = (int)_glProgramState->getGLProgram()->getProgram(); + int intArray[4] = { glProgram, (int)_textureID, (int)_blendType.src, (int)_blendType.dst}; + + _materialID = XXH32((const void*)intArray, sizeof(intArray), 0); + } +} + +void TrianglesCommand::useMaterial() const +{ + //Set texture + GL::bindTexture2D(_textureID); + + //set blend mode + GL::blendFunc(_blendType.src, _blendType.dst); + + _glProgramState->apply(_mv); +} + +QuadCommand::QuadCommand() +:TrianglesCommand() ,_quads(nullptr) ,_quadsCount(0) { @@ -53,6 +116,29 @@ void QuadCommand::init(float globalOrder, GLuint textureID, GLProgramState* glPr _quadsCount = quadCount; _quads = quad; + + //generate triangles + { + static std::vector QUADINDICESMAX; + if(QUADINDICESMAX.size() == 0) + { + QUADINDICESMAX.resize(Renderer::INDEX_VBO_SIZE); + for(ssize_t i = 0; i < Renderer::INDEX_VBO_SIZE / 6; ++i) + { + QUADINDICESMAX[ 6 * i + 0] = 4 * i + 0; + QUADINDICESMAX[ 6 * i + 1] = 4 * i + 1; + QUADINDICESMAX[ 6 * i + 2] = 4 * i + 2; + QUADINDICESMAX[ 6 * i + 3] = 4 * i + 3; + QUADINDICESMAX[ 6 * i + 4] = 4 * i + 2; + QUADINDICESMAX[ 6 * i + 5] = 4 * i + 1; + } + } + + _triangles.vertCount = quadCount * 4; + _triangles.indexCount = quadCount * 6; + _triangles.indices = &QUADINDICESMAX[0]; + _triangles.verts = &quad->tl; + } _mv = mv; @@ -70,31 +156,4 @@ QuadCommand::~QuadCommand() { } -void QuadCommand::generateMaterialID() -{ - - if(_glProgramState->getUniformCount() > 0) - { - _materialID = QuadCommand::MATERIAL_ID_DO_NOT_BATCH; - } - else - { - int glProgram = (int)_glProgramState->getGLProgram()->getProgram(); - int intArray[4] = { glProgram, (int)_textureID, (int)_blendType.src, (int)_blendType.dst}; - - _materialID = XXH32((const void*)intArray, sizeof(intArray), 0); - } -} - -void QuadCommand::useMaterial() const -{ - //Set texture - GL::bindTexture2D(_textureID); - - //set blend mode - GL::blendFunc(_blendType.src, _blendType.dst); - - _glProgramState->apply(_mv); -} - NS_CC_END diff --git a/cocos/renderer/CCQuadCommand.h b/cocos/renderer/CCQuadCommand.h index 5c731b784b..549df94c8c 100644 --- a/cocos/renderer/CCQuadCommand.h +++ b/cocos/renderer/CCQuadCommand.h @@ -30,13 +30,56 @@ #include "renderer/CCRenderCommandPool.h" NS_CC_BEGIN - -/** Command used to render one or more Quads */ -class CC_DLL QuadCommand : public RenderCommand +class CC_DLL TrianglesCommand : public RenderCommand { public: static const int MATERIAL_ID_DO_NOT_BATCH = 0; +public: + struct Triangles + { + V3F_C4B_T2F* verts; + unsigned short* indices; + ssize_t vertCount; + ssize_t indexCount; + }; + + TrianglesCommand(); + ~TrianglesCommand(); + + /** Initializes the command with a globalZOrder, a texture ID, a `GLProgram`, a blending function, a pointer to triangles, + * quantity of quads, and the Model View transform to be used for the quads */ + void init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, const Triangles& triangles,const Mat4& mv); + + void useMaterial() const; + + inline uint32_t getMaterialID() const { return _materialID; } + inline GLuint getTextureID() const { return _textureID; } + inline const Triangles& getTriangles() const { return _triangles; } + inline ssize_t getVertexCount() const { return _triangles.vertCount; } + inline ssize_t getIndexCount() const { return _triangles.indexCount; } + inline const V3F_C4B_T2F* getVertices() const { return _triangles.verts; } + inline const unsigned short* getIndices() const { return _triangles.indices; } + inline GLProgramState* getGLProgramState() const { return _glProgramState; } + inline BlendFunc getBlendType() const { return _blendType; } + inline const Mat4& getModelView() const { return _mv; } + +protected: + void generateMaterialID(); + + uint32_t _materialID; + GLuint _textureID; + GLProgramState* _glProgramState; + BlendFunc _blendType; + Triangles _triangles; + Mat4 _mv; +}; + +/** Command used to render one or more Quads */ +class CC_DLL QuadCommand : public TrianglesCommand +{ +public: + QuadCommand(); ~QuadCommand(); @@ -45,26 +88,12 @@ public: void init(float globalOrder, GLuint texutreID, GLProgramState* shader, BlendFunc blendType, V3F_C4B_T2F_Quad* quads, ssize_t quadCount, const Mat4& mv); - void useMaterial() const; - - inline uint32_t getMaterialID() const { return _materialID; } - inline GLuint getTextureID() const { return _textureID; } - inline V3F_C4B_T2F_Quad* getQuads() const { return _quads; } + inline const V3F_C4B_T2F_Quad* getQuads() const { return _quads; } inline ssize_t getQuadCount() const { return _quadsCount; } - inline GLProgramState* getGLProgramState() const { return _glProgramState; } - inline BlendFunc getBlendType() const { return _blendType; } - inline const Mat4& getModelView() const { return _mv; } protected: - void generateMaterialID(); - - uint32_t _materialID; - GLuint _textureID; - GLProgramState* _glProgramState; - BlendFunc _blendType; V3F_C4B_T2F_Quad* _quads; ssize_t _quadsCount; - Mat4 _mv; }; NS_CC_END diff --git a/cocos/renderer/CCRenderCommand.h b/cocos/renderer/CCRenderCommand.h index 77332e01b0..882cc3518e 100644 --- a/cocos/renderer/CCRenderCommand.h +++ b/cocos/renderer/CCRenderCommand.h @@ -50,6 +50,7 @@ public: GROUP_COMMAND, MESH_COMMAND, PRIMITIVE_COMMAND, + TRIANGLES_COMMAND }; /** Get Render Command Id */ diff --git a/cocos/renderer/CCRenderer.cpp b/cocos/renderer/CCRenderer.cpp index a7509a1c1f..179013d11e 100644 --- a/cocos/renderer/CCRenderer.cpp +++ b/cocos/renderer/CCRenderer.cpp @@ -274,10 +274,10 @@ void Renderer::visitRenderQueue(const RenderQueue& queue) flush3D(); auto cmd = static_cast(command); //Batch quads - if( _filledVertex + cmd->getQuadCount() * 4 > VBO_SIZE || _filledIndex + cmd->getQuadCount() * 6 > INDEX_VBO_SIZE) + if( _filledVertex + cmd->getVertexCount() > VBO_SIZE || _filledIndex + cmd->getIndexCount() > INDEX_VBO_SIZE) { - CCASSERT(cmd->getQuadCount()>= 0 && cmd->getQuadCount() < VBO_SIZE, "VBO is not big enough for quad data, please break the quad data down or use customized render command"); - + CCASSERT(cmd->getVertexCount()>= 0 && cmd->getVertexCount() < VBO_SIZE, "VBO for vertex is not big enough, please break the data down or use customized render command"); + CCASSERT(cmd->getIndexCount()>= 0 && cmd->getIndexCount() < INDEX_VBO_SIZE, "VBO for index is not big enough, please break the data down or use customized render command"); //Draw batched quads if VBO is full drawBatchedQuads(); } @@ -383,29 +383,25 @@ void Renderer::clean() void Renderer::fillQuadVertices(const QuadCommand* cmd) { - memcpy(_verts + _filledVertex, cmd->getQuads(), sizeof(V3F_C4B_T2F) * cmd->getQuadCount() * 4); + memcpy(_verts + _filledVertex, cmd->getQuads(), sizeof(V3F_C4B_T2F) * cmd->getVertexCount()); const Mat4& modelView = cmd->getModelView(); - for(ssize_t i=0; i< cmd->getQuadCount() * 4; ++i) + for(ssize_t i=0; i< cmd->getVertexCount(); ++i) { V3F_C4B_T2F *q = &_verts[i + _filledVertex]; Vec3 *vec1 = (Vec3*)&q->vertices; modelView.transformPoint(vec1); } + const unsigned short* indices = cmd->getIndices(); //fill index - for(ssize_t i=0; i< cmd->getQuadCount(); ++i) + for(ssize_t i=0; i< cmd->getIndexCount(); ++i) { - _indices[_filledIndex + i * 6 + 0] = _filledVertex + i * 4 + 0; - _indices[_filledIndex + i * 6 + 1] = _filledVertex + i * 4 + 1; - _indices[_filledIndex + i * 6 + 2] = _filledVertex + i * 4 + 2; - _indices[_filledIndex + i * 6 + 3] = _filledVertex + i * 4 + 3; - _indices[_filledIndex + i * 6 + 4] = _filledVertex + i * 4 + 2; - _indices[_filledIndex + i * 6 + 5] = _filledVertex + i * 4 + 1; + _indices[_filledIndex + i] = _filledVertex + indices[i]; } - _filledVertex += cmd->getQuadCount() * 4; - _filledIndex += cmd->getQuadCount() * 6; + _filledVertex += cmd->getVertexCount(); + _filledIndex += cmd->getIndexCount(); } void Renderer::drawBatchedQuads() @@ -491,7 +487,7 @@ void Renderer::drawBatchedQuads() _lastMaterialID = newMaterialID; } - indexToDraw += cmd->getQuadCount() * 6; + indexToDraw += cmd->getIndexCount(); } //Draw any remaining quad From bdf92cfbd45c96c86092721cee14268272b2857a Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Thu, 28 Aug 2014 09:58:39 +0800 Subject: [PATCH 04/30] Renderer Only knows about Triangles Command, every command inherit from Triangles Command can be batched --- cocos/renderer/CCRenderer.cpp | 24 ++++++++++++------------ cocos/renderer/CCRenderer.h | 9 +++++---- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/cocos/renderer/CCRenderer.cpp b/cocos/renderer/CCRenderer.cpp index 179013d11e..efecfd8b1c 100644 --- a/cocos/renderer/CCRenderer.cpp +++ b/cocos/renderer/CCRenderer.cpp @@ -124,7 +124,7 @@ Renderer::Renderer() RenderQueue defaultRenderQueue; _renderGroups.push_back(defaultRenderQueue); - _batchedQuadCommands.reserve(BATCH_QUADCOMMAND_RESEVER_SIZE); + _batchedCommands.reserve(BATCH_QUADCOMMAND_RESEVER_SIZE); } Renderer::~Renderer() @@ -269,10 +269,10 @@ void Renderer::visitRenderQueue(const RenderQueue& queue) { auto command = queue[index]; auto commandType = command->getType(); - if(RenderCommand::Type::QUAD_COMMAND == commandType) + if(RenderCommand::Type::QUAD_COMMAND == commandType || RenderCommand::Type::TRIANGLES_COMMAND == commandType) { flush3D(); - auto cmd = static_cast(command); + auto cmd = static_cast(command); //Batch quads if( _filledVertex + cmd->getVertexCount() > VBO_SIZE || _filledIndex + cmd->getIndexCount() > INDEX_VBO_SIZE) { @@ -282,9 +282,9 @@ void Renderer::visitRenderQueue(const RenderQueue& queue) drawBatchedQuads(); } - _batchedQuadCommands.push_back(cmd); + _batchedCommands.push_back(cmd); - fillQuadVertices(cmd); + fillVerticesAndIndices(cmd); } else if(RenderCommand::Type::GROUP_COMMAND == commandType) @@ -374,16 +374,16 @@ void Renderer::clean() } // Clear batch quad commands - _batchedQuadCommands.clear(); + _batchedCommands.clear(); _filledVertex = 0; _filledIndex = 0; _lastMaterialID = 0; _lastBatchedMeshCommand = nullptr; } -void Renderer::fillQuadVertices(const QuadCommand* cmd) +void Renderer::fillVerticesAndIndices(const TrianglesCommand* cmd) { - memcpy(_verts + _filledVertex, cmd->getQuads(), sizeof(V3F_C4B_T2F) * cmd->getVertexCount()); + memcpy(_verts + _filledVertex, cmd->getVertices(), sizeof(V3F_C4B_T2F) * cmd->getVertexCount()); const Mat4& modelView = cmd->getModelView(); for(ssize_t i=0; i< cmd->getVertexCount(); ++i) @@ -414,7 +414,7 @@ void Renderer::drawBatchedQuads() int startIndex = 0; //Upload buffer to VBO - if(_filledVertex <= 0 || _filledIndex <= 0 || _batchedQuadCommands.empty()) + if(_filledVertex <= 0 || _filledIndex <= 0 || _batchedCommands.empty()) { return; } @@ -466,10 +466,10 @@ void Renderer::drawBatchedQuads() } //Start drawing verties in batch - for(const auto& cmd : _batchedQuadCommands) + for(const auto& cmd : _batchedCommands) { auto newMaterialID = cmd->getMaterialID(); - if(_lastMaterialID != newMaterialID || newMaterialID == QuadCommand::MATERIAL_ID_DO_NOT_BATCH) + if(_lastMaterialID != newMaterialID || newMaterialID == TrianglesCommand::MATERIAL_ID_DO_NOT_BATCH) { //Draw quads if(indexToDraw > 0) @@ -509,7 +509,7 @@ void Renderer::drawBatchedQuads() glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } - _batchedQuadCommands.clear(); + _batchedCommands.clear(); _filledVertex = 0; _filledIndex = 0; } diff --git a/cocos/renderer/CCRenderer.h b/cocos/renderer/CCRenderer.h index 85db7cc108..082f24c82d 100644 --- a/cocos/renderer/CCRenderer.h +++ b/cocos/renderer/CCRenderer.h @@ -38,6 +38,7 @@ NS_CC_BEGIN class EventListenerCustom; class QuadCommand; +class TrianglesCommand; class MeshCommand; /** Class that knows how to sort `RenderCommand` objects. @@ -75,8 +76,8 @@ Whenever possible prefer to use `QuadCommand` objects since the renderer will au class CC_DLL Renderer { public: - static const int VBO_SIZE = 65536; - static const int INDEX_VBO_SIZE = 65536 * 6 / 4; + static const int VBO_SIZE = 8192; + static const int INDEX_VBO_SIZE = 8192 * 6 / 4; static const int BATCH_QUADCOMMAND_RESEVER_SIZE = 64; @@ -140,7 +141,7 @@ protected: void visitRenderQueue(const RenderQueue& queue); - void fillQuadVertices(const QuadCommand* cmd); + void fillVerticesAndIndices(const TrianglesCommand* cmd); std::stack _commandGroupStack; @@ -149,7 +150,7 @@ protected: uint32_t _lastMaterialID; MeshCommand* _lastBatchedMeshCommand; - std::vector _batchedQuadCommands; + std::vector _batchedCommands; V3F_C4B_T2F _verts[VBO_SIZE]; GLushort _indices[INDEX_VBO_SIZE]; From 06eb6c2425fce58bec4094e3b123ba44c94d5faa Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Mon, 1 Sep 2014 11:49:04 +0800 Subject: [PATCH 05/30] put TrianglesCommand in a seperate file --- build/cocos2d_libs.xcodeproj/project.pbxproj | 12 +++ cocos/renderer/CCQuadCommand.cpp | 66 ------------ cocos/renderer/CCQuadCommand.h | 45 +-------- cocos/renderer/CCRenderer.cpp | 1 + cocos/renderer/CCTrianglesCommand.cpp | 100 +++++++++++++++++++ cocos/renderer/CCTrianglesCommand.h | 79 +++++++++++++++ 6 files changed, 193 insertions(+), 110 deletions(-) create mode 100644 cocos/renderer/CCTrianglesCommand.cpp create mode 100644 cocos/renderer/CCTrianglesCommand.h diff --git a/build/cocos2d_libs.xcodeproj/project.pbxproj b/build/cocos2d_libs.xcodeproj/project.pbxproj index 1dce556650..4168e8e076 100644 --- a/build/cocos2d_libs.xcodeproj/project.pbxproj +++ b/build/cocos2d_libs.xcodeproj/project.pbxproj @@ -1809,6 +1809,10 @@ B21770471977ED34009EE11B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B21770461977ED34009EE11B /* QuartzCore.framework */; }; B21770491977ED4C009EE11B /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B21770481977ED4C009EE11B /* libz.dylib */; }; B217704E1977ED9F009EE11B /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B217704C1977ED8B009EE11B /* libsqlite3.dylib */; }; + B230ED7119B417AE00364AA8 /* CCTrianglesCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B230ED6F19B417AE00364AA8 /* CCTrianglesCommand.cpp */; }; + B230ED7219B417AE00364AA8 /* CCTrianglesCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B230ED6F19B417AE00364AA8 /* CCTrianglesCommand.cpp */; }; + B230ED7319B417AE00364AA8 /* CCTrianglesCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B230ED7019B417AE00364AA8 /* CCTrianglesCommand.h */; }; + B230ED7419B417AE00364AA8 /* CCTrianglesCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B230ED7019B417AE00364AA8 /* CCTrianglesCommand.h */; }; B24AA985195A675C007B4522 /* CCFastTMXLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B24AA981195A675C007B4522 /* CCFastTMXLayer.cpp */; }; B24AA986195A675C007B4522 /* CCFastTMXLayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B24AA981195A675C007B4522 /* CCFastTMXLayer.cpp */; }; B24AA987195A675C007B4522 /* CCFastTMXLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = B24AA982195A675C007B4522 /* CCFastTMXLayer.h */; }; @@ -2843,6 +2847,8 @@ B21770481977ED4C009EE11B /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; B217704A1977ED55009EE11B /* libcurl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcurl.dylib; path = usr/lib/libcurl.dylib; sourceTree = SDKROOT; }; B217704C1977ED8B009EE11B /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; }; + B230ED6F19B417AE00364AA8 /* CCTrianglesCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTrianglesCommand.cpp; sourceTree = ""; }; + B230ED7019B417AE00364AA8 /* CCTrianglesCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTrianglesCommand.h; sourceTree = ""; }; B24AA981195A675C007B4522 /* CCFastTMXLayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCFastTMXLayer.cpp; sourceTree = ""; }; B24AA982195A675C007B4522 /* CCFastTMXLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCFastTMXLayer.h; sourceTree = ""; }; B24AA983195A675C007B4522 /* CCFastTMXTiledMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCFastTMXTiledMap.cpp; sourceTree = ""; }; @@ -4599,6 +4605,8 @@ 50ABBD731925AB4100A911A9 /* CCGroupCommand.h */, B29594B21926D5EC003EEF37 /* CCMeshCommand.cpp */, B29594B31926D5EC003EEF37 /* CCMeshCommand.h */, + B230ED6F19B417AE00364AA8 /* CCTrianglesCommand.cpp */, + B230ED7019B417AE00364AA8 /* CCTrianglesCommand.h */, 50ABBD741925AB4100A911A9 /* CCQuadCommand.cpp */, 50ABBD751925AB4100A911A9 /* CCQuadCommand.h */, 50ABBD761925AB4100A911A9 /* CCRenderCommand.cpp */, @@ -4993,6 +5001,7 @@ 15AE1BE519AAE01E00C27E9E /* CCTableView.h in Headers */, 15AE1BD319AAE01E00C27E9E /* CCControlPotentiometer.h in Headers */, 15AE1B6E19AADA9900C27E9E /* UIHelper.h in Headers */, + B230ED7319B417AE00364AA8 /* CCTrianglesCommand.h in Headers */, 15AE187F19AAD33D00C27E9E /* CCBKeyframe.h in Headers */, 1A570073180BC5A10088DEC7 /* CCActionGrid.h in Headers */, 15AE1BCC19AAE01E00C27E9E /* CCControlButton.h in Headers */, @@ -5566,6 +5575,7 @@ 15AE181D19AAD2F700C27E9E /* CCBundle3D.h in Headers */, 15AE192519AAD35100C27E9E /* CocoLoader.h in Headers */, 15AE1BBB19AADFF000C27E9E /* HttpRequest.h in Headers */, + B230ED7419B417AE00364AA8 /* CCTrianglesCommand.h in Headers */, 15AE1A0019AAD3A700C27E9E /* AtlasAttachmentLoader.h in Headers */, 15AE1ACB19AAD40300C27E9E /* b2MouseJoint.h in Headers */, 50ABBD3F1925AB0000A911A9 /* CCGeometry.h in Headers */, @@ -6246,6 +6256,7 @@ 15AE1A7819AAD40300C27E9E /* b2PolygonAndCircleContact.cpp in Sources */, 15AE1A3419AAD3D500C27E9E /* b2EdgeShape.cpp in Sources */, 15AE1BA319AADFDF00C27E9E /* UILayoutManager.cpp in Sources */, + B230ED7119B417AE00364AA8 /* CCTrianglesCommand.cpp in Sources */, 1A5702F2180BCE750088DEC7 /* CCTMXObjectGroup.cpp in Sources */, 15AE1A5B19AAD40300C27E9E /* b2Timer.cpp in Sources */, 15AE1B1219AAD43700C27E9E /* cpGearJoint.c in Sources */, @@ -6438,6 +6449,7 @@ 50ABC0161926664800A911A9 /* CCImage.cpp in Sources */, 1A01C6A518F58F7500EFE3A6 /* CCNotificationCenter.cpp in Sources */, 15AE1BFB19AAE01E00C27E9E /* CCControlUtils.cpp in Sources */, + B230ED7219B417AE00364AA8 /* CCTrianglesCommand.cpp in Sources */, 15AE1B9019AADA9A00C27E9E /* UIWidget.cpp in Sources */, ED9C6A9518599AD8000A5232 /* CCNodeGrid.cpp in Sources */, 1A01C68F18F57BE800EFE3A6 /* CCDictionary.cpp in Sources */, diff --git a/cocos/renderer/CCQuadCommand.cpp b/cocos/renderer/CCQuadCommand.cpp index 1b12e06f0b..6fd255bf1b 100644 --- a/cocos/renderer/CCQuadCommand.cpp +++ b/cocos/renderer/CCQuadCommand.cpp @@ -33,72 +33,6 @@ NS_CC_BEGIN -TrianglesCommand::TrianglesCommand() -:_materialID(0) -,_textureID(0) -,_glProgramState(nullptr) -,_blendType(BlendFunc::DISABLE) -{ - _type = RenderCommand::Type::TRIANGLES_COMMAND; -} - -void TrianglesCommand::init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, const Triangles& triangles,const Mat4& mv) -{ - CCASSERT(glProgramState, "Invalid GLProgramState"); - CCASSERT(glProgramState->getVertexAttribsFlags() == 0, "No custom attributes are supported in QuadCommand"); - - _globalOrder = globalOrder; - - _triangles = triangles; - if(_triangles.indexCount % 3 != 0) - { - ssize_t count = _triangles.indexCount; - _triangles.indexCount = count / 3 * 3; - CCLOGERROR("Resize indexCount from %zd to %zd, size must be multiple times of 3", count, _triangles.indexCount); - } - _mv = mv; - - if( _textureID != textureID || _blendType.src != blendType.src || _blendType.dst != blendType.dst || _glProgramState != glProgramState) { - - _textureID = textureID; - _blendType = blendType; - _glProgramState = glProgramState; - - generateMaterialID(); - } -} - -TrianglesCommand::~TrianglesCommand() -{ -} - -void TrianglesCommand::generateMaterialID() -{ - - if(_glProgramState->getUniformCount() > 0) - { - _materialID = TrianglesCommand::MATERIAL_ID_DO_NOT_BATCH; - } - else - { - int glProgram = (int)_glProgramState->getGLProgram()->getProgram(); - int intArray[4] = { glProgram, (int)_textureID, (int)_blendType.src, (int)_blendType.dst}; - - _materialID = XXH32((const void*)intArray, sizeof(intArray), 0); - } -} - -void TrianglesCommand::useMaterial() const -{ - //Set texture - GL::bindTexture2D(_textureID); - - //set blend mode - GL::blendFunc(_blendType.src, _blendType.dst); - - _glProgramState->apply(_mv); -} - QuadCommand::QuadCommand() :TrianglesCommand() ,_quads(nullptr) diff --git a/cocos/renderer/CCQuadCommand.h b/cocos/renderer/CCQuadCommand.h index 549df94c8c..22ffbd4f9b 100644 --- a/cocos/renderer/CCQuadCommand.h +++ b/cocos/renderer/CCQuadCommand.h @@ -28,52 +28,9 @@ #include "renderer/CCRenderCommand.h" #include "renderer/CCGLProgramState.h" #include "renderer/CCRenderCommandPool.h" +#include "renderer/CCTrianglesCommand.h" NS_CC_BEGIN -class CC_DLL TrianglesCommand : public RenderCommand -{ -public: - static const int MATERIAL_ID_DO_NOT_BATCH = 0; - -public: - struct Triangles - { - V3F_C4B_T2F* verts; - unsigned short* indices; - ssize_t vertCount; - ssize_t indexCount; - }; - - TrianglesCommand(); - ~TrianglesCommand(); - - /** Initializes the command with a globalZOrder, a texture ID, a `GLProgram`, a blending function, a pointer to triangles, - * quantity of quads, and the Model View transform to be used for the quads */ - void init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, const Triangles& triangles,const Mat4& mv); - - void useMaterial() const; - - inline uint32_t getMaterialID() const { return _materialID; } - inline GLuint getTextureID() const { return _textureID; } - inline const Triangles& getTriangles() const { return _triangles; } - inline ssize_t getVertexCount() const { return _triangles.vertCount; } - inline ssize_t getIndexCount() const { return _triangles.indexCount; } - inline const V3F_C4B_T2F* getVertices() const { return _triangles.verts; } - inline const unsigned short* getIndices() const { return _triangles.indices; } - inline GLProgramState* getGLProgramState() const { return _glProgramState; } - inline BlendFunc getBlendType() const { return _blendType; } - inline const Mat4& getModelView() const { return _mv; } - -protected: - void generateMaterialID(); - - uint32_t _materialID; - GLuint _textureID; - GLProgramState* _glProgramState; - BlendFunc _blendType; - Triangles _triangles; - Mat4 _mv; -}; /** Command used to render one or more Quads */ class CC_DLL QuadCommand : public TrianglesCommand diff --git a/cocos/renderer/CCRenderer.cpp b/cocos/renderer/CCRenderer.cpp index 60c39f451f..86557d6b6e 100644 --- a/cocos/renderer/CCRenderer.cpp +++ b/cocos/renderer/CCRenderer.cpp @@ -26,6 +26,7 @@ #include +#include "renderer/CCTrianglesCommand.h" #include "renderer/CCQuadCommand.h" #include "renderer/CCBatchCommand.h" #include "renderer/CCCustomCommand.h" diff --git a/cocos/renderer/CCTrianglesCommand.cpp b/cocos/renderer/CCTrianglesCommand.cpp new file mode 100644 index 0000000000..8f46ef9c6a --- /dev/null +++ b/cocos/renderer/CCTrianglesCommand.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#include "renderer/CCTrianglesCommand.h" +#include "renderer/ccGLStateCache.h" +#include "renderer/CCGLProgram.h" +#include "renderer/CCGLProgramState.h" +#include "xxhash.h" +#include "renderer/CCRenderer.h" + +NS_CC_BEGIN + +TrianglesCommand::TrianglesCommand() +:_materialID(0) +,_textureID(0) +,_glProgramState(nullptr) +,_blendType(BlendFunc::DISABLE) +{ + _type = RenderCommand::Type::TRIANGLES_COMMAND; +} + +void TrianglesCommand::init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, const Triangles& triangles,const Mat4& mv) +{ + CCASSERT(glProgramState, "Invalid GLProgramState"); + CCASSERT(glProgramState->getVertexAttribsFlags() == 0, "No custom attributes are supported in QuadCommand"); + + _globalOrder = globalOrder; + + _triangles = triangles; + if(_triangles.indexCount % 3 != 0) + { + ssize_t count = _triangles.indexCount; + _triangles.indexCount = count / 3 * 3; + CCLOGERROR("Resize indexCount from %zd to %zd, size must be multiple times of 3", count, _triangles.indexCount); + } + _mv = mv; + + if( _textureID != textureID || _blendType.src != blendType.src || _blendType.dst != blendType.dst || _glProgramState != glProgramState) { + + _textureID = textureID; + _blendType = blendType; + _glProgramState = glProgramState; + + generateMaterialID(); + } +} + +TrianglesCommand::~TrianglesCommand() +{ +} + +void TrianglesCommand::generateMaterialID() +{ + + if(_glProgramState->getUniformCount() > 0) + { + _materialID = TrianglesCommand::MATERIAL_ID_DO_NOT_BATCH; + } + else + { + int glProgram = (int)_glProgramState->getGLProgram()->getProgram(); + int intArray[4] = { glProgram, (int)_textureID, (int)_blendType.src, (int)_blendType.dst}; + + _materialID = XXH32((const void*)intArray, sizeof(intArray), 0); + } +} + +void TrianglesCommand::useMaterial() const +{ + //Set texture + GL::bindTexture2D(_textureID); + + //set blend mode + GL::blendFunc(_blendType.src, _blendType.dst); + + _glProgramState->apply(_mv); +} + +NS_CC_END diff --git a/cocos/renderer/CCTrianglesCommand.h b/cocos/renderer/CCTrianglesCommand.h new file mode 100644 index 0000000000..71cd1cca25 --- /dev/null +++ b/cocos/renderer/CCTrianglesCommand.h @@ -0,0 +1,79 @@ +/**************************************************************************** + Copyright (c) 2013-2014 Chukong Technologies Inc. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + ****************************************************************************/ + +#ifndef __CC_TRIANGLES_COMMAND__ +#define __CC_TRIANGLES_COMMAND__ + +#include "renderer/CCRenderCommand.h" +#include "renderer/CCGLProgramState.h" + +NS_CC_BEGIN +class CC_DLL TrianglesCommand : public RenderCommand +{ +public: + static const int MATERIAL_ID_DO_NOT_BATCH = 0; + +public: + struct Triangles + { + V3F_C4B_T2F* verts; + unsigned short* indices; + ssize_t vertCount; + ssize_t indexCount; + }; + + TrianglesCommand(); + ~TrianglesCommand(); + + /** Initializes the command with a globalZOrder, a texture ID, a `GLProgram`, a blending function, a pointer to triangles, + * quantity of quads, and the Model View transform to be used for the quads */ + void init(float globalOrder, GLuint textureID, GLProgramState* glProgramState, BlendFunc blendType, const Triangles& triangles,const Mat4& mv); + + void useMaterial() const; + + inline uint32_t getMaterialID() const { return _materialID; } + inline GLuint getTextureID() const { return _textureID; } + inline const Triangles& getTriangles() const { return _triangles; } + inline ssize_t getVertexCount() const { return _triangles.vertCount; } + inline ssize_t getIndexCount() const { return _triangles.indexCount; } + inline const V3F_C4B_T2F* getVertices() const { return _triangles.verts; } + inline const unsigned short* getIndices() const { return _triangles.indices; } + inline GLProgramState* getGLProgramState() const { return _glProgramState; } + inline BlendFunc getBlendType() const { return _blendType; } + inline const Mat4& getModelView() const { return _mv; } + +protected: + void generateMaterialID(); + + uint32_t _materialID; + GLuint _textureID; + GLProgramState* _glProgramState; + BlendFunc _blendType; + Triangles _triangles; + Mat4 _mv; +}; + +NS_CC_END + +#endif // defined(__CC_TRIANGLES_COMMAND__) From bfaef3574a9f82fc70d0d0b1cd30f4e9a0f949c3 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Mon, 1 Sep 2014 13:57:33 +0800 Subject: [PATCH 06/30] android works for trianglesCommand --- cocos/Android.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/cocos/Android.mk b/cocos/Android.mk index 94c14a9824..87573c5ce1 100644 --- a/cocos/Android.mk +++ b/cocos/Android.mk @@ -159,6 +159,7 @@ renderer/CCVertexIndexBuffer.cpp \ renderer/CCVertexIndexData.cpp \ renderer/CCPrimitive.cpp \ renderer/CCPrimitiveCommand.cpp \ +renderer/CCTrianglesCommand.cpp \ deprecated/CCArray.cpp \ deprecated/CCSet.cpp \ deprecated/CCString.cpp \ From 68244538046b8a0ec386d2c6447c467fbd5bf31b Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Mon, 1 Sep 2014 15:08:09 +0800 Subject: [PATCH 07/30] windows work for trianglesCommand --- cocos/2d/libcocos2d.vcxproj | 2 ++ cocos/2d/libcocos2d.vcxproj.filters | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/cocos/2d/libcocos2d.vcxproj b/cocos/2d/libcocos2d.vcxproj index 9fdc34eb21..d2e43dad0a 100644 --- a/cocos/2d/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d.vcxproj @@ -405,6 +405,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\spine\prebuilt\release-l + @@ -781,6 +782,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\spine\prebuilt\release-l + diff --git a/cocos/2d/libcocos2d.vcxproj.filters b/cocos/2d/libcocos2d.vcxproj.filters index 1a5d9f9b25..692354480f 100644 --- a/cocos/2d/libcocos2d.vcxproj.filters +++ b/cocos/2d/libcocos2d.vcxproj.filters @@ -1165,6 +1165,9 @@ cocosbuilder\Source Files + + renderer + @@ -2290,6 +2293,9 @@ cocosbuilder\Header Files + + renderer + From 57dd8fd4e1ac6310edb891576f20a90aca70c199 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Mon, 1 Sep 2014 15:19:02 +0800 Subject: [PATCH 08/30] remove commented code --- cocos/renderer/CCRenderer.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/cocos/renderer/CCRenderer.cpp b/cocos/renderer/CCRenderer.cpp index 3b0f2c7291..7815e08701 100644 --- a/cocos/renderer/CCRenderer.cpp +++ b/cocos/renderer/CCRenderer.cpp @@ -411,8 +411,6 @@ void Renderer::drawBatchedQuads() { //TODO: we can improve the draw performance by insert material switching command before hand. -// int quadsToDraw = 0; -// int startQuad = 0; int indexToDraw = 0; int startIndex = 0; From 05d0e04073a0a6ea33ab68b22b56841d8d81c3e3 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Tue, 2 Sep 2014 15:05:21 +0800 Subject: [PATCH 09/30] [ci skip] update template for triangles command --- templates/cocos2dx_files.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 25d6d414cb..5099548791 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -934,6 +934,8 @@ "cocos/renderer/CCPrimitive.h", "cocos/renderer/CCPrimitiveCommand.cpp", "cocos/renderer/CCPrimitiveCommand.h", + "cocos/renderer/CCTrianglesCommand.cpp", + "cocos/renderer/CCTrianglesCommand.h", "cocos/renderer/CCQuadCommand.cpp", "cocos/renderer/CCQuadCommand.h", "cocos/renderer/CCRenderCommand.cpp", From 2e27a6865f51fc40e9d3f2d7e445f703be7e8456 Mon Sep 17 00:00:00 2001 From: andyque Date: Wed, 3 Sep 2014 14:10:38 +0800 Subject: [PATCH 10/30] update project to vs2013 --- cocos/2d/libcocos2d.vcxproj | 6 +++--- .../scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj | 6 +++--- tests/cpp-empty-test/proj.win32/cpp-empty-test.vcxproj | 6 +++--- tests/cpp-tests/proj.win32/cpp-tests.vcxproj | 6 +++--- .../project/proj.win32/lua-empty-test.vcxproj | 6 +++--- tests/lua-tests/project/proj.win32/lua-tests.win32.vcxproj | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cocos/2d/libcocos2d.vcxproj b/cocos/2d/libcocos2d.vcxproj index 108b9bc422..bb67aa5e3f 100644 --- a/cocos/2d/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -24,7 +24,7 @@ v110 v110_xp v120 - v110_xp + v120_xp DynamicLibrary @@ -33,7 +33,7 @@ v110 v110_xp v120 - v110_xp + v120_xp diff --git a/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj b/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj index e84501f6f1..3775b75bee 100644 --- a/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj +++ b/cocos/scripting/lua-bindings/proj.win32/libluacocos2d.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -208,7 +208,7 @@ v110 v110_xp v120 - v110_xp + v120_xp StaticLibrary @@ -217,7 +217,7 @@ v110 v110_xp v120 - v110_xp + v120_xp diff --git a/tests/cpp-empty-test/proj.win32/cpp-empty-test.vcxproj b/tests/cpp-empty-test/proj.win32/cpp-empty-test.vcxproj index 4bc89fa9de..22c42ff781 100644 --- a/tests/cpp-empty-test/proj.win32/cpp-empty-test.vcxproj +++ b/tests/cpp-empty-test/proj.win32/cpp-empty-test.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -24,7 +24,7 @@ v110 v110_xp v120 - v110_xp + v120_xp Application @@ -33,7 +33,7 @@ v110 v110_xp v120 - v110_xp + v120_xp diff --git a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj index 1fa1eec21b..f5612208c7 100644 --- a/tests/cpp-tests/proj.win32/cpp-tests.vcxproj +++ b/tests/cpp-tests/proj.win32/cpp-tests.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -24,7 +24,7 @@ v110 v110_xp v120 - v110_xp + v120_xp Application @@ -33,7 +33,7 @@ v110 v110_xp v120 - v110_xp + v120_xp diff --git a/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj b/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj index 7d24ad16dc..a9dbfd77e9 100644 --- a/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj +++ b/tests/lua-empty-test/project/proj.win32/lua-empty-test.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -22,7 +22,7 @@ v110 v110_xp v120 - v110_xp + v120_xp Application @@ -31,7 +31,7 @@ v110 v110_xp v120 - v110_xp + v120_xp diff --git a/tests/lua-tests/project/proj.win32/lua-tests.win32.vcxproj b/tests/lua-tests/project/proj.win32/lua-tests.win32.vcxproj index f4592847dd..547770c554 100644 --- a/tests/lua-tests/project/proj.win32/lua-tests.win32.vcxproj +++ b/tests/lua-tests/project/proj.win32/lua-tests.win32.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -23,7 +23,7 @@ v110 v110_xp v120 - v110_xp + v120_xp Application @@ -33,7 +33,7 @@ v110 v110_xp v120 - v110_xp + v120_xp From 87af0ecdd69b76cf499e314068d57d30b5645920 Mon Sep 17 00:00:00 2001 From: andyque Date: Wed, 3 Sep 2014 17:37:34 +0800 Subject: [PATCH 11/30] add back libbox2d and libspine project to our solution --- build/cocos2d-win32.vc2012.sln | 40 ++++- cocos/2d/cocos2d_headers.props | 3 + cocos/2d/cocos2dx.props | 5 +- cocos/2d/libcocos2d.vcxproj | 17 +- .../spine/proj.win32/libSpine.vcxproj | 152 ++++++++++++++++ .../spine/proj.win32/libSpine.vcxproj.filters | 170 ++++++++++++++++++ 6 files changed, 379 insertions(+), 8 deletions(-) create mode 100644 cocos/editor-support/spine/proj.win32/libSpine.vcxproj create mode 100644 cocos/editor-support/spine/proj.win32/libSpine.vcxproj.filters diff --git a/build/cocos2d-win32.vc2012.sln b/build/cocos2d-win32.vc2012.sln index f23109c90c..45dcf34217 100644 --- a/build/cocos2d-win32.vc2012.sln +++ b/build/cocos2d-win32.vc2012.sln @@ -1,6 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-tests", "..\tests\cpp-tests\proj.win32\cpp-tests.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-tests", "..\tests\lua-tests\project\proj.win32\lua-tests.win32.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}" @@ -13,40 +15,76 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\l EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libluacocos2d", "..\cocos\scripting\lua-bindings\proj.win32\libluacocos2d.vcxproj", "{9F2D6CE6-C893-4400-B50C-6DB70CC2562F}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d", "..\external\Box2D\proj.win32\libbox2d.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{92D54E36-7916-48EF-A951-224DD3B25442}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos\editor-support\spine\proj.win32\libSpine.vcxproj", "{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM Debug|Win32 = Debug|Win32 + Release|ARM = Release|ARM Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|ARM.ActiveCfg = Debug|Win32 {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.ActiveCfg = Debug|Win32 {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.Build.0 = Debug|Win32 + {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|ARM.ActiveCfg = Release|Win32 {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.ActiveCfg = Release|Win32 {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.Build.0 = Release|Win32 + {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|ARM.ActiveCfg = Debug|Win32 {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.ActiveCfg = Debug|Win32 {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.Build.0 = Debug|Win32 + {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|ARM.ActiveCfg = Release|Win32 {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.ActiveCfg = Release|Win32 {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.Build.0 = Release|Win32 + {B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Debug|ARM.ActiveCfg = Debug|Win32 {B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Debug|Win32.ActiveCfg = Debug|Win32 {B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Debug|Win32.Build.0 = Debug|Win32 + {B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Release|ARM.ActiveCfg = Release|Win32 {B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Release|Win32.ActiveCfg = Release|Win32 {B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Release|Win32.Build.0 = Release|Win32 + {13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Debug|ARM.ActiveCfg = Debug|Win32 {13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Debug|Win32.ActiveCfg = Debug|Win32 {13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Debug|Win32.Build.0 = Debug|Win32 + {13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Release|ARM.ActiveCfg = Release|Win32 {13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Release|Win32.ActiveCfg = Release|Win32 {13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Release|Win32.Build.0 = Release|Win32 + {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|ARM.ActiveCfg = Debug|Win32 {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.ActiveCfg = Debug|Win32 {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32 + {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|ARM.ActiveCfg = Release|Win32 {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32 {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32 + {9F2D6CE6-C893-4400-B50C-6DB70CC2562F}.Debug|ARM.ActiveCfg = Debug|Win32 {9F2D6CE6-C893-4400-B50C-6DB70CC2562F}.Debug|Win32.ActiveCfg = Debug|Win32 {9F2D6CE6-C893-4400-B50C-6DB70CC2562F}.Debug|Win32.Build.0 = Debug|Win32 + {9F2D6CE6-C893-4400-B50C-6DB70CC2562F}.Release|ARM.ActiveCfg = Release|Win32 {9F2D6CE6-C893-4400-B50C-6DB70CC2562F}.Release|Win32.ActiveCfg = Release|Win32 {9F2D6CE6-C893-4400-B50C-6DB70CC2562F}.Release|Win32.Build.0 = Release|Win32 + {929480E7-23C0-4DF6-8456-096D71547116}.Debug|ARM.ActiveCfg = Debug|Win32 + {929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.ActiveCfg = Debug|Win32 + {929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.Build.0 = Debug|Win32 + {929480E7-23C0-4DF6-8456-096D71547116}.Release|ARM.ActiveCfg = Release|Win32 + {929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.ActiveCfg = Release|Win32 + {929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.Build.0 = Release|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|ARM.ActiveCfg = Debug|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.ActiveCfg = Debug|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.Build.0 = Debug|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|ARM.ActiveCfg = Release|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.ActiveCfg = Release|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {929480E7-23C0-4DF6-8456-096D71547116} = {92D54E36-7916-48EF-A951-224DD3B25442} + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE} = {92D54E36-7916-48EF-A951-224DD3B25442} + EndGlobalSection GlobalSection(DPCodeReviewSolutionGUID) = preSolution DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} EndGlobalSection diff --git a/cocos/2d/cocos2d_headers.props b/cocos/2d/cocos2d_headers.props index afdcd49a10..596cc3f6c2 100644 --- a/cocos/2d/cocos2d_headers.props +++ b/cocos/2d/cocos2d_headers.props @@ -10,6 +10,9 @@ $(EngineRoot)cocos;$(EngineRoot)cocos\platform\win32;$(EngineRoot)cocos\platform\desktop;$(EngineRoot)external\glfw3\include\win32;$(EngineRoot)external\win32-specific\gles\include\OGLES _VARIADIC_MAX=10;%(PreprocessorDefinitions) + + true + diff --git a/cocos/2d/cocos2dx.props b/cocos/2d/cocos2dx.props index 543f4ab5cc..d20aeccf80 100644 --- a/cocos/2d/cocos2dx.props +++ b/cocos/2d/cocos2dx.props @@ -7,11 +7,14 @@ - opengl32.lib;glew32.lib;libzlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;libwebp.lib;libiconv.lib;glfw3.lib;freetype250.lib;winmm.lib;ws2_32.lib;libchipmunk.lib;libbox2d.lib;libspine.lib;%(AdditionalDependencies) + opengl32.lib;glew32.lib;libzlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;libwebp.lib;libiconv.lib;glfw3.lib;freetype250.lib;winmm.lib;ws2_32.lib;libchipmunk.lib;libbox2d.lib;libSpine.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) false + + true + \ No newline at end of file diff --git a/cocos/2d/libcocos2d.vcxproj b/cocos/2d/libcocos2d.vcxproj index bb67aa5e3f..0b27c0edae 100644 --- a/cocos/2d/libcocos2d.vcxproj +++ b/cocos/2d/libcocos2d.vcxproj @@ -77,7 +77,7 @@ Disabled - $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\Box2d;$(EngineRoot)external\curl\include\win32;$(EngineRoot)external\websockets\include\win32;$(EngineRoot)external;$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories) + $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\box2d;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;$(EngineRoot)external\curl\include\win32;$(EngineRoot)external\websockets\include\win32;$(EngineRoot)external;$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories) WIN32;_USRDLL;_DEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;%(PreprocessorDefinitions) false EnableFastChecks @@ -104,9 +104,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\zlib\prebuilt\*.*" "$(Ou xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\icon\prebuilt\*.*" "$(OutDir)" xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(OutDir)" xcopy /Y /Q "$(ProjectDir)..\..\external\sqlite3\libraries\win32\*.*" "$(OutDir)" -xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\chipmunk\prebuilt\debug-lib\*.*" "$(OutDir)" -xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\box2d\prebuilt\debug-lib\*.*" "$(OutDir)" -xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\spine\prebuilt\debug-lib\*.*" "$(OutDir)" +xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\chipmunk\prebuilt\debug-lib\*.*" "$(OutDir)" $(OutDir)$(ProjectName).dll @@ -158,8 +156,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\zlib\prebuilt\*.*" "$(Ou xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\icon\prebuilt\*.*" "$(OutDir)" xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(OutDir)" xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\chipmunk\prebuilt\release-lib\*.*" "$(OutDir)" -xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\box2d\prebuilt\release-lib\*.*" "$(OutDir)" -xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\spine\prebuilt\release-lib\*.*" "$(OutDir)" + sqlite3.lib;libcurl_imp.lib;websockets.lib;%(AdditionalDependencies) @@ -887,6 +884,14 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\spine\prebuilt\release-l + + + {929480e7-23c0-4df6-8456-096d71547116} + + + {b7c2a162-dec9-4418-972e-240ab3cbfcae} + + diff --git a/cocos/editor-support/spine/proj.win32/libSpine.vcxproj b/cocos/editor-support/spine/proj.win32/libSpine.vcxproj new file mode 100644 index 0000000000..2f033657b8 --- /dev/null +++ b/cocos/editor-support/spine/proj.win32/libSpine.vcxproj @@ -0,0 +1,152 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE} + libSpine + + + + StaticLibrary + true + v100 + v110 + v110_xp + v120 + v120_xp + Unicode + + + StaticLibrary + false + v100 + v110 + v110_xp + v120 + v120_xp + true + Unicode + + + + + + + + + + + + + + + $(SolutionDir)$(Configuration).win32\ + $(Configuration).win32\ + + + $(SolutionDir)$(Configuration).win32\ + $(Configuration).win32\ + + + + Level3 + Disabled + + + $(EngineRoot);$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + 4267;4251;4244;%(DisableSpecificWarnings) + false + + + true + + + + + Level3 + MinSpace + true + true + + + WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + $(EngineRoot);$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;%(AdditionalIncludeDirectories) + None + false + + + true + true + true + + + + + + \ No newline at end of file diff --git a/cocos/editor-support/spine/proj.win32/libSpine.vcxproj.filters b/cocos/editor-support/spine/proj.win32/libSpine.vcxproj.filters new file mode 100644 index 0000000000..a6f105d4bc --- /dev/null +++ b/cocos/editor-support/spine/proj.win32/libSpine.vcxproj.filters @@ -0,0 +1,170 @@ + + + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file From 925fb9aa38e8ee3f578f9c1282cee17f61af179e Mon Sep 17 00:00:00 2001 From: Kezhu Wang Date: Tue, 24 Jun 2014 23:01:15 +0800 Subject: [PATCH 12/30] bugfix: condition variable sleep on unrelated mutex --- cocos/network/HttpClient.cpp | 53 +++++++++++++----------------------- 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/cocos/network/HttpClient.cpp b/cocos/network/HttpClient.cpp index c2a0440b99..4640258c2a 100644 --- a/cocos/network/HttpClient.cpp +++ b/cocos/network/HttpClient.cpp @@ -47,16 +47,13 @@ namespace network { static std::mutex s_requestQueueMutex; static std::mutex s_responseQueueMutex; -static std::mutex s_SleepMutex; -static std::condition_variable s_SleepCondition; +static std::condition_variable_any s_SleepCondition; #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) typedef int int32_t; #endif -static bool s_need_quit = false; - static Vector* s_requestQueue = nullptr; static Vector* s_responseQueue = nullptr; @@ -102,43 +99,31 @@ static int processDeleteTask(HttpRequest *request, write_callback callback, void // int processDownloadTask(HttpRequest *task, write_callback callback, void *stream, int32_t *errorCode); static void processResponse(HttpResponse* response, char* errorBuffer); +static HttpRequest *s_requestSentinel = new HttpRequest; + // Worker thread void HttpClient::networkThread() { - HttpRequest *request = nullptr; - auto scheduler = Director::getInstance()->getScheduler(); while (true) { - if (s_need_quit) - { - break; - } - + HttpRequest *request; + // step 1: send http request if the requestQueue isn't empty - request = nullptr; - - s_requestQueueMutex.lock(); - - //Get request task from queue - - if (!s_requestQueue->empty()) { + std::lock_guard lock(s_requestQueueMutex); + while (s_requestQueue->empty()) { + s_SleepCondition.wait(s_requestQueueMutex); + } request = s_requestQueue->at(0); s_requestQueue->erase(0); } - - s_requestQueueMutex.unlock(); - - if (nullptr == request) - { - // Wait for http request tasks from main thread - std::unique_lock lk(s_SleepMutex); - s_SleepCondition.wait(lk); - continue; + + if (request == s_requestSentinel) { + break; } - + // step 2: libcurl sync access // Create a HttpResponse object, the default setting is http access failed @@ -462,12 +447,14 @@ HttpClient::HttpClient() HttpClient::~HttpClient() { - s_need_quit = true; - if (s_requestQueue != nullptr) { + { + std::lock_guard lock(s_requestQueueMutex); + s_requestQueue->pushBack(s_requestSentinel); + } s_SleepCondition.notify_one(); } - + s_pHttpClient = nullptr; } @@ -480,9 +467,7 @@ bool HttpClient::lazyInitThreadSemphore() s_requestQueue = new (std::nothrow) Vector(); s_responseQueue = new (std::nothrow) Vector(); - - s_need_quit = false; - + auto t = std::thread(CC_CALLBACK_0(HttpClient::networkThread, this)); t.detach(); } From 89ed897f47b2746f5b23502cd7e9fe877f2f9a90 Mon Sep 17 00:00:00 2001 From: Sergey Date: Thu, 26 Jun 2014 14:40:33 +0400 Subject: [PATCH 13/30] getAllTouches() in GLView --- cocos/platform/CCGLView.cpp | 20 ++++++++++++++++++++ cocos/platform/CCGLView.h | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/cocos/platform/CCGLView.cpp b/cocos/platform/CCGLView.cpp index e2d5ebb0f7..83709f06b8 100644 --- a/cocos/platform/CCGLView.cpp +++ b/cocos/platform/CCGLView.cpp @@ -56,6 +56,21 @@ namespace { return -1; } + static std::vector getAllTouchesVector() + { + std::vector ret; + int i; + int temp = g_indexBitsUsed; + + for (i = 0; i < EventTouch::MAX_TOUCHES; i++) { + if ( temp & 0x00000001) { + ret.push_back(g_touches[i]); + } + temp >>= 1; + } + return ret; + } + static void removeUsedIndexBit(int index) { if (index < 0 || index >= EventTouch::MAX_TOUCHES) @@ -423,6 +438,11 @@ const Rect& GLView::getViewPortRect() const return _viewPortRect; } +std::vector GLView::getAllTouches() const +{ + return getAllTouchesVector(); +} + float GLView::getScaleX() const { return _scaleX; diff --git a/cocos/platform/CCGLView.h b/cocos/platform/CCGLView.h index f8243770ed..030def1ee8 100644 --- a/cocos/platform/CCGLView.h +++ b/cocos/platform/CCGLView.h @@ -220,6 +220,11 @@ public: * Get the opengl view port rectangle. */ const Rect& getViewPortRect() const; + + /** + * Get list of all active touches + */ + std::vector getAllTouches() const; /** * Get scale factor of the horizontal direction. From 345167236519aabc3a35e84aaa6a8347d8cfa55d Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 4 Sep 2014 10:49:45 +0800 Subject: [PATCH 14/30] restore some configs --- cocos/2d/cocos2d_headers.props | 2 +- cocos/2d/cocos2dx.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/2d/cocos2d_headers.props b/cocos/2d/cocos2d_headers.props index 596cc3f6c2..aaaefd1c7d 100644 --- a/cocos/2d/cocos2d_headers.props +++ b/cocos/2d/cocos2d_headers.props @@ -11,7 +11,7 @@ _VARIADIC_MAX=10;%(PreprocessorDefinitions) - true + false diff --git a/cocos/2d/cocos2dx.props b/cocos/2d/cocos2dx.props index d20aeccf80..a0a234ee9f 100644 --- a/cocos/2d/cocos2dx.props +++ b/cocos/2d/cocos2dx.props @@ -13,7 +13,7 @@ - true + false From a1edd4a819d5946ca5f9b21f6d55e2ca08487234 Mon Sep 17 00:00:00 2001 From: andyque Date: Thu, 4 Sep 2014 10:07:46 +0800 Subject: [PATCH 15/30] remove dead code --- .../cocostudio/CCActionNode.cpp | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/cocos/editor-support/cocostudio/CCActionNode.cpp b/cocos/editor-support/cocostudio/CCActionNode.cpp index d1dfa4f438..aa30b2b2fe 100644 --- a/cocos/editor-support/cocostudio/CCActionNode.cpp +++ b/cocos/editor-support/cocostudio/CCActionNode.cpp @@ -313,18 +313,14 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root) } void ActionNode::initActionNodeFromRoot(Ref* root) -{ - Node* rootNode = dynamic_cast(root); - if (rootNode != nullptr) +{ + Widget* rootWidget = dynamic_cast(root); + if (rootWidget != nullptr) { - Widget* rootWidget = dynamic_cast(root); - if (rootWidget != nullptr) + Widget* widget = Helper::seekActionWidgetByActionTag(rootWidget, getActionTag()); + if (widget != nullptr) { - Widget* widget = Helper::seekActionWidgetByActionTag(rootWidget, getActionTag()); - if (widget != nullptr) - { - setObject(widget); - } + setObject(widget); } } } @@ -367,14 +363,6 @@ Node* ActionNode::getActionNode() { return cNode; } - else - { - Widget* rootWidget = dynamic_cast(_object); - if (rootWidget != nullptr) - { - return rootWidget; - } - } return nullptr; } From 64d926a75f0c837d947298e854823a51ba2881df Mon Sep 17 00:00:00 2001 From: Dhilan007 Date: Thu, 4 Sep 2014 11:04:50 +0800 Subject: [PATCH 16/30] fix compile error on android. --- .../android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java | 1 - 1 file changed, 1 deletion(-) diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java index ea102e7f73..ebbc5bdc75 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxHelper.java @@ -91,7 +91,6 @@ public class Cocos2dxHelper { Cocos2dxHelper.nativeSetContext((Context)activity, Cocos2dxHelper.sAssetManager); Cocos2dxBitmap.setContext(activity); - Cocos2dxETCLoader.setContext(activity); sActivity = activity; sInited = true; From 6f03e97a6d9445dc7998447a4f9c44368ca0d6e8 Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Thu, 4 Sep 2014 11:20:43 +0800 Subject: [PATCH 17/30] add trianglesCommand head file to cocos2d remove invoking of base class constructor --- cocos/cocos2d.h | 1 + cocos/renderer/CCQuadCommand.cpp | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/cocos2d.h b/cocos/cocos2d.h index 0bd428f97d..4f06a692d7 100644 --- a/cocos/cocos2d.h +++ b/cocos/cocos2d.h @@ -158,6 +158,7 @@ THE SOFTWARE. #include "renderer/CCVertexIndexData.h" #include "renderer/CCPrimitive.h" #include "renderer/CCPrimitiveCommand.h" +#include "renderer/CCTrianglesCommand.h" // physics #include "physics/CCPhysicsBody.h" diff --git a/cocos/renderer/CCQuadCommand.cpp b/cocos/renderer/CCQuadCommand.cpp index 128d69f3ee..5b910e7e89 100644 --- a/cocos/renderer/CCQuadCommand.cpp +++ b/cocos/renderer/CCQuadCommand.cpp @@ -33,8 +33,7 @@ NS_CC_BEGIN QuadCommand::QuadCommand() -:TrianglesCommand() -,_quads(nullptr) +:_quads(nullptr) ,_quadsCount(0) { _type = RenderCommand::Type::QUAD_COMMAND; From 9cd21f19c9797e682e810c3b25b4729025628c9c Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 4 Sep 2014 13:39:17 +0800 Subject: [PATCH 18/30] [ci skip] --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 58c9390ddf..f422026bd4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ cocos2d-x-3.3?? ?? [NEW] UI: added `WebView` on iOS and Android [FIX] EditBox: moved to ui:EditBox + [FIX] HttpClient: condition variable sleep on unrelated mutex [FIX] Node: create unneeded temple `Vec2` object in `setPosition(int, int)`, `setPositionX()` and `setPositionY()` [FIX] Node: skew effect is wrong [FIX] Node: setNormalizedPosition can not take effect if parent position is not changed From a416eb72980a8b7e87ea2fa4c619992680e2102d Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 4 Sep 2014 13:40:40 +0800 Subject: [PATCH 19/30] [ci skip] --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index ba8e4686d9..a5b107d9d3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -896,6 +896,7 @@ Developers: kezhuw AutoReleasePool manager improvement + Fixed a bug that condition variable sleep on unrelated mutex in HttpClient zhouxiaoxiaoxujian Added TextField::getStringLength() From 4b21972d8bd0a17475944bcaefa07a378271633b Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 4 Sep 2014 05:42:22 +0000 Subject: [PATCH 20/30] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index fce55eac65..e178a7ff23 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -640,6 +640,8 @@ "cocos/editor-support/spine/SlotData.h", "cocos/editor-support/spine/extension.cpp", "cocos/editor-support/spine/extension.h", + "cocos/editor-support/spine/proj.win32/libSpine.vcxproj", + "cocos/editor-support/spine/proj.win32/libSpine.vcxproj.filters", "cocos/editor-support/spine/proj.wp8/libSpine.vcxproj", "cocos/editor-support/spine/proj.wp8/libSpine.vcxproj.filters", "cocos/editor-support/spine/proj.wp8/libSpine.vcxproj.user", From 6bd05770e712e437dd13cbbcc04d5d92537f590b Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Thu, 4 Sep 2014 06:00:43 +0000 Subject: [PATCH 21/30] [AUTO][ci skip]: updating cocos2dx_files.json --- templates/cocos2dx_files.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/cocos2dx_files.json b/templates/cocos2dx_files.json index 7f7f746beb..8371a753c1 100644 --- a/templates/cocos2dx_files.json +++ b/templates/cocos2dx_files.json @@ -935,8 +935,6 @@ "cocos/renderer/CCPrimitive.h", "cocos/renderer/CCPrimitiveCommand.cpp", "cocos/renderer/CCPrimitiveCommand.h", - "cocos/renderer/CCTrianglesCommand.cpp", - "cocos/renderer/CCTrianglesCommand.h", "cocos/renderer/CCQuadCommand.cpp", "cocos/renderer/CCQuadCommand.h", "cocos/renderer/CCRenderCommand.cpp", @@ -950,6 +948,8 @@ "cocos/renderer/CCTextureAtlas.h", "cocos/renderer/CCTextureCache.cpp", "cocos/renderer/CCTextureCache.h", + "cocos/renderer/CCTrianglesCommand.cpp", + "cocos/renderer/CCTrianglesCommand.h", "cocos/renderer/CCVertexIndexBuffer.cpp", "cocos/renderer/CCVertexIndexBuffer.h", "cocos/renderer/CCVertexIndexData.cpp", From d26446c73f2da251c6992e3d8019cc7079fddd34 Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 4 Sep 2014 14:02:20 +0800 Subject: [PATCH 22/30] [ci skip] --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index f422026bd4..93ed0c39b6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ cocos2d-x-3.3?? ?? [NEW] ActionManager: added removeAllActionsByTag() [NEW] Node: added stopAllActionsByTag() + [NEW] Renderer: added TriangleCommand [NEW] UI: added `WebView` on iOS and Android [FIX] EditBox: moved to ui:EditBox From 08a1405bdc627f344db267b0729da57e1ab848e1 Mon Sep 17 00:00:00 2001 From: yangxiao Date: Thu, 4 Sep 2014 14:26:23 +0800 Subject: [PATCH 23/30] fix bug on custom mesh --- cocos/3d/CCMesh.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp index 0c524e4af2..f683caf684 100644 --- a/cocos/3d/CCMesh.cpp +++ b/cocos/3d/CCMesh.cpp @@ -144,10 +144,7 @@ Mesh* Mesh::create(const std::vector& vertices, int perVertexSizeInFloat, meshdata.subMeshIndices.push_back(indices); meshdata.subMeshIds.push_back(""); auto meshvertexdata = MeshVertexData::create(meshdata); - auto indexbuffer = IndexBuffer::create(IndexBuffer::IndexType::INDEX_TYPE_SHORT_16, (int)indices.size()); - - AABB aabb = MeshVertexData::calculateAABB(meshdata.vertex, meshdata.getPerVertexSize(), indices); - auto indexData = MeshIndexData::create("", meshvertexdata, indexbuffer, aabb); + auto indexData = meshvertexdata->getMeshIndexDataByIndex(0); return create("", indexData); } From 8c2ab3a4e7e98850a697fa0835f5963c42b13183 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Thu, 4 Sep 2014 22:12:59 +0800 Subject: [PATCH 24/30] Add manual lua bindings for GLView::getAllTouches --- .../manual/cocos2d/lua_cocos2dx_manual.cpp | 75 +++++++++++++++++++ tools/tolua/cocos2dx.ini | 2 +- 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp index b700761f7e..4bb4578991 100644 --- a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp @@ -6505,6 +6505,80 @@ static void extendTextureCache(lua_State* tolua_S) lua_pop(tolua_S, 1); } +int lua_cocos2dx_GLView_getAllTouches(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::GLView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"cc.GLView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::GLView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_GLView_getAllTouches'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 0) + { + if(!ok) + return 0; + + std::vector ret = cobj->getAllTouches(); + lua_newtable(tolua_S); + if (ret.empty()) + return 1; + + int index = 1; + for (const auto& obj : ret) + { + if (nullptr == obj) + continue; + + lua_pushnumber(tolua_S, (lua_Number)index); + int ID = (obj) ? (int)obj->_ID : -1; + int* luaID = (obj) ? &obj->_luaID : nullptr; + toluafix_pushusertype_ccobject(tolua_S, ID, luaID, (void*)obj, "cc.Touch"); + lua_rawset(tolua_S, -3); + ++index; + } + + return 1; + } + CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.GLView:getAllTouches",argc, 0); + return 0; + +#if COCOS2D_DEBUG >= 1 +tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_GLView_getAllTouches'.",&tolua_err); +#endif + + return 0; +} + +static void extendGLView(lua_State* tolua_S) +{ + lua_pushstring(tolua_S, "cc.GLView"); + lua_rawget(tolua_S, LUA_REGISTRYINDEX); + if (lua_istable(tolua_S,-1)) + { + tolua_function(tolua_S, "getAllTouches", lua_cocos2dx_GLView_getAllTouches); + } + lua_pop(tolua_S, 1); +} + int register_all_cocos2dx_manual(lua_State* tolua_S) { if (NULL == tolua_S) @@ -6559,6 +6633,7 @@ int register_all_cocos2dx_manual(lua_State* tolua_S) extendEventListenerFocus(tolua_S); extendApplication(tolua_S); extendTextureCache(tolua_S); + extendGLView(tolua_S); return 0; } diff --git a/tools/tolua/cocos2dx.ini b/tools/tolua/cocos2dx.ini index 2d59d96980..d6894e123b 100644 --- a/tools/tolua/cocos2dx.ini +++ b/tools/tolua/cocos2dx.ini @@ -108,7 +108,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS ccFontDefinition::[*], Ref::[autorelease isEqual acceptVisitor update], UserDefault::[getInstance (s|g)etDataForKey], - GLView::[setTouchDelegate], + GLView::[setTouchDelegate getAllTouches], GLViewImpl::[end swapBuffers], NewTextureAtlas::[*], DisplayLinkDirector::[mainLoop setAnimationInterval startAnimation stopAnimation], From 9aefbeaed5f3b2076ad53981e28c734e1dd723fe Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 4 Sep 2014 22:37:15 +0800 Subject: [PATCH 25/30] [ci skip] --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index a5b107d9d3..c81497d25f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -809,6 +809,7 @@ Developers: Added Device::setKeepScreenOn() Fixed Label performance problem Added Node::stopAllActionsByTag && ActionManager::removeAllActionsByTag + Added getAllTouches() in GLViewProtocol youknowone Adds iOS-like elastic bounceback support for cocos2d::extension::ScrollView From a2ee559244a01d6bd7e23de2fff2d5667d8f35af Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 4 Sep 2014 22:38:26 +0800 Subject: [PATCH 26/30] [ci skip] --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 93ed0c39b6..128c864ddc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ cocos2d-x-3.3?? ?? [NEW] ActionManager: added removeAllActionsByTag() + [NEW] GLViewProtocol: added getAllTouches() [NEW] Node: added stopAllActionsByTag() [NEW] Renderer: added TriangleCommand [NEW] UI: added `WebView` on iOS and Android From 6209530e6647491be657af35d67a3790d6cc6992 Mon Sep 17 00:00:00 2001 From: samuele3hu Date: Fri, 5 Sep 2014 09:39:43 +0800 Subject: [PATCH 27/30] Fix the error that number of params was judged wrong for lua bindings of EventListenerMouse::create --- .../lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp index 4bb4578991..ba320b61eb 100644 --- a/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp +++ b/cocos/scripting/lua-bindings/manual/cocos2d/lua_cocos2dx_manual.cpp @@ -5163,7 +5163,7 @@ static int tolua_cocos2dx_EventListenerMouse_create(lua_State* tolua_S) argc = lua_gettop(tolua_S) - 1; - if (argc == 1) + if (argc == 0) { cocos2d::EventListenerMouse* tolua_ret = cocos2d::EventListenerMouse::create(); if(nullptr == tolua_ret) @@ -5176,7 +5176,7 @@ static int tolua_cocos2dx_EventListenerMouse_create(lua_State* tolua_S) return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d\n", "cc.EventListenerMouse:create",argc, 1); + CCLOG("%s has wrong number of arguments: %d, was expecting %d\n", "cc.EventListenerMouse:create",argc, 0); return 0; #if COCOS2D_DEBUG >= 1 From 7372604f7fe2435a394dff1e2e67af874a443d0f Mon Sep 17 00:00:00 2001 From: huangshiwu Date: Fri, 5 Sep 2014 11:21:08 +0800 Subject: [PATCH 28/30] fix wp8 compile error and modify default resource path --- cocos/2d/cocos2d_wp8.vcxproj | 4 ++++ cocos/2d/cocos2d_wp8.vcxproj.filters | 12 ++++++++++ cocos/platform/winrt/CCFileUtilsWinRT.cpp | 2 +- extensions/proj.wp8/libExtensions.vcxproj | 7 ------ .../proj.wp8/libExtensions.vcxproj.filters | 24 ------------------- .../proj.wp8-xaml/App/HelloCpp.csproj | 24 +++++++++++-------- .../cpp-testsComponent.vcxproj | 4 ---- .../cpp-testsComponent.vcxproj.filters | 20 ++-------------- 8 files changed, 33 insertions(+), 64 deletions(-) diff --git a/cocos/2d/cocos2d_wp8.vcxproj b/cocos/2d/cocos2d_wp8.vcxproj index bd9eafacf0..58078bb03d 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj +++ b/cocos/2d/cocos2d_wp8.vcxproj @@ -230,6 +230,7 @@ + @@ -367,6 +368,7 @@ + @@ -453,6 +455,7 @@ + @@ -596,6 +599,7 @@ + diff --git a/cocos/2d/cocos2d_wp8.vcxproj.filters b/cocos/2d/cocos2d_wp8.vcxproj.filters index 154b65da34..0634b1b385 100644 --- a/cocos/2d/cocos2d_wp8.vcxproj.filters +++ b/cocos/2d/cocos2d_wp8.vcxproj.filters @@ -653,6 +653,12 @@ 3d + + renderer + + + 3d + @@ -1334,6 +1340,12 @@ 3d + + renderer + + + 3d + diff --git a/cocos/platform/winrt/CCFileUtilsWinRT.cpp b/cocos/platform/winrt/CCFileUtilsWinRT.cpp index a5b0e7214c..736a597504 100644 --- a/cocos/platform/winrt/CCFileUtilsWinRT.cpp +++ b/cocos/platform/winrt/CCFileUtilsWinRT.cpp @@ -53,7 +53,7 @@ static void _checkPath() if (s_pszResourcePath.empty()) { // TODO: needs to be tested - s_pszResourcePath = convertPathFormatToUnixStyle(CCFileUtilsWinRT::getAppPath() + '\\' + "Assets\\res" + '\\'); + s_pszResourcePath = convertPathFormatToUnixStyle(CCFileUtilsWinRT::getAppPath() + '\\' + "Assets\\Resources" + '\\'); } } diff --git a/extensions/proj.wp8/libExtensions.vcxproj b/extensions/proj.wp8/libExtensions.vcxproj index 451b0d11ef..72380f216e 100644 --- a/extensions/proj.wp8/libExtensions.vcxproj +++ b/extensions/proj.wp8/libExtensions.vcxproj @@ -176,9 +176,6 @@ - - - @@ -208,10 +205,6 @@ - - - - diff --git a/extensions/proj.wp8/libExtensions.vcxproj.filters b/extensions/proj.wp8/libExtensions.vcxproj.filters index 57969f624b..2a3c131354 100644 --- a/extensions/proj.wp8/libExtensions.vcxproj.filters +++ b/extensions/proj.wp8/libExtensions.vcxproj.filters @@ -13,9 +13,6 @@ {d5806151-7ae1-4fef-af5a-2fa1d1c7377b} - - {5d186e3d-0aaf-4904-a5d8-e5cb0f35f4cc} - {49487dbe-5758-436a-b014-8e2edc6b33ae} @@ -57,27 +54,18 @@ GUI\CCControlExtension - - GUI\CCControlExtension - GUI\CCControlExtension GUI\CCControlExtension - - GUI\CCEditBox - physics_nodes physics_nodes - - GUI\CCEditBox - @@ -125,27 +113,15 @@ GUI\CCControlExtension - - GUI\CCControlExtension - GUI\CCControlExtension - - GUI\CCEditBox - - - GUI\CCEditBox - physics_nodes physics_nodes - - GUI\CCEditBox - \ No newline at end of file diff --git a/templates/cpp-template-default/proj.wp8-xaml/App/HelloCpp.csproj b/templates/cpp-template-default/proj.wp8-xaml/App/HelloCpp.csproj index 19d93505a5..2f4cec563c 100644 --- a/templates/cpp-template-default/proj.wp8-xaml/App/HelloCpp.csproj +++ b/templates/cpp-template-default/proj.wp8-xaml/App/HelloCpp.csproj @@ -102,12 +102,24 @@ + + Assets\Resources\fonts\Marker Felt.ttf + Designer + + Assets\Resources\CloseNormal.png + + + Assets\Resources\CloseSelected.png + + + Assets\Resources\HelloWorld.png + PreserveNewest @@ -154,14 +166,7 @@ Designer - - - - Assets\res\%(RecursiveDir)%(FileName)%(Extension) - PreserveNewest - - - + - - + \ No newline at end of file diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj index 60ea821193..b1c32cce74 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj @@ -207,11 +207,9 @@ - - @@ -411,11 +409,9 @@ - - diff --git a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj.filters b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj.filters index 44d9ce5bea..3a2638f4ef 100644 --- a/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj.filters +++ b/tests/cpp-tests/proj.wp8-xaml/cpp-testsComponent/cpp-testsComponent.vcxproj.filters @@ -199,9 +199,6 @@ {a4c2111f-cf9f-492c-884d-3de24715adce} - - {18a69e7e-8ca7-475a-bfbb-7296baab16ce} - {0ef55f53-411a-4661-b5d5-13930da52e68} @@ -217,9 +214,6 @@ {81ec2355-7efd-49e0-b6cb-b1bba23fbbc8} - - {3d73aa04-d66e-43d3-921f-b867a753c113} - {a6e7d28e-46a3-46c4-9735-b39e96f776f0} @@ -582,9 +576,6 @@ Classes\FileUtilsTest - - Classes\ExtensionsTest\EditBoxTest - Classes\ExtensionsTest\CocosBuilderTest\TimelineCallbackTest @@ -600,9 +591,6 @@ Classes - - Classes\ExtensionsTest\Scale9SpriteTest - Classes\LabelTest @@ -867,6 +855,7 @@ Classes\Camera3DTest + @@ -1298,9 +1287,6 @@ Classes\FileUtilsTest - - Classes\ExtensionsTest\EditBoxTest - Classes\ExtensionsTest\CocosBuilderTest\TimelineCallbackTest @@ -1322,9 +1308,6 @@ Classes - - Classes\ExtensionsTest\Scale9SpriteTest - Classes\LabelTest @@ -1605,6 +1588,7 @@ Classes\Camera3DTest + From 73b201b702ac749188791ebb92c822843ff6436f Mon Sep 17 00:00:00 2001 From: "Huabing.Xu" Date: Fri, 5 Sep 2014 16:01:17 +0800 Subject: [PATCH 29/30] roll back, VBO_SIZE to 65536, INDEX_VBO_SIZE to 65536 * 1.5 --- cocos/renderer/CCRenderer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/renderer/CCRenderer.h b/cocos/renderer/CCRenderer.h index b02fe47184..35da31e076 100644 --- a/cocos/renderer/CCRenderer.h +++ b/cocos/renderer/CCRenderer.h @@ -76,8 +76,8 @@ Whenever possible prefer to use `QuadCommand` objects since the renderer will au class CC_DLL Renderer { public: - static const int VBO_SIZE = 8192; - static const int INDEX_VBO_SIZE = 8192 * 6 / 4; + static const int VBO_SIZE = 65536; + static const int INDEX_VBO_SIZE = VBO_SIZE * 6 / 4; static const int BATCH_QUADCOMMAND_RESEVER_SIZE = 64; From 33a4cd396dd9bfa3e9c428f91298e9d5db50d628 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Fri, 5 Sep 2014 14:32:14 -0700 Subject: [PATCH 30/30] Adds missing xcshared data for missing projects --- .../xcschemes/libcocos2d Mac.xcscheme | 77 +++++++++++++++++++ .../xcschemes/libcocos2d iOS.xcscheme | 77 +++++++++++++++++++ .../xcschemes/build all tests Mac.xcscheme | 4 +- .../xcschemes/libluacocos2d Mac.xcscheme | 77 +++++++++++++++++++ .../xcschemes/libluacocos2d iOS.xcscheme | 77 +++++++++++++++++++ 5 files changed, 310 insertions(+), 2 deletions(-) create mode 100644 build/cocos2d_libs.xcodeproj/xcshareddata/xcschemes/libcocos2d Mac.xcscheme create mode 100644 build/cocos2d_libs.xcodeproj/xcshareddata/xcschemes/libcocos2d iOS.xcscheme create mode 100644 cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/xcshareddata/xcschemes/libluacocos2d Mac.xcscheme create mode 100644 cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/xcshareddata/xcschemes/libluacocos2d iOS.xcscheme diff --git a/build/cocos2d_libs.xcodeproj/xcshareddata/xcschemes/libcocos2d Mac.xcscheme b/build/cocos2d_libs.xcodeproj/xcshareddata/xcschemes/libcocos2d Mac.xcscheme new file mode 100644 index 0000000000..644f4fba3f --- /dev/null +++ b/build/cocos2d_libs.xcodeproj/xcshareddata/xcschemes/libcocos2d Mac.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/cocos2d_libs.xcodeproj/xcshareddata/xcschemes/libcocos2d iOS.xcscheme b/build/cocos2d_libs.xcodeproj/xcshareddata/xcschemes/libcocos2d iOS.xcscheme new file mode 100644 index 0000000000..3f87120c62 --- /dev/null +++ b/build/cocos2d_libs.xcodeproj/xcshareddata/xcschemes/libcocos2d iOS.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/cocos2d_tests.xcodeproj/xcshareddata/xcschemes/build all tests Mac.xcscheme b/build/cocos2d_tests.xcodeproj/xcshareddata/xcschemes/build all tests Mac.xcscheme index 784723fab8..4242da5f8d 100644 --- a/build/cocos2d_tests.xcodeproj/xcshareddata/xcschemes/build all tests Mac.xcscheme +++ b/build/cocos2d_tests.xcodeproj/xcshareddata/xcschemes/build all tests Mac.xcscheme @@ -31,8 +31,8 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/xcshareddata/xcschemes/libluacocos2d iOS.xcscheme b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/xcshareddata/xcschemes/libluacocos2d iOS.xcscheme new file mode 100644 index 0000000000..92d78c231c --- /dev/null +++ b/cocos/scripting/lua-bindings/proj.ios_mac/cocos2d_lua_bindings.xcodeproj/xcshareddata/xcschemes/libluacocos2d iOS.xcscheme @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +