- // Padding
- 0.0f, 0.0f, 0.0f, 0.0f
- };
-
- glBindVertexArray( tile_vao );
- glBindBuffer( GL_ARRAY_BUFFER, tile_vbo );
- glBufferData
- (
- GL_ARRAY_BUFFER,
- sizeof( quad_mesh ),
- quad_mesh,
- GL_STATIC_DRAW
- );
-
- glVertexAttribPointer( 0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void*)0 );
- glEnableVertexAttribArray( 0 );
-
- VG_CHECK_GL();
-
- // Create map buffers
- glGenVertexArrays( 1, &map.tiles_vao );
- glGenBuffers( 1, &map.tiles_vbo );
-
- glBindVertexArray( map.tiles_vao );
- glBindBuffer( GL_ARRAY_BUFFER, map.tiles_vbo );
- glBufferData( GL_ARRAY_BUFFER,
- sizeof( quad_mesh ) +
- sizeof( float )*2 * 1024 +
- sizeof( u8 )*4 * 1024,
- NULL,
- GL_DYNAMIC_DRAW
- );
-
- glBufferSubData( GL_ARRAY_BUFFER, 0, sizeof( quad_mesh ), quad_mesh );
-
- // Base quad
- glVertexAttribPointer( 0, 2, GL_FLOAT, GL_FALSE, 2*sizeof(float), (void*)0 );
- glEnableVertexAttribArray( 0 );
-
- // Offset, data arrays (instancing)
- glVertexAttribPointer( 1, 2, GL_FLOAT, GL_FALSE, 2*sizeof(float), (void*)(sizeof(quad_mesh)) );
- glEnableVertexAttribArray( 1 );
- glVertexAttribDivisor( 1, 1 );
-
- glVertexAttribPointer( 2, 4, GL_UNSIGNED_BYTE, GL_FALSE, 4, (void*)(sizeof(quad_mesh)+sizeof(float)*2*1024) );
- glEnableVertexAttribArray( 2 );
- glVertexAttribDivisor( 2, 1 );
-
- map.tile_texture = vg_tex2d_rgba( "textures/rivertiles_flowm.tga" );
- vg_tex2d_nearest();
- vg_tex2d_repeat();
-
- map.flow_texture = vg_tex2d_rgba( "textures/rivertiles_ripple.tga" );
- vg_tex2d_nearest();
- vg_tex2d_repeat();
-
- map_load
- (
- "#####-#####;aa\n"
- "# #;\n"
- "# #;\n"
- "# -;bb\n"
- "# #;\n"
- "# #;\n"
- "#####+#####;abab\n"
- );
-}
-
-void vg_free(void)
-{
- map_free();
-
- glDeleteVertexArrays( 1, &tile_vao );
- glDeleteVertexArrays( 1, &map.tiles_vao );
-
- glDeleteBuffers( 1, &tile_vbo );
- glDeleteBuffers( 1, &map.tiles_vbo );
-
- glDeleteTextures( 1, &map.tile_texture );
- glDeleteTextures( 1, &map.flow_texture );
+ v4f dot_colour = { 0.0f, 0.0f, 0.0f, 1.0f };
+
+ for( int i = 0; i < world.num_fishes; i ++ )
+ {
+ struct fish *fish = &world.fishes[i];
+
+ if( !fish->alive )
+ continue;
+
+ colour_code_v3( fish->payload, dot_colour );
+ glUniform4fv( SHADER_UNIFORM( shader_tile_colour, "uColour" ), 1, dot_colour );
+
+ glUniform3f( SHADER_UNIFORM( shader_tile_colour, "uOffset" ), (float)fish->pos[0] + 0.5f - (float)fish->dir[0]*lerp, (float)fish->pos[1] + 0.25f - (float)fish->dir[1]*lerp, 0.25f );
+ draw_mesh( 0, 32 );
+ }
+ }