From ef1f6892e180b8a123e696ae10ec7781faea3467 Mon Sep 17 00:00:00 2001 From: yangxiao Date: Thu, 10 Jul 2014 10:54:37 +0800 Subject: [PATCH] deprecated Mesh::create use less parameter ones instead --- cocos/3d/CCMesh.cpp | 10 +++++----- cocos/3d/CCMesh.h | 9 ++++++--- cocos/3d/CCSprite3D.cpp | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cocos/3d/CCMesh.cpp b/cocos/3d/CCMesh.cpp index ddfe7d21f3..c499f00d93 100644 --- a/cocos/3d/CCMesh.cpp +++ b/cocos/3d/CCMesh.cpp @@ -125,7 +125,7 @@ bool RenderMeshData::init(const std::vector& positions, return true; } -bool RenderMeshData::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount) +bool RenderMeshData::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs) { _vertexs = vertices; _indices = indices; @@ -174,10 +174,10 @@ Mesh* Mesh::create(const std::vector& positions, const std::vector return nullptr; } -Mesh* Mesh::create(const std::vector &vertices, int vertexSizeInFloat, const std::vector &indices, int numIndex, const std::vector &attribs, int attribCount) +Mesh* Mesh::create(const std::vector &vertices, int vertexSizeInFloat, const std::vector &indices, const std::vector &attribs) { auto mesh = new Mesh(); - if (mesh && mesh->init(vertices, vertexSizeInFloat, indices, numIndex, attribs, attribCount)) + if (mesh && mesh->init(vertices, vertexSizeInFloat, indices, attribs)) { mesh->autorelease(); return mesh; @@ -196,9 +196,9 @@ bool Mesh::init(const std::vector& positions, const std::vector& n return true; } -bool Mesh::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount) +bool Mesh::init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs) { - bool bRet = _renderdata.init(vertices, vertexSizeInFloat, indices, numIndex, attribs, attribCount); + bool bRet = _renderdata.init(vertices, vertexSizeInFloat, indices, attribs); if (!bRet) return false; diff --git a/cocos/3d/CCMesh.h b/cocos/3d/CCMesh.h index 176e802105..51deec7242 100644 --- a/cocos/3d/CCMesh.h +++ b/cocos/3d/CCMesh.h @@ -49,7 +49,7 @@ public: } bool hasVertexAttrib(int attrib); bool init(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); - bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount); + bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs); protected: @@ -90,7 +90,10 @@ public: static Mesh* create(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); /**create mesh with vertex attributes*/ - static Mesh* create(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount); + CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount) { return create(vertices, vertexSizeInFloat, indices, attribs); } + + /**create mesh with vertex attributes*/ + static Mesh* create(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs); /**get vertex buffer*/ inline GLuint getVertexBuffer() const { return _vertexBuffer; } @@ -124,7 +127,7 @@ CC_CONSTRUCTOR_ACCESS: bool init(const std::vector& positions, const std::vector& normals, const std::vector& texs, const std::vector& indices); /**init mesh*/ - bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, int numIndex, const std::vector& attribs, int attribCount); + bool init(const std::vector& vertices, int vertexSizeInFloat, const std::vector& indices, const std::vector& attribs); /**build buffer*/ void buildBuffer(); diff --git a/cocos/3d/CCSprite3D.cpp b/cocos/3d/CCSprite3D.cpp index 30cfca2552..a1244d2efb 100644 --- a/cocos/3d/CCSprite3D.cpp +++ b/cocos/3d/CCSprite3D.cpp @@ -193,7 +193,7 @@ bool Sprite3D::loadFromC3x(const std::string& path) return false; } - _mesh = Mesh::create(meshdata.vertex, meshdata.vertexSizeInFloat, meshdata.indices, meshdata.numIndex, meshdata.attribs, meshdata.attribCount); + _mesh = Mesh::create(meshdata.vertex, meshdata.vertexSizeInFloat, meshdata.indices, meshdata.attribs); CC_SAFE_RETAIN(_mesh); _skin = MeshSkin::create(fullPath, "");