ULRE/inc/hgl/graph/VertexArray.h

54 lines
2.2 KiB
C
Raw Normal View History

#ifndef HGL_GRAPH_VERTEX_ARRAY_INCLUDE
#define HGL_GRAPH_VERTEX_ARRAY_INCLUDE
#include<hgl/type/List.h>
#include<hgl/graph/BufferObject.h>
#include<hgl/graph/PixelCompoment.h>
namespace hgl
{
namespace graph
{
/**
*
*/
class VertexArray
{
protected:
GLuint vao;
2018-12-05 21:58:03 +08:00
ObjectList<VertexBufferObject> vbo_list; ///<顶点数据缓冲区
ElementBufferObject *element_buffer;
VertexBufferObject *position_buffer;
int position_compoment; ///<位置属性格式
public:
VertexArray(uint max_vertex_attrib);
2018-12-05 21:58:03 +08:00
~VertexArray();
static int GetMaxVertexAttrib();
const GLuint GetVAO ()const{return vao;} ///<取得VAO对象
public: //通用顶点缓冲区设置
int AddBuffer (int shader_location,VertexBufferObject *); ///<设置顶点缓冲区对象
VertexBufferObject *GetBuffer (int index){return vbo_list[index];} ///<取得顶点缓冲区对象
bool ClearBuffer (int index){return vbo_list.Delete(index);} ///<清除顶点缓冲区对象
void ClearBuffers(){ vbo_list.Clear();} ///<清除所有顶点缓冲区对象
2018-11-30 19:36:07 +08:00
public: //特殊缓冲区独立设置函数
bool SetElement (ElementBufferObject *eb); ///<设置索引缓冲区对象
bool SetPosition (int shader_location,VertexBufferObject *vb); ///<设置位置缓冲区对象
ElementBufferObject * GetElement (){return element_buffer;} ///<获取索引缓冲区对象
VertexBufferObject * GetPosition (){return position_buffer;} ///<获取位置缓冲区对象
};//class VertexArray
}//namespace graph
}//namespace hgl
#endif//HGL_GRAPH_VERTEX_ARRAY_INCLUDE