From ed250d1291171cac9d379aacc8b7f1cfa8174166 Mon Sep 17 00:00:00 2001 From: MitchellHansen Date: Sun, 24 Sep 2017 18:28:32 -0700 Subject: [PATCH] Octree works out to 128x128 as is, and performance seems very promising. Traversal or octree generation fixes will be next --- include/map/Octree.h | 2 +- include/util.hpp | 20 ++++++++++---------- kernels/ray_caster_kernel.cl | 4 ++-- src/Application.cpp | 2 +- src/map/Map.cpp | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/map/Octree.h b/include/map/Octree.h index 32abe75..1d35847 100644 --- a/include/map/Octree.h +++ b/include/map/Octree.h @@ -4,7 +4,7 @@ #include "util.hpp" #include -#define OCT_DIM 32 +#define OCT_DIM 128 struct OctState { diff --git a/include/util.hpp b/include/util.hpp index af2f239..0ef49cb 100644 --- a/include/util.hpp +++ b/include/util.hpp @@ -150,20 +150,20 @@ inline std::string read_file(std::string file_name){ inline void PrettyPrintUINT64(uint64_t i, std::stringstream* ss) { - *ss << "[" << std::bitset<15>(i) << "]"; - *ss << "[" << std::bitset<1>(i >> 15) << "]"; - *ss << "[" << std::bitset<8>(i >> 16) << "]"; - *ss << "[" << std::bitset<8>(i >> 24) << "]"; - *ss << "[" << std::bitset<32>(i >> 32) << "]\n"; + //*ss << "[" << std::bitset<15>(i) << "]"; + //*ss << "[" << std::bitset<1>(i >> 15) << "]"; + //*ss << "[" << std::bitset<8>(i >> 16) << "]"; + //*ss << "[" << std::bitset<8>(i >> 24) << "]"; + //*ss << "[" << std::bitset<32>(i >> 32) << "]\n"; } inline void PrettyPrintUINT64(uint64_t i) { - std::cout << "[" << std::bitset<15>(i) << "]"; - std::cout << "[" << std::bitset<1>(i >> 15) << "]"; - std::cout << "[" << std::bitset<8>(i >> 16) << "]"; - std::cout << "[" << std::bitset<8>(i >> 24) << "]"; - std::cout << "[" << std::bitset<32>(i >> 32) << "]" << std::endl; + //std::cout << "[" << std::bitset<15>(i) << "]"; + //std::cout << "[" << std::bitset<1>(i >> 15) << "]"; + //std::cout << "[" << std::bitset<8>(i >> 16) << "]"; + //std::cout << "[" << std::bitset<8>(i >> 24) << "]"; + //std::cout << "[" << std::bitset<32>(i >> 32) << "]" << std::endl; } inline void DumpLog(std::stringstream* ss, std::string file_name) { diff --git a/kernels/ray_caster_kernel.cl b/kernels/ray_caster_kernel.cl index 3206d7e..3f3b3ac 100644 --- a/kernels/ray_caster_kernel.cl +++ b/kernels/ray_caster_kernel.cl @@ -110,7 +110,7 @@ bool get_oct_vox( 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 - int dimension = 32; + int dimension = 128; int3 quad_position = (0, 0, 0); // While we are not at the required resolution @@ -374,7 +374,7 @@ __kernel void raycaster( // 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( voxel, octree_descriptor_buffer, diff --git a/src/Application.cpp b/src/Application.cpp index 5721d12..a3f6100 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -38,7 +38,7 @@ bool Application::init_clcaster() { // Send the data to the GPU raycaster->assign_map(map); - octree = std::make_shared(32, map.get()); + octree = std::make_shared(128, map.get()); raycaster->assign_octree(octree); diff --git a/src/map/Map.cpp b/src/map/Map.cpp index 9ebfb45..904201e 100644 --- a/src/map/Map.cpp +++ b/src/map/Map.cpp @@ -12,11 +12,11 @@ Map::Map(uint32_t dimensions, Old_Map* array_map) { // randomly set the voxel data for testing for (uint64_t i = 0; i < dimensions * dimensions * dimensions; i++) { - if (rand() % 10000 < 3) - voxel_data[i] = 1; - else + //if (rand() % 10000 < 3) + // voxel_data[i] = 1; + //else voxel_data[i] = 0; - } + } char* char_array = array_map->get_voxel_data(); sf::Vector3i arr_dimensions = array_map->getDimensions();