256^3 rendering at 15FPS WITHOUT THE TRAVERSAL ALGORITHM! This thing's gonna FLY!
This commit is contained in:
@@ -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 = 128;
|
int dimension = OCTDIM;
|
||||||
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,16 +192,17 @@ 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;
|
// access the far point at which the head points too. Determine it's value, and add
|
||||||
//if (far_bit_mask & descriptor_buffer[current_index])
|
// a count of the valid bits to the index
|
||||||
// jumping = true;
|
if (far_bit_mask & octree_descriptor_buffer[current_index]) {
|
||||||
|
int far_pointer_index = current_index + (head & child_pointer_mask);
|
||||||
|
current_index = octree_descriptor_buffer[far_pointer_index] + count;
|
||||||
|
}
|
||||||
// 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;
|
else {
|
||||||
|
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
|
||||||
@@ -323,7 +324,7 @@ __kernel void raycaster(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
constant int vox_dim = 128;
|
constant int vox_dim = OCTDIM;
|
||||||
|
|
||||||
// If we hit a voxel
|
// If we hit a voxel
|
||||||
if (voxel.x < vox_dim && voxel.y < vox_dim && voxel.z < vox_dim){
|
if (voxel.x < vox_dim && voxel.y < vox_dim && voxel.z < vox_dim){
|
||||||
|
|||||||
@@ -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>(128, map.get());
|
octree = std::make_shared<Map>(256, map.get());
|
||||||
raycaster->assign_octree(octree);
|
raycaster->assign_octree(octree);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -706,7 +706,11 @@ bool CLCaster::compile_kernel(std::string kernel_source, bool is_path, std::stri
|
|||||||
|
|
||||||
// Try and build the program
|
// Try and build the program
|
||||||
// "-cl-finite-math-only -cl-fast-relaxed-math -cl-unsafe-math-optimizations"
|
// "-cl-finite-math-only -cl-fast-relaxed-math -cl-unsafe-math-optimizations"
|
||||||
error = clBuildProgram(program, 1, &device_id, "-cl-finite-math-only -cl-fast-relaxed-math -cl-unsafe-math-optimizations", NULL, NULL);
|
|
||||||
|
// need a ref to the oct dimensions
|
||||||
|
//std::string oct_dimensions = std::to_string(map->getDimensions().x);
|
||||||
|
std::string build_string = "-DOCTDIM=256 -cl-finite-math-only -cl-fast-relaxed-math -cl-unsafe-math-optimizations";
|
||||||
|
error = clBuildProgram(program, 1, &device_id, build_string.c_str(), NULL, NULL);
|
||||||
|
|
||||||
// Check to see if it error'd out
|
// Check to see if it error'd out
|
||||||
if (cl_assert(error)) {
|
if (cl_assert(error)) {
|
||||||
|
|||||||
@@ -246,9 +246,6 @@ std::tuple<uint64_t, uint64_t> Octree::GenerationRecursion(char* data, sf::Vecto
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (voxel_scale == 64)
|
|
||||||
std::cout << "WHoA";
|
|
||||||
|
|
||||||
// We are working bottom up so we need to subtract from the stack position
|
// We are working bottom up so we need to subtract from the stack position
|
||||||
// the amount of elements we want to use. In the worst case this will be
|
// the amount of elements we want to use. In the worst case this will be
|
||||||
// a far pointer for ever descriptor (size * 2)
|
// a far pointer for ever descriptor (size * 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user