It seems that the octree has been built correctly. Going to use bitset to count children, not sure how I'm going to determine what quadrants they lie in. Perhaps masks?
This commit is contained in:
@@ -29,6 +29,10 @@ struct XYZHasher {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class Octree {
|
||||
public:
|
||||
Octree() {
|
||||
@@ -89,8 +93,11 @@ public:
|
||||
|
||||
uint64_t index = cp_to_index(head);
|
||||
|
||||
uint64_t child = block_stack.front()[index];
|
||||
uint64_t child1 = block_stack.front()[index];
|
||||
uint64_t child2 = block_stack.front()[index+1];
|
||||
|
||||
std::bitset<64> t(index);
|
||||
auto val = t.count();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -272,26 +272,3 @@ inline std::vector<float> sfml_get_float_input(sf::RenderWindow *window) {
|
||||
|
||||
}
|
||||
|
||||
//struct Light {
|
||||
// sf::Vector4f rgbi;
|
||||
//
|
||||
// // I believe that Vector3's get padded to Vector4's. Give them a non-garbage value
|
||||
// sf::Vector3f position;
|
||||
//
|
||||
// sf::Vector3f direction_cartesian;
|
||||
//
|
||||
// void look_at_center() {
|
||||
// direction_cartesian = SphereToCart(CartToNormalizedSphere(sf::Vector3f(256, 256, 256) - position));
|
||||
// };
|
||||
//
|
||||
// void orbit_around_center(double time) {
|
||||
// position = sf::Vector3f(
|
||||
// position.x * cos(time/1000) - position.y * sin(time/1000),
|
||||
// position.x * sin(time/1000) + position.y * cos(time/1000),
|
||||
// position.z
|
||||
// );
|
||||
//
|
||||
// look_at_center();
|
||||
// };
|
||||
//};
|
||||
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
#include "Map.h"
|
||||
|
||||
int BitCount(unsigned int u) {
|
||||
unsigned int uCount;
|
||||
|
||||
uCount = u - ((u >> 1) & 033333333333) - ((u >> 2) & 011111111111);
|
||||
return ((uCount + (uCount >> 3)) & 030707070707) % 63;
|
||||
}
|
||||
|
||||
void SetBit(int position, char* c) {
|
||||
*c |= (uint64_t)1 << position;
|
||||
|
||||
@@ -83,8 +83,7 @@ int main() {
|
||||
// Currently just close it right away for debug
|
||||
ni.stop_listening_for_clients();
|
||||
|
||||
sf::RenderWindow window(sf::VideoMode(WINDOW_X, WINDOW_Y), "SFML");
|
||||
window.setMouseCursorVisible(false);
|
||||
|
||||
|
||||
// =============================
|
||||
Map _map(sf::Vector3i(0, 0, 0));
|
||||
@@ -93,7 +92,10 @@ int main() {
|
||||
_map.a.get_voxel(sf::Vector3i(0, 0, 0));
|
||||
// =============================
|
||||
|
||||
//return 0;
|
||||
return 0;
|
||||
|
||||
sf::RenderWindow window(sf::VideoMode(WINDOW_X, WINDOW_Y), "SFML");
|
||||
window.setMouseCursorVisible(false);
|
||||
|
||||
/*GL_Testing t;
|
||||
t.compile_shader("../shaders/passthrough.frag", GL_Testing::Shader_Type::FRAGMENT);
|
||||
|
||||
Reference in New Issue
Block a user