committing in a broken state, we got problems with the far pointers. Acting as absolute when should be relative
This commit is contained in:
@@ -150,20 +150,20 @@ inline std::string read_file(std::string file_name){
|
|||||||
|
|
||||||
inline void PrettyPrintUINT64(uint64_t i, std::stringstream* ss) {
|
inline void PrettyPrintUINT64(uint64_t i, std::stringstream* ss) {
|
||||||
|
|
||||||
//*ss << "[" << std::bitset<15>(i) << "]";
|
*ss << "[" << std::bitset<15>(i) << "]";
|
||||||
//*ss << "[" << std::bitset<1>(i >> 15) << "]";
|
*ss << "[" << std::bitset<1>(i >> 15) << "]";
|
||||||
//*ss << "[" << std::bitset<8>(i >> 16) << "]";
|
*ss << "[" << std::bitset<8>(i >> 16) << "]";
|
||||||
//*ss << "[" << std::bitset<8>(i >> 24) << "]";
|
*ss << "[" << std::bitset<8>(i >> 24) << "]";
|
||||||
//*ss << "[" << std::bitset<32>(i >> 32) << "]\n";
|
*ss << "[" << std::bitset<32>(i >> 32) << "]\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void PrettyPrintUINT64(uint64_t i) {
|
inline void PrettyPrintUINT64(uint64_t i) {
|
||||||
|
|
||||||
//std::cout << "[" << std::bitset<15>(i) << "]";
|
std::cout << "[" << std::bitset<15>(i) << "]";
|
||||||
//std::cout << "[" << std::bitset<1>(i >> 15) << "]";
|
std::cout << "[" << std::bitset<1>(i >> 15) << "]";
|
||||||
//std::cout << "[" << std::bitset<8>(i >> 16) << "]";
|
std::cout << "[" << std::bitset<8>(i >> 16) << "]";
|
||||||
//std::cout << "[" << std::bitset<8>(i >> 24) << "]";
|
std::cout << "[" << std::bitset<8>(i >> 24) << "]";
|
||||||
//std::cout << "[" << std::bitset<32>(i >> 32) << "]" << std::endl;
|
std::cout << "[" << std::bitset<32>(i >> 32) << "]" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void DumpLog(std::stringstream* ss, std::string file_name) {
|
inline void DumpLog(std::stringstream* ss, std::string file_name) {
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ bool get_oct_vox(
|
|||||||
parent_stack[parent_stack_position] = head;
|
parent_stack[parent_stack_position] = head;
|
||||||
|
|
||||||
// Set our initial dimension and the position at the corner of the oct to keep track of our position
|
// Set our initial dimension and the position at the corner of the oct to keep track of our position
|
||||||
int dimension = 64;
|
int dimension = 128;
|
||||||
int3 quad_position = zeroed_int3;
|
int3 quad_position = zeroed_int3;
|
||||||
|
|
||||||
// While we are not at the required resolution
|
// While we are not at the required resolution
|
||||||
@@ -192,9 +192,16 @@ bool get_oct_vox(
|
|||||||
// Negate it by one as it counts itself
|
// Negate it by one as it counts itself
|
||||||
int count = popcount((uchar)(head >> 16) & count_mask_8[mask_index]) - 1;
|
int count = popcount((uchar)(head >> 16) & count_mask_8[mask_index]) - 1;
|
||||||
|
|
||||||
|
//bool jumping = false;
|
||||||
|
//if (far_bit_mask & descriptor_buffer[current_index])
|
||||||
|
// jumping = true;
|
||||||
// access the element at which head points to and then add the specified number of indices
|
// access the element at which head points to and then add the specified number of indices
|
||||||
// to get to the correct child descriptor
|
// to get to the correct child descriptor
|
||||||
current_index = current_index + (head & child_pointer_mask) + count;
|
current_index = current_index + (head & child_pointer_mask) + count;
|
||||||
|
|
||||||
|
//if (jumping == true)
|
||||||
|
// current_index = descriptor_buffer[current_index];
|
||||||
|
|
||||||
head = octree_descriptor_buffer[current_index];
|
head = octree_descriptor_buffer[current_index];
|
||||||
|
|
||||||
// Increment the parent stack position and put the new oct node as the parent
|
// Increment the parent stack position and put the new oct node as the parent
|
||||||
@@ -316,8 +323,10 @@ __kernel void raycaster(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constant int vox_dim = 128;
|
||||||
|
|
||||||
// If we hit a voxel
|
// If we hit a voxel
|
||||||
if (voxel.x < 64 && voxel.y < 64 && voxel.z < 64){
|
if (voxel.x < vox_dim && voxel.y < vox_dim && voxel.z < vox_dim){
|
||||||
if (get_oct_vox(
|
if (get_oct_vox(
|
||||||
voxel,
|
voxel,
|
||||||
octree_descriptor_buffer,
|
octree_descriptor_buffer,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ bool Application::init_clcaster() {
|
|||||||
|
|
||||||
// Init the raycaster with a specified dimension and a pointer to the source
|
// Init the raycaster with a specified dimension and a pointer to the source
|
||||||
// array style data
|
// array style data
|
||||||
octree = std::make_shared<Map>(64, map.get());
|
octree = std::make_shared<Map>(128, map.get());
|
||||||
raycaster->assign_octree(octree);
|
raycaster->assign_octree(octree);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,15 @@ OctState Octree::GetVoxel(sf::Vector3i position) {
|
|||||||
|
|
||||||
// access the element at which head points to and then add the specified number of indices
|
// access the element at which head points to and then add the specified number of indices
|
||||||
// to get to the correct child descriptor
|
// to get to the correct child descriptor
|
||||||
current_index = current_index + (head & child_pointer_mask) + count;
|
bool jumping = false;
|
||||||
|
if (far_bit_mask & descriptor_buffer[current_index])
|
||||||
|
jumping = true;
|
||||||
|
|
||||||
|
current_index = current_index + (head & child_pointer_mask) + count;
|
||||||
|
|
||||||
|
if (jumping == true)
|
||||||
|
current_index = descriptor_buffer[current_index];
|
||||||
|
|
||||||
head = descriptor_buffer[current_index];
|
head = descriptor_buffer[current_index];
|
||||||
|
|
||||||
// Increment the parent stack position and put the new oct node as the parent
|
// Increment the parent stack position and put the new oct node as the parent
|
||||||
@@ -205,6 +213,7 @@ std::tuple<uint64_t, uint64_t> Octree::GenerationRecursion(char* data, sf::Vecto
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Array of <descriptors, position>
|
||||||
std::vector<std::tuple<uint64_t, uint64_t>> descriptor_position_array;
|
std::vector<std::tuple<uint64_t, uint64_t>> descriptor_position_array;
|
||||||
|
|
||||||
// Generate down the recursion, returning the descriptor of the current node
|
// Generate down the recursion, returning the descriptor of the current node
|
||||||
@@ -255,6 +264,10 @@ std::tuple<uint64_t, uint64_t> Octree::GenerationRecursion(char* data, sf::Vecto
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < descriptor_position_array.size(); i++) {
|
||||||
|
std::get<1>(descriptor_position_array.at(i)) = descriptor_buffer_position - i;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int far_pointer_count = 0;
|
unsigned int far_pointer_count = 0;
|
||||||
uint64_t far_pointer_block_position = descriptor_buffer_position;
|
uint64_t far_pointer_block_position = descriptor_buffer_position;
|
||||||
|
|
||||||
@@ -263,7 +276,6 @@ std::tuple<uint64_t, uint64_t> Octree::GenerationRecursion(char* data, sf::Vecto
|
|||||||
|
|
||||||
// this is not the actual relative distance write, so we pessimistically guess that we will have
|
// this is not the actual relative distance write, so we pessimistically guess that we will have
|
||||||
// the worst relative distance via the insertion size
|
// the worst relative distance via the insertion size
|
||||||
|
|
||||||
int relative_distance = std::get<1>(descriptor_position_array.at(i)) - (descriptor_buffer_position - worst_case_insertion_size);
|
int relative_distance = std::get<1>(descriptor_position_array.at(i)) - (descriptor_buffer_position - worst_case_insertion_size);
|
||||||
|
|
||||||
// check to see if we tripped the far pointer
|
// check to see if we tripped the far pointer
|
||||||
|
|||||||
Reference in New Issue
Block a user