Browse Source

move getMeshData function to internal

main
cinnaboot 5 years ago
parent
commit
2e0dd1ab5a
  1. 25
      src/shader.cpp

25
src/shader.cpp

@ -29,6 +29,7 @@ bool compileAndLinkShader(shader_program* shader,
u32 getGLTypeSize(GLenum e);
GLTexture* getFreeGLTexture(GLContext* gl_ctx);
bool loadGLTexture(util_image* image, GLuint& tex_id);
void* getMeshData(const mesh& m, const GLBufferToAttribMapping& mapping);
// NOTE: interface
@ -251,18 +252,6 @@ initGLAttribBuffer(gl_buffer* buf, GLenum target, GLVertexAttrib* attrib)
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
// going to use this, can void copying GLmesh twice that way
GLmesh
@ -331,6 +320,18 @@ freeGLMesh(GLmesh* glm)
// 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*
getFreeGLTexture(GLContext* gl_ctx)
{

Loading…
Cancel
Save