@ -55,7 +55,7 @@ Map::Map(sf::Vector3i position) {
load_unload ( position ) ;
for ( int i = 0 ; i < 8192 ; i + + ) {
for ( int i = 0 ; i < 1024 ; i + + ) {
block [ i ] = 0 ;
}
}
@ -130,25 +130,27 @@ int64_t Map::generate_children(sf::Vector3i pos, int dim) {
std : : vector < int64_t > cps ;
int64_t tmp = 0 ;
int64_t ret_pos = stack_position ;
if ( dim = = 1 ) {
// These don't bound check, should they?
if ( getVoxel ( t1 ) )
SetBit ( 16 , & tmp ) ;
if ( getVoxel ( t2 ) )
SetBit ( 1 6 , & tmp ) ;
SetBit ( 1 7 , & tmp ) ;
if ( getVoxel ( t3 ) )
SetBit ( 1 6 , & tmp ) ;
SetBit ( 1 8 , & tmp ) ;
if ( getVoxel ( t4 ) )
SetBit ( 1 6 , & tmp ) ;
SetBit ( 1 9 , & tmp ) ;
if ( getVoxel ( t5 ) )
SetBit ( 16 , & tmp ) ;
SetBit ( 20 , & tmp ) ;
if ( getVoxel ( t6 ) )
SetBit ( 16 , & tmp ) ;
SetBit ( 2 1, & tmp ) ;
if ( getVoxel ( t7 ) )
SetBit ( 16 , & tmp ) ;
SetBit ( 22 , & tmp ) ;
if ( getVoxel ( t8 ) )
SetBit ( 16 , & tmp ) ;
SetBit ( 23 , & tmp ) ;
cps . push_back ( tmp ) ;
@ -159,7 +161,6 @@ int64_t Map::generate_children(sf::Vector3i pos, int dim) {
int curr_stack_pos = stack_position ;
tmp = generate_children ( t1 , dim / 2 ) ;
if ( tmp ! = 0 )
cps . push_back ( tmp ) ;
@ -208,6 +209,8 @@ void Map::generate_octree() {
arr [ i ] = 0 ;
}
generate_children ( sf : : Vector3i ( 0 , 0 , 0 ) , 64 ) ;
int * dataset = new int [ 32 * 32 * 32 ] ;
for ( int i = 0 ; i < 32 * 32 * 32 ; i + + ) {
dataset [ 0 ] = rand ( ) % 2 ;