123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- #ifndef CC_VERTEXATTRIBUTEBINDING_H_
- #define CC_VERTEXATTRIBUTEBINDING_H_
- #include <unordered_map>
- #include "base/CCRef.h"
- #include "renderer/CCGLProgramState.h"
- NS_CC_BEGIN
- class MeshIndexData;
- class VertexAttribValue;
- class CC_DLL VertexAttribBinding : public Ref
- {
- public:
-
- static VertexAttribBinding* create(MeshIndexData* meshIndexData, GLProgramState* glProgramState);
-
- void bind();
-
- void unbind();
-
- uint32_t getVertexAttribsFlags() const;
- private:
- bool init(MeshIndexData* meshIndexData, GLProgramState* glProgramState);
-
- VertexAttribBinding();
-
- ~VertexAttribBinding();
-
- VertexAttribBinding& operator=(const VertexAttribBinding&);
- void setVertexAttribPointer(const std::string& name, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLvoid* pointer);
- VertexAttribValue* getVertexAttribValue(const std::string &name);
- void parseAttributes();
- GLuint _handle;
- MeshIndexData* _meshIndexData;
- GLProgramState* _glProgramState;
- std::unordered_map<std::string, VertexAttribValue> _attributes;
- uint32_t _vertexAttribsFlags;
- };
- extern std::string CC_DLL s_attributeNames[];
- NS_CC_END
- #endif
|