|
|
|
@ -29,6 +29,7 @@ bool compileAndLinkShader(shader_program* shader, |
|
|
|
u32 getGLTypeSize(GLenum e); |
|
|
|
u32 getGLTypeSize(GLenum e); |
|
|
|
GLTexture* getFreeGLTexture(GLContext* gl_ctx); |
|
|
|
GLTexture* getFreeGLTexture(GLContext* gl_ctx); |
|
|
|
bool loadGLTexture(util_image* image, GLuint& tex_id); |
|
|
|
bool loadGLTexture(util_image* image, GLuint& tex_id); |
|
|
|
|
|
|
|
void* getMeshData(const mesh& m, const GLBufferToAttribMapping& mapping); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: interface
|
|
|
|
// NOTE: interface
|
|
|
|
@ -251,18 +252,6 @@ initGLAttribBuffer(gl_buffer* buf, GLenum target, GLVertexAttrib* attrib) |
|
|
|
buf->name = utilAllocateCStr(attrib->name); |
|
|
|
buf->name = utilAllocateCStr(attrib->name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void* |
|
|
|
|
|
|
|
getMeshData(const mesh& m, const GLBufferToAttribMapping& mapping) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
switch (mapping.buf_type) { |
|
|
|
|
|
|
|
case VERTEX: return m.vertices; |
|
|
|
|
|
|
|
case NORMAL: return m.normals; |
|
|
|
|
|
|
|
case UV: return m.uvs; |
|
|
|
|
|
|
|
case COLOR: return m.colors; |
|
|
|
|
|
|
|
default: return nullptr; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: might as well pass in pointer to GLmesh, since that's how we're
|
|
|
|
// FIXME: might as well pass in pointer to GLmesh, since that's how we're
|
|
|
|
// going to use this, can void copying GLmesh twice that way
|
|
|
|
// going to use this, can void copying GLmesh twice that way
|
|
|
|
GLmesh |
|
|
|
GLmesh |
|
|
|
@ -331,6 +320,18 @@ freeGLMesh(GLmesh* glm) |
|
|
|
|
|
|
|
|
|
|
|
// NOTE: internal
|
|
|
|
// NOTE: internal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void* |
|
|
|
|
|
|
|
getMeshData(const mesh& m, const GLBufferToAttribMapping& mapping) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
switch (mapping.buf_type) { |
|
|
|
|
|
|
|
case VERTEX: return m.vertices; |
|
|
|
|
|
|
|
case NORMAL: return m.normals; |
|
|
|
|
|
|
|
case UV: return m.uvs; |
|
|
|
|
|
|
|
case COLOR: return m.colors; |
|
|
|
|
|
|
|
default: return nullptr; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
GLTexture* |
|
|
|
GLTexture* |
|
|
|
getFreeGLTexture(GLContext* gl_ctx) |
|
|
|
getFreeGLTexture(GLContext* gl_ctx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|