123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- #ifndef __CCMESHVERTEXINDEXDATA_H__
- #define __CCMESHVERTEXINDEXDATA_H__
- #include <string>
- #include <vector>
- #include "3d/CCBundle3DData.h"
- #include "3d/CCAABB.h"
- #include "base/CCRef.h"
- #include "base/CCVector.h"
- #include "math/CCMath.h"
- #include "renderer/CCGLProgram.h"
- #include "renderer/CCVertexIndexData.h"
- #include "renderer/CCVertexIndexBuffer.h"
- NS_CC_BEGIN
- class MeshVertexData;
- class CC_DLL MeshIndexData : public Ref
- {
- public:
-
- static MeshIndexData* create(const std::string& id, MeshVertexData* vertexData, IndexBuffer* indexbuffer, const AABB& aabb);
-
-
- const IndexBuffer* getIndexBuffer() const { return _indexBuffer; }
-
- const VertexBuffer* getVertexBuffer() const;
-
-
- const MeshVertexData* getMeshVertexData() const { return _vertexData; }
-
-
- void setAABB(const AABB& aabb) { _aabb = aabb; }
- const AABB& getAABB() const { return _aabb; }
-
-
- void setId(const std::string& id) { _id = id; }
- const std::string& getId() const { return _id; }
-
-
- GLenum getPrimitiveType() const { return _primitiveType; }
- void setPrimitiveType(GLenum primitive) { _primitiveType = primitive; }
-
- CC_CONSTRUCTOR_ACCESS:
- MeshIndexData();
- virtual ~MeshIndexData();
-
- protected:
- IndexBuffer* _indexBuffer;
- MeshVertexData* _vertexData;
- AABB _aabb;
- std::string _id;
- GLenum _primitiveType;
-
- friend class MeshVertexData;
- friend class Sprite3D;
- };
- class CC_DLL MeshVertexData : public Ref
- {
- friend class Sprite3D;
- friend class Mesh;
- public:
-
- static MeshVertexData* create(const MeshData& meshdata);
-
-
- const VertexBuffer* getVertexBuffer() const { return _vertexBuffer; }
-
-
- ssize_t getMeshVertexAttribCount() const { return _attribs.size(); }
-
-
- const MeshVertexAttrib& getMeshVertexAttrib(ssize_t index) const { return _attribs[index]; }
-
-
- ssize_t getMeshIndexDataCount() const { return _indexs.size(); }
-
- MeshIndexData* getMeshIndexDataByIndex(int index) const { return _indexs.at(index); }
-
- MeshIndexData* getMeshIndexDataById(const std::string& id) const;
-
-
- bool hasVertexAttrib(int attrib) const;
-
- CC_CONSTRUCTOR_ACCESS:
- MeshVertexData();
- virtual ~MeshVertexData();
- protected:
- VertexData* _vertexData;
- VertexBuffer* _vertexBuffer;
- Vector<MeshIndexData*> _indexs;
- std::vector<MeshVertexAttrib> _attribs;
-
- int _vertexCount;
- };
- NS_CC_END
- #endif
|