various tweaking and figuring on the octree. The weird hybrid dfs bfs thing they have going will be annoying to do in one pass. Might defer it out to two passes. First building the octree, second culling and passing the octree to the gpu

master
MitchellHansen 8 years ago
parent 51a08fc0bb
commit bb0852cc0e

@ -55,7 +55,7 @@ Map::Map(sf::Vector3i position) {
load_unload(position); load_unload(position);
for (int i = 0; i < 8192; i++) { for (int i = 0; i < 1024; i++) {
block[i] = 0; block[i] = 0;
} }
} }
@ -130,25 +130,27 @@ int64_t Map::generate_children(sf::Vector3i pos, int dim) {
std::vector<int64_t> cps; std::vector<int64_t> cps;
int64_t tmp = 0; int64_t tmp = 0;
int64_t ret_pos = stack_position;
if (dim == 1) { if (dim == 1) {
// These don't bound check, should they?
if (getVoxel(t1)) if (getVoxel(t1))
SetBit(16, &tmp); SetBit(16, &tmp);
if (getVoxel(t2)) if (getVoxel(t2))
SetBit(16, &tmp); SetBit(17, &tmp);
if (getVoxel(t3)) if (getVoxel(t3))
SetBit(16, &tmp); SetBit(18, &tmp);
if (getVoxel(t4)) if (getVoxel(t4))
SetBit(16, &tmp); SetBit(19, &tmp);
if (getVoxel(t5)) if (getVoxel(t5))
SetBit(16, &tmp); SetBit(20, &tmp);
if (getVoxel(t6)) if (getVoxel(t6))
SetBit(16, &tmp); SetBit(21, &tmp);
if (getVoxel(t7)) if (getVoxel(t7))
SetBit(16, &tmp); SetBit(22, &tmp);
if (getVoxel(t8)) if (getVoxel(t8))
SetBit(16, &tmp); SetBit(23, &tmp);
cps.push_back(tmp); cps.push_back(tmp);
@ -159,7 +161,6 @@ int64_t Map::generate_children(sf::Vector3i pos, int dim) {
int curr_stack_pos = stack_position; int curr_stack_pos = stack_position;
tmp = generate_children(t1, dim / 2); tmp = generate_children(t1, dim / 2);
if (tmp != 0) if (tmp != 0)
cps.push_back(tmp); cps.push_back(tmp);
@ -208,6 +209,8 @@ void Map::generate_octree() {
arr[i] = 0; arr[i] = 0;
} }
generate_children(sf::Vector3i(0, 0, 0), 64);
int* dataset = new int[32 * 32 * 32]; int* dataset = new int[32 * 32 * 32];
for (int i = 0; i < 32 * 32 * 32; i++) { for (int i = 0; i < 32 * 32 * 32; i++) {
dataset[0] = rand() % 2; dataset[0] = rand() % 2;

@ -1,6 +1,4 @@
#include "GL_Testing.h" #include "GL_Testing.h"
#include <vulkan/vulkan.h>
#include <vulkan/vk_sdk_platform.h>
#ifdef linux #ifdef linux
#include <CL/cl.h> #include <CL/cl.h>
#include <CL/opencl.h> #include <CL/opencl.h>

Loading…
Cancel
Save