Skip to content

Commit 8b723e8

Browse files
committed
inc drawcall
1 parent 5d0b630 commit 8b723e8

File tree

4 files changed

+9
-22
lines changed

4 files changed

+9
-22
lines changed

cocos/3d/CCMesh.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,11 @@ class Mesh : public Ref
9999
void cleanAndFreeBuffers();
100100

101101
protected:
102-
std::string _name;
103-
GLuint _vertexBuffer;
104102
PrimitiveType _primitiveType;
105103
IndexFormat _indexFormat;
106-
unsigned int _indexCount;
104+
GLuint _vertexBuffer;
107105
GLuint _indexBuffer;
106+
unsigned int _indexCount;
108107

109108
private:
110109
RenderMeshData _renderdata;

cocos/3d/CCSprite3D.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ bool Sprite3D::initWithFile(const std::string &path)
152152
std::string ext = path.substr(path.length() - 4, 4);
153153
if (ext != ".obj" || !loadFromObj(path))
154154
{
155-
return false;
155+
return false;
156156
}
157157
return true;
158158
}
@@ -182,23 +182,6 @@ GLProgram* Sprite3D::getDefGLProgram(bool textured)
182182
{
183183
return GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_3D_POSITION);
184184
}
185-
// static GLProgram s_defGLProgramTex;
186-
// static GLProgram s_defGLProgram;
187-
// if(textured && s_defGLProgramTex.getProgram() == 0)
188-
// {
189-
// s_defGLProgramTex.initWithByteArrays(baseVertexShader, baseTexturedFrag);
190-
// s_defGLProgramTex.link();
191-
// s_defGLProgramTex.updateUniforms();
192-
// }
193-
//
194-
// if(!textured && s_defGLProgram.getProgram() == 0)
195-
// {
196-
// s_defGLProgram.initWithByteArrays(baseVertexShader, baseTexturedFrag);
197-
// s_defGLProgram.link();
198-
// s_defGLProgram.updateUniforms();
199-
// }
200-
//
201-
// return textured ? &s_defGLProgramTex : &s_defGLProgram;
202185
}
203186

204187

cocos/renderer/CCMeshCommand.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@
2222
THE SOFTWARE.
2323
****************************************************************************/
2424

25-
25+
#include "base/ccMacros.h"
26+
#include "base/CCDirector.h"
2627
#include "renderer/CCMeshCommand.h"
2728
#include "renderer/ccGLStateCache.h"
2829
#include "renderer/CCGLProgramState.h"
30+
#include "renderer/CCRenderer.h"
2931
#include "2d/CCTextureAtlas.h"
3032
#include "2d/CCTexture2D.h"
3133

@@ -141,6 +143,8 @@ void MeshCommand::execute()
141143
// Draw
142144
glDrawElements(_primitive, _indexCount, _indexFormat, 0);
143145

146+
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _indexCount);
147+
144148
//restore render state
145149
restoreRenderState();
146150
}

tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ void Effect3DOutline::drawWithSprite(EffectSprite3D* sprite, const Mat4 &transfo
372372
glDisable(GL_DEPTH_TEST);
373373
glCullFace(GL_BACK);
374374
glDisable(GL_CULL_FACE);
375+
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, mesh->getIndexCount());
375376
}
376377
}
377378

0 commit comments

Comments
 (0)