|
|
|
|
@ -465,6 +465,17 @@ parseUniformBlocks(memory_arena* arena, shader_program* s, GLContext* gl_ctx)
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
u32 |
|
|
|
|
getNumAttribComponents(GLenum type) |
|
|
|
|
{ |
|
|
|
|
switch (type) { |
|
|
|
|
case GL_FLOAT_VEC3: return 3; |
|
|
|
|
default: |
|
|
|
|
printf("%s(), unknown GLenum\n", __FUNCTION__); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool |
|
|
|
|
parseAttributes(memory_arena* arena, shader_program* s, GLContext* gl_ctx) |
|
|
|
|
{ |
|
|
|
|
@ -494,7 +505,8 @@ parseAttributes(memory_arena* arena, shader_program* s, GLContext* gl_ctx)
|
|
|
|
|
GLVertexAttrib* attrib = &s->vertex_attribs[i]; |
|
|
|
|
attrib->data_type = type; |
|
|
|
|
attrib->location = location; |
|
|
|
|
// FIXME: need a helper for attrib->num_components
|
|
|
|
|
attrib->num_components = getNumAttribComponents(type); |
|
|
|
|
assert(attrib->num_components > 0); |
|
|
|
|
attrib->name = arenaCopyCStr(arena, attrib_name, sizeof(attrib_name)); |
|
|
|
|
// TODO: replace POSITION, NORMAL, UV... etc enums in loadGLMesh()
|
|
|
|
|
// with extra logic to detect mesh to shader mapping
|
|
|
|
|
|