medfall

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 34a46c6b035b409687bc4cadd37453b927cbd46c
parent 504d206dbef27ec58e8f1a7dcecfa2c0e5e7145e
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Dec  4 11:11:05 +0200

Knock off some renderer TODOs

Diffstat:
renderer.cc | 20+++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/renderer.cc b/renderer.cc @@ -334,7 +334,23 @@ static GLvoid * offset_to_glvoidp( u32 offset ) { } Mesh renderer_new_mesh( MeshConfig config ) { - // TODO: assert num_vertices is sane for this primitive type + switch( config.primitive_type ) { + case PRIMITIVETYPE_TRIANGLES: + ASSERT( config.num_vertices % 3 == 0 ); + break; + + case PRIMITIVETYPE_TRIANGLE_STRIP: + ASSERT( config.num_vertices % 3 == 2 ); + break; + + case PRIMITIVETYPE_POINTS: + break; + + case PRIMITIVETYPE_LINES: + ASSERT( config.num_vertices % 2 == 0 ); + break; + } + GLuint vao; glGenVertexArrays( 1, &vao ); glBindVertexArray( vao ); @@ -518,8 +534,6 @@ void renderer_draw_mesh( const Mesh & mesh, RenderState state ) { glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); } - // TODO: missing a bunch of stuff here - GLenum primitive = primitivetype_to_glenum( mesh.primitive_type ); if( mesh.indices != 0 ) { glDrawElements( primitive, mesh.num_vertices, GL_UNSIGNED_INT, 0 );