commit 4df44445551274e9964715916e9128c903bc6b82 parent 0b62e6e88f05f743a0482dbe03eabf0f82f60626 Author: Michael Savage <mikejsavage@gmail.com> Date: Wed Oct 12 22:59:52 +0300 Const madness Diffstat:
btt.cc | | | 28 | ++++++++++++++-------------- |
diff --git a/btt.cc b/btt.cc @@ -17,7 +17,7 @@ * hypotenuse */ -static void btt_link_diamond( MemoryArena * const arena, BTT * const node ) { +static void btt_link_diamond( MemoryArena * arena, BTT * node ) { node->left = memarena_push_type( arena, BTT ); node->right = memarena_push_type( arena, BTT ); @@ -31,21 +31,21 @@ static void btt_link_diamond( MemoryArena * const arena, BTT * const node ) { node->right->bottom = node->right_sibling; if( node->left_sibling ) { - BTT * const ls = node->left_sibling; + BTT * ls = node->left_sibling; if( ls->left_sibling == node ) ls->left_sibling = node->left; if( ls->right_sibling == node ) ls->right_sibling = node->left; if( ls->bottom == node ) ls->bottom = node->left; } if( node->right_sibling ) { - BTT * const rs = node->right_sibling; + BTT * rs = node->right_sibling; if( rs->left_sibling == node ) rs->left_sibling = node->right; if( rs->right_sibling == node ) rs->right_sibling = node->right; if( rs->bottom == node ) rs->bottom = node->right; } } -static void btt_split( MemoryArena * const arena, BTT * const node ) { +static void btt_split( MemoryArena * arena, BTT * node ) { assert( node ); assert( !node->left && !node->right ); @@ -66,15 +66,15 @@ static void btt_split( MemoryArena * const arena, BTT * const node ) { } } -static int square_distance( const glm::ivec2 u, const glm::ivec2 v ) { - const glm::ivec2 d = v - u; +static int square_distance( glm::ivec2 u, glm::ivec2 v ) { + glm::ivec2 d = v - u; return d.x * d.x + d.y * d.y; } static bool btt_should_split( - const Heightmap * const hm, - const glm::ivec2 v0, const glm::ivec2 v1, const glm::ivec2 v2, - const glm::ivec2 mid + const Heightmap * hm, + glm::ivec2 v0, glm::ivec2 v1, glm::ivec2 v2, + glm::ivec2 mid ) { if( square_distance( v0, v2 ) <= 4 ) return false; @@ -87,11 +87,11 @@ static bool btt_should_split( } static void btt_build( - const Heightmap * const hm, MemoryArena * const arena, - BTT * const node, - const glm::ivec2 v0, const glm::ivec2 v1, const glm::ivec2 v2 + const Heightmap * hm, MemoryArena * arena, + BTT * node, + glm::ivec2 v0, glm::ivec2 v1, glm::ivec2 v2 ) { - const glm::ivec2 mid = ( v0 + v2 ) / 2; + glm::ivec2 mid = ( v0 + v2 ) / 2; if( !node->left ) { assert( !node->right ); @@ -109,7 +109,7 @@ static void btt_build( } } -BTTs btt_from_heightmap( const Heightmap * const hm, MemoryArena * const arena ) { +BTTs btt_from_heightmap( const Heightmap * hm, MemoryArena * arena ) { BTTs roots; roots.left_root = memarena_push_type( arena, BTT );