|
|
|
|
@ -90,6 +90,7 @@ roDraw(render_objects* r_objs,
|
|
|
|
|
light_group* lights) |
|
|
|
|
{ |
|
|
|
|
assert(r_objs->mesh_type == DEFAULT_MESHES); |
|
|
|
|
// FIXME: might as well move this function now that we only have one path
|
|
|
|
|
drawDefault(r_objs, world_transform, cam, sw, lights); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -159,10 +160,16 @@ loadMeshIntoGL(default_render_object* ro_out, mesh* mesh_in)
|
|
|
|
|
GL_ELEMENT_ARRAY_BUFFER) |
|
|
|
|
// FIXME: re-implement diffuse texture, but with index into an array
|
|
|
|
|
// on render_state
|
|
|
|
|
//&& initGLTexture(mesh_in->diffuse_texture, ro_out->tex_id))
|
|
|
|
|
#if 0 |
|
|
|
|
&& initGLTexture(mesh_in->diffuse_texture, ro_out->tex_id)) |
|
|
|
|
#endif |
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
// FIXME: node xform
|
|
|
|
|
ro_out->node_xform = glm::mat4(1); |
|
|
|
|
#if 0 |
|
|
|
|
ro_out->node_xform = *mesh_in->xform; |
|
|
|
|
#endif |
|
|
|
|
ro_out->index_buffer_count = mesh_in->num_indices; |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
@ -203,7 +210,10 @@ drawDefault(render_objects* r_objs,
|
|
|
|
|
default_render_object* objects = r_objs->objects; |
|
|
|
|
glUseProgram(shader->program_id); |
|
|
|
|
updateMatrices(shader, cam, world_transform, objects->node_xform); |
|
|
|
|
// FIXME: re-enable lights
|
|
|
|
|
#if 0 |
|
|
|
|
if (lights->needs_update) lightsUpdate(lights, shader); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
for (uint i = 0; i < r_objs->count; i++) { |
|
|
|
|
enableGLFloatBuffer(objects[i].vertex_buffer_id, 0); |
|
|
|
|
@ -211,14 +221,24 @@ drawDefault(render_objects* r_objs,
|
|
|
|
|
// TODO: could pass in a stride parameter here to enableGLFloatBuffer()
|
|
|
|
|
// could then use a 2d buffer for uv coords
|
|
|
|
|
enableGLFloatBuffer(objects[i].uv_buffer_id, 2); |
|
|
|
|
// FIXME: re-enable textures
|
|
|
|
|
#if 0 |
|
|
|
|
glBindTexture(GL_TEXTURE_2D, objects[i].tex_id); |
|
|
|
|
glUniform1i(shader->sampler_id, 0); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, objects[i].index_buffer_id); |
|
|
|
|
// FIXME: tinygltf uses unsigned short as index type
|
|
|
|
|
#if 0 |
|
|
|
|
glDrawElements(GL_TRIANGLES, |
|
|
|
|
objects[i].index_buffer_count, |
|
|
|
|
GL_UNSIGNED_INT, |
|
|
|
|
0); |
|
|
|
|
#endif |
|
|
|
|
glDrawElements(GL_TRIANGLES, |
|
|
|
|
objects[i].index_buffer_count, |
|
|
|
|
GL_UNSIGNED_SHORT, |
|
|
|
|
0); |
|
|
|
|
|
|
|
|
|
glDisableVertexAttribArray(0); |
|
|
|
|
glDisableVertexAttribArray(1); |
|
|
|
|
|