medfall

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

commit c756c6337b10d8042e0c4c239cc311f2857d18b0
parent 6ca0fb3ca2d77c9221a0ebb6cdfd506d91c0a5bc
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sat Sep 10 18:07:18 -0700

Remove Heightmap::render. Terrain manager changes not included

Diffstat:
heightmap.cc | 16++--------------
heightmap.h | 17+++--------------
mod_btt.cc | 3+--
3 files changed, 6 insertions(+), 30 deletions(-)
diff --git a/heightmap.cc b/heightmap.cc @@ -41,22 +41,15 @@ static glm::vec3 triangle_perp_ccw( const glm::vec3 & a, const glm::vec3 & b, co return glm::cross( b - a, c - a ); } -void heightmap_init( - Heightmap * const hm, MemoryArena * const arena, - u8 * const pixels, const u32 width, const u32 height, - const float ox, const float oy, - const GLint at_pos, const GLint at_normal, const GLint at_lit -) { +void heightmap_init( Heightmap * hm, u8 * pixels, u32 width, u32 height ) { hm->pixels = pixels; hm->width = width; hm->height = height; } void heightmap_destroy( Heightmap * const hm ) { - if( hm->vbo_verts != 0 ) { + if( hm->pixels != NULL ) { free( hm->pixels ); - - hm->vbo_verts = 0; } } @@ -144,10 +137,5 @@ float Heightmap::bilerp_height( const float x, const float y ) const { ); } -void Heightmap::render() const { - if( vbo_verts == 0 ) return; - glBindVertexArray( vao ); - glDrawElements( GL_TRIANGLES, width * height * 6, GL_UNSIGNED_INT, 0 ); - glBindVertexArray( 0 ); } diff --git a/heightmap.h b/heightmap.h @@ -11,21 +11,13 @@ class Heightmap { public: - u8 * pixels; + u8 * pixels = NULL; u32 width, height; - GLuint vbo_verts = 0; - GLuint vbo_normals; - GLuint vbo_lit; - GLuint ebo; - GLuint vao; - glm::vec3 point( u32 x, u32 y ) const; glm::vec3 point_normal( u32 x, u32 y ) const; float bilerp_height( const float x, const float y ) const; - - void render() const; }; struct OffsetHeightmap { @@ -33,11 +25,8 @@ struct OffsetHeightmap { float x_offset, y_offset; }; -void heightmap_init( Heightmap * const hm, MemoryArena * const arena, - u8 * const pixels, const u32 width, const u32 height, - const float ox, const float oy, // TODO: take rendering out of Heightmap - const GLint at_pos, const GLint at_normal, const GLint at_lit ); +void heightmap_init( Heightmap * hm, u8 * pixels, u32 width, u32 height ); +void heightmap_destroy( Heightmap * hm ); -void heightmap_destroy( Heightmap * const hm ); #endif // _HEIGHTMAP_H_ diff --git a/mod_btt.cc b/mod_btt.cc @@ -150,8 +150,7 @@ extern "C" GAME_INIT( game_init ) { int w, h; u8 * pixels = stbi_load( "terrains/mountains512.png", &w, &h, NULL, 1 ); - heightmap_init( &state->hm, &mem->persistent_arena, pixels, w, h, 0, 0, - state->test_at_position, state->test_at_normal, state->test_at_lit ); + heightmap_init( &state->hm, pixels, w, h ); state->btt = btt_from_heightmap( &state->hm, &mem->persistent_arena );