Octree works out to 128x128 as is, and performance seems very promising. Traversal or octree generation fixes will be next

master
MitchellHansen 7 years ago
parent 305ef917e0
commit ed250d1291

@ -4,7 +4,7 @@
#include "util.hpp" #include "util.hpp"
#include <tuple> #include <tuple>
#define OCT_DIM 32 #define OCT_DIM 128
struct OctState { struct OctState {

@ -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) {

@ -110,7 +110,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 = 32; int dimension = 128;
int3 quad_position = (0, 0, 0); int3 quad_position = (0, 0, 0);
// While we are not at the required resolution // While we are not at the required resolution
@ -374,7 +374,7 @@ __kernel void raycaster(
// If we hit a voxel // If we hit a voxel
if (voxel.x < 32 && voxel.y < 32 && voxel.z < 32){ if (voxel.x < 128 && voxel.y < 128 && voxel.z < 128){
if (get_oct_vox( if (get_oct_vox(
voxel, voxel,
octree_descriptor_buffer, octree_descriptor_buffer,

@ -38,7 +38,7 @@ bool Application::init_clcaster() {
// Send the data to the GPU // Send the data to the GPU
raycaster->assign_map(map); raycaster->assign_map(map);
octree = std::make_shared<Map>(32, map.get()); octree = std::make_shared<Map>(128, map.get());
raycaster->assign_octree(octree); raycaster->assign_octree(octree);

@ -12,9 +12,9 @@ Map::Map(uint32_t dimensions, Old_Map* array_map) {
// randomly set the voxel data for testing // randomly set the voxel data for testing
for (uint64_t i = 0; i < dimensions * dimensions * dimensions; i++) { for (uint64_t i = 0; i < dimensions * dimensions * dimensions; i++) {
if (rand() % 10000 < 3) //if (rand() % 10000 < 3)
voxel_data[i] = 1; // voxel_data[i] = 1;
else //else
voxel_data[i] = 0; voxel_data[i] = 0;
} }

Loading…
Cancel
Save