bringing up to date

master
MitchellHansen 8 years ago
parent c7bde50e0d
commit 32e58d516a

@ -92,10 +92,10 @@ int main() {
// =============================
Map _map(32);
_map.test();
//_map.test();
_map.dump_logs();
//std::cin.get();
//return 0;
std::cin.get();
return 0;
// =============================
sf::RenderWindow window(sf::VideoMode(WINDOW_X, WINDOW_Y), "SFML");

@ -29,13 +29,13 @@ uint64_t Map::generate_children(sf::Vector3i pos, int voxel_scale) {
// The 8 subvoxel coords starting from the 1th direction, the direction of the origin of the 3d grid
// XY, Z++, XY
std::vector<sf::Vector3i> v = {
sf::Vector3i(pos.x , pos.y , pos.z),
sf::Vector3i(pos.x + voxel_scale, pos.y , pos.z),
sf::Vector3i(pos.x , pos.y + voxel_scale, pos.z),
sf::Vector3i(pos.x , pos.y , pos.z),
sf::Vector3i(pos.x + voxel_scale, pos.y , pos.z),
sf::Vector3i(pos.x , pos.y + voxel_scale, pos.z),
sf::Vector3i(pos.x + voxel_scale, pos.y + voxel_scale, pos.z),
sf::Vector3i(pos.x , pos.y , pos.z + voxel_scale),
sf::Vector3i(pos.x + voxel_scale, pos.y , pos.z + voxel_scale),
sf::Vector3i(pos.x , pos.y + voxel_scale, pos.z + voxel_scale),
sf::Vector3i(pos.x , pos.y , pos.z + voxel_scale),
sf::Vector3i(pos.x + voxel_scale, pos.y , pos.z + voxel_scale),
sf::Vector3i(pos.x , pos.y + voxel_scale, pos.z + voxel_scale),
sf::Vector3i(pos.x + voxel_scale, pos.y + voxel_scale, pos.z + voxel_scale)
};
@ -66,6 +66,7 @@ uint64_t Map::generate_children(sf::Vector3i pos, int voxel_scale) {
uint64_t child_descriptor = 0;
std::vector<uint64_t> descriptor_array;
std::vector<uint64_t> index_array;
// Generate down the recursion, returning the descriptor of the current node
for (int i = 0; i < v.size(); i++) {

@ -13,16 +13,19 @@ Octree::Octree() {
// Copy to stack enables the hybrid depth-breadth first tree by taking
// a list of valid non-leaf child descriptors contained under a common parent.
// It takes the list of children, and the current level in the voxel hierarchy.
// It returns the index to the first element of the
uint64_t Octree::copy_to_stack(std::vector<uint64_t> children, unsigned int voxel_scale) {
//// Check for the 15 bit boundry
//if (stack_pos - children.size() > stack_pos) {
// global_pos = stack_pos;
// stack_pos = 0x8000;
//}
//else {
// stack_pos -= children.size();
//}
// Check for the 15 bit boundry
if (stack_pos - children.size() > stack_pos) {
global_pos = stack_pos;
stack_pos = 0x8000;
}
else {
stack_pos -= children.size();
}
// Copy to stack needs to keep track of an "anchor_stack" which will hopefully facilitate
// relative pointer generation for items being copied to the stack
@ -35,7 +38,7 @@ uint64_t Octree::copy_to_stack(std::vector<uint64_t> children, unsigned int voxe
stack_pos -= children.size();
//stack_pos -= children.size();
memcpy(&descriptor_buffer[stack_pos + global_pos], children.data(), children.size() * sizeof(uint64_t));
// Return the bitmask encoding the index of that value

Loading…
Cancel
Save