deprecated Mesh::create use less parameter ones instead

This commit is contained in:
yangxiao 2014-07-10 10:54:37 +08:00
parent ddb72228d3
commit ef1f6892e1
3 changed files with 12 additions and 9 deletions

View File

@ -125,7 +125,7 @@ bool RenderMeshData::init(const std::vector<float>& positions,
return true; return true;
} }
bool RenderMeshData::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount) bool RenderMeshData::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs)
{ {
_vertexs = vertices; _vertexs = vertices;
_indices = indices; _indices = indices;
@ -174,10 +174,10 @@ Mesh* Mesh::create(const std::vector<float>& positions, const std::vector<float>
return nullptr; return nullptr;
} }
Mesh* Mesh::create(const std::vector<float> &vertices, int vertexSizeInFloat, const std::vector<unsigned short> &indices, int numIndex, const std::vector<MeshVertexAttrib> &attribs, int attribCount) Mesh* Mesh::create(const std::vector<float> &vertices, int vertexSizeInFloat, const std::vector<unsigned short> &indices, const std::vector<MeshVertexAttrib> &attribs)
{ {
auto mesh = new Mesh(); auto mesh = new Mesh();
if (mesh && mesh->init(vertices, vertexSizeInFloat, indices, numIndex, attribs, attribCount)) if (mesh && mesh->init(vertices, vertexSizeInFloat, indices, attribs))
{ {
mesh->autorelease(); mesh->autorelease();
return mesh; return mesh;
@ -196,9 +196,9 @@ bool Mesh::init(const std::vector<float>& positions, const std::vector<float>& n
return true; return true;
} }
bool Mesh::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount) bool Mesh::init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs)
{ {
bool bRet = _renderdata.init(vertices, vertexSizeInFloat, indices, numIndex, attribs, attribCount); bool bRet = _renderdata.init(vertices, vertexSizeInFloat, indices, attribs);
if (!bRet) if (!bRet)
return false; return false;

View File

@ -49,7 +49,7 @@ public:
} }
bool hasVertexAttrib(int attrib); bool hasVertexAttrib(int attrib);
bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices); bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount); bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs);
protected: protected:
@ -90,7 +90,10 @@ public:
static Mesh* create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices); static Mesh* create(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
/**create mesh with vertex attributes*/ /**create mesh with vertex attributes*/
static Mesh* create(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount); CC_DEPRECATED_ATTRIBUTE static Mesh* create(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount) { return create(vertices, vertexSizeInFloat, indices, attribs); }
/**create mesh with vertex attributes*/
static Mesh* create(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs);
/**get vertex buffer*/ /**get vertex buffer*/
inline GLuint getVertexBuffer() const { return _vertexBuffer; } inline GLuint getVertexBuffer() const { return _vertexBuffer; }
@ -124,7 +127,7 @@ CC_CONSTRUCTOR_ACCESS:
bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices); bool init(const std::vector<float>& positions, const std::vector<float>& normals, const std::vector<float>& texs, const std::vector<unsigned short>& indices);
/**init mesh*/ /**init mesh*/
bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, int numIndex, const std::vector<MeshVertexAttrib>& attribs, int attribCount); bool init(const std::vector<float>& vertices, int vertexSizeInFloat, const std::vector<unsigned short>& indices, const std::vector<MeshVertexAttrib>& attribs);
/**build buffer*/ /**build buffer*/
void buildBuffer(); void buildBuffer();

View File

@ -193,7 +193,7 @@ bool Sprite3D::loadFromC3x(const std::string& path)
return false; 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); CC_SAFE_RETAIN(_mesh);
_skin = MeshSkin::create(fullPath, ""); _skin = MeshSkin::create(fullPath, "");