medfall

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

commit 52c1c0bd569b7bfb96ef3872958fb87704534c6e
parent ade431428c7da0f584c094ef9c06ab0c7bce7de6
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Mon Oct 31 23:12:17 +0200

Support normals/texcoords in renderer_new_mesh

Diffstat:
renderer.cc | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/renderer.cc b/renderer.cc @@ -197,15 +197,21 @@ Mesh renderer_new_mesh( MeshConfig config ) { glVertexAttribPointer( ATTR_POSITION, 3, GL_FLOAT, GL_FALSE, 0, 0 ); if( config.normals != 0 ) { - // TODO + glBindBuffer( GL_ARRAY_BUFFER, checked_cast< GLuint >( config.normals ) ); + glEnableVertexAttribArray( ATTR_NORMAL ); + glVertexAttribPointer( ATTR_NORMAL, 3, GL_FLOAT, GL_FALSE, 0, 0 ); } if( config.tex_coords0 != 0 ) { - // TODO + glBindBuffer( GL_ARRAY_BUFFER, checked_cast< GLuint >( config.tex_coords0 ) ); + glEnableVertexAttribArray( ATTR_TEX_COORD0 ); + glVertexAttribPointer( ATTR_TEX_COORD0, 2, GL_FLOAT, GL_FALSE, 0, 0 ); } if( config.tex_coords1 != 0 ) { - // TODO + glBindBuffer( GL_ARRAY_BUFFER, checked_cast< GLuint >( config.tex_coords1 ) ); + glEnableVertexAttribArray( ATTR_TEX_COORD1 ); + glVertexAttribPointer( ATTR_TEX_COORD1, 2, GL_FLOAT, GL_FALSE, 0, 0 ); } if( config.colours != 0 ) {