Added enabling and disabling of the octree from the settings buffer
This commit is contained in:
@@ -104,7 +104,7 @@ public:
|
||||
*/
|
||||
|
||||
CLCaster();
|
||||
virtual ~CLCaster();
|
||||
~CLCaster();
|
||||
|
||||
// Queries hardware, creates the command queue and context, and compiles kernel
|
||||
bool init();
|
||||
@@ -157,6 +157,7 @@ public:
|
||||
bool create_settings_buffer();
|
||||
bool release_settings_buffer();
|
||||
bool add_to_settings_buffer(std::string setting_name, std::string define_accessor_name, int64_t *value);
|
||||
bool overwrite_setting(std::string settings_name, int64_t *value);
|
||||
bool remove_from_settings_buffer(std::string setting_name);
|
||||
|
||||
// ================================== DEBUG =======================================
|
||||
|
||||
@@ -132,7 +132,7 @@ bool get_oct_vox(
|
||||
ts.parent_stack[ts.scale] = ts.current_descriptor;
|
||||
|
||||
// Set our initial dimension and the position at the corner of the oct to keep track of our position
|
||||
int dimension = OCTDIM;
|
||||
int dimension = setting(OCTDIM);
|
||||
ts.oct_pos = zeroed_int3;
|
||||
|
||||
// While we are not at the required resolution
|
||||
@@ -331,19 +331,19 @@ __kernel void raycaster(
|
||||
|
||||
// If we hit a voxel
|
||||
|
||||
if (voxel.x < (*map_dim).x && voxel.y < (*map_dim).x && voxel.z < (*map_dim).x){
|
||||
// if (get_oct_vox(
|
||||
// voxel,
|
||||
// octree_descriptor_buffer,
|
||||
// octree_attachment_lookup_buffer,
|
||||
// octree_attachment_buffer,
|
||||
// settings_buffer
|
||||
// )){
|
||||
// voxel_data = 5;
|
||||
// } else {
|
||||
// voxel_data = 0;
|
||||
// }
|
||||
// } else {
|
||||
if (setting(OCTENABLED) == 1 && voxel.x < (*map_dim).x && voxel.y < (*map_dim).x && voxel.z < (*map_dim).x){
|
||||
if (get_oct_vox(
|
||||
voxel,
|
||||
octree_descriptor_buffer,
|
||||
octree_attachment_lookup_buffer,
|
||||
octree_attachment_buffer,
|
||||
settings_buffer
|
||||
)){
|
||||
voxel_data = 5;
|
||||
} else {
|
||||
voxel_data = 0;
|
||||
}
|
||||
} else {
|
||||
voxel_data = map[voxel.x + (*map_dim).x * (voxel.y + (*map_dim).z * (voxel.z))];
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,10 @@ bool Application::init_clcaster() {
|
||||
|
||||
raycaster->add_to_settings_buffer("octree_dimensions", "OCTDIM", (int64_t*)&MAP_X);
|
||||
|
||||
// TODO: ALLOW RVALUES FOR SETTINGS BUFFER
|
||||
int64_t oct_enabled = 0;
|
||||
raycaster->add_to_settings_buffer("using_octree", "OCTENABLED", &oct_enabled);
|
||||
|
||||
map = std::make_shared<Map>(MAP_X);
|
||||
|
||||
// TODO: Implement this
|
||||
|
||||
@@ -1219,11 +1219,36 @@ bool CLCaster::remove_from_settings_buffer(std::string setting_name) {
|
||||
}
|
||||
|
||||
bool CLCaster::release_settings_buffer() {
|
||||
|
||||
if (!release_buffer("settings_buffer"))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CLCaster::overwrite_setting(std::string settings_name, int64_t *value) {
|
||||
|
||||
bool success = true;
|
||||
|
||||
if (settings_buffer == nullptr){
|
||||
|
||||
Logger::log("Trying to push settings to an uninitialized settings buffer", Logger::LogLevel::ERROR, __LINE__, __FILE__);
|
||||
success = false;
|
||||
|
||||
} else {
|
||||
|
||||
if (settings_buffer_indices.count(settings_name)) {
|
||||
|
||||
unsigned int postion = settings_buffer_indices[settings_name];
|
||||
settings_buffer[postion] = *value;
|
||||
} else {
|
||||
|
||||
Logger::log("No setting matching [" + settings_name +"]", Logger::LogLevel::ERROR, __LINE__, __FILE__);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
CLCaster::device::device(cl_device_id device_id, cl_platform_id platform_id) {
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ void Input::handle_held_keys() {
|
||||
vr::MouseButtonReleased *e = static_cast<vr::MouseButtonReleased*>(event.get());
|
||||
held_mouse_buttons.erase(std::remove(held_mouse_buttons.begin(), held_mouse_buttons.end(), e->button), held_mouse_buttons.end());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Generate Held events for each of the held buttons and keys
|
||||
|
||||
Reference in New Issue
Block a user