diff --git a/config/general_settings b/config/general_settings index 0793864..c66b9c2 100644 --- a/config/general_settings +++ b/config/general_settings @@ -1,3 +1,3 @@ -[LOGGING] -log_level = 0 # INFO, WARN, ERROR -log_dest = 0 # STDOUT, FILE +[LOGGING] +log_level = 0 # INFO, WARN, ERROR +log_dest = 0 # STDOUT, FILE diff --git a/config/graphics_settings b/config/graphics_settings index f1d84cf..ffa7620 100644 --- a/config/graphics_settings +++ b/config/graphics_settings @@ -1,3 +1,3 @@ -[GRAPHICS] -x_resolution = 800 -y_resolution = 800 +[GRAPHICS] +x_resolution = 800 +y_resolution = 800 diff --git a/include/Application.h b/include/Application.h index 6a74e98..6ac1499 100644 --- a/include/Application.h +++ b/include/Application.h @@ -34,9 +34,8 @@ // Srsly people who macro error codes are the devil #undef ERROR #include "Logger.h" -#include "FrameWatcher.h" -class Application: private Gui { +class Application { public: const int WINDOW_X = 1536; @@ -72,8 +71,6 @@ private: Input input_handler; std::shared_ptr window_handler; - FrameWatcher frame_watcher; - // The sfml imgui wrapper I'm using requires Update be called with sf::Time // Might modify it to also accept seconds sf::Clock sf_delta_clock; @@ -93,9 +90,4 @@ private: delta_time = 0.0, accumulator_time = 0.0, current_time = 0.0; -public: - - virtual void render_gui() override; - virtual void update_gui() override; - -}; +}; \ No newline at end of file diff --git a/include/Camera.h b/include/Camera.h index b4695bf..04c00aa 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -26,7 +26,7 @@ public: int update(double delta_time); - void look_at(sf::Vector3f position); + void look_at_center(); sf::Vector2f* get_direction_pointer(); sf::Vector3f* get_position_pointer(); diff --git a/include/Event.hpp b/include/Event.hpp index 31d65b3..4d5b6e5 100644 --- a/include/Event.hpp +++ b/include/Event.hpp @@ -57,12 +57,6 @@ namespace vr { NetworkJoystickMoved, NetworkJoystickConnected, NetworkJoystickDisconnected, - Tick120Seconds, - Tick60Seconds, - Tick30Seconds, - Tick20Seconds, - Tick10Seconds, - Tick5Seconds, Count }; @@ -78,6 +72,8 @@ namespace vr { }; + + class Closed : public Event { public: Closed() : Event(vr::Event::EventType::Closed) {}; diff --git a/include/FrameWatcher.h b/include/FrameWatcher.h deleted file mode 100644 index 7fac42c..0000000 --- a/include/FrameWatcher.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -#include "Pub_Sub.h" - -class FrameWatcher : public VrEventPublisher{ - - - - -public: - FrameWatcher(); - ~FrameWatcher(); - - void do_tick(); - -private: - - float get_elapsed_time(); - - float step_size = 0.0166f; - double frame_time = 0.0; - double elapsed_time = 0.0; - double delta_time = 0.0; - double accumulator_time = 0.0; - double current_time = 0.0; - - -}; diff --git a/include/Gui.h b/include/Gui.h index e68f533..1c266de 100644 --- a/include/Gui.h +++ b/include/Gui.h @@ -1,66 +1,66 @@ -#pragma once -#include -#include -#include - -class Gui { - -public: - - Gui() { - container_lock.lock(); - renderable_container.push_back(this); - container_lock.unlock(); - }; - virtual ~Gui() { - container_lock.lock(); - renderable_container.remove(this); - container_lock.unlock(); - }; - - virtual void render_gui() = 0; - virtual void update_gui() = 0; - - // Instead of rendering nil, we can pass our render call if we would like - bool renderable() { return rendering; }; - -private: - - // Whatever class that wants to call this must be a friend!!! - friend class Application; - static void do_render() { - for (auto i : renderable_container) { - i->update_gui(); - if (i->renderable()) - i->render_gui(); - } - }; - - - - static std::mutex container_lock; - static std::list renderable_container; - -protected: - bool rendering = true; - // Derived class will handle imgui calls - -}; - - - - - - - - - - - - - - - - - - +#pragma once +#include +#include +#include + +class Gui { + +public: + + Gui() { + container_lock.lock(); + renderable_container.push_back(this); + container_lock.unlock(); + }; + virtual ~Gui() { + container_lock.lock(); + renderable_container.remove(this); + container_lock.unlock(); + }; + + virtual void render_gui() = 0; + virtual void update_gui() = 0; + + // Instead of rendering nil, we can pass our render call if we would like + bool renderable() { return rendering; }; + +private: + + // Whatever class that wants to call this must be a friend!!! + friend class Application; + static void do_render() { + for (auto i : renderable_container) { + i->update_gui(); + if (i->renderable()) + i->render_gui(); + } + }; + + + + static std::mutex container_lock; + static std::list renderable_container; + +protected: + bool rendering = false; + // Derived class will handle imgui calls + +}; + + + + + + + + + + + + + + + + + + diff --git a/include/Input.h b/include/Input.h index 46729e6..883a96b 100644 --- a/include/Input.h +++ b/include/Input.h @@ -21,7 +21,9 @@ public: void consume_vr_events(); void handle_held_keys(); + void dispatch_events(); + virtual void render_gui() override; virtual void update_gui() override; @@ -40,10 +42,6 @@ private: static const std::vector key_strings; std::list> event_queue; - -protected: - virtual void generate_events() override; - }; class WindowHandler : public VrEventSubscriber { @@ -55,13 +53,13 @@ public: if (event.get()->type == vr::Event::Closed) { window_ref->close(); - } else if (event.get()->type == vr::Event::KeyPressed) { - - vr::KeyPressed *key_event = static_cast(event.get()); - - if (key_event->code == sf::Keyboard::Escape) { - window_ref->close(); - } + } else if (event.get()->type == vr::Event::KeyPressed) { + + vr::KeyPressed *key_event = static_cast(event.get()); + + if (key_event->code == sf::Keyboard::Escape) { + window_ref->close(); + } } }; diff --git a/include/NetworkInput.h b/include/NetworkInput.h index 6bce081..dd1b017 100644 --- a/include/NetworkInput.h +++ b/include/NetworkInput.h @@ -23,9 +23,13 @@ public: void stop_recieving_from_clients(); void generate_events(); + void dispatch_events(); + private: + std::list> event_queue; + std::vector client_sockets; sf::SocketSelector socket_selector; diff --git a/include/Pub_Sub.h b/include/Pub_Sub.h index bdadef3..7ea3aaf 100644 --- a/include/Pub_Sub.h +++ b/include/Pub_Sub.h @@ -3,7 +3,6 @@ #include #include "Event.hpp" #include -#include class VrEventPublisher; @@ -23,19 +22,12 @@ class VrEventPublisher { public: virtual ~VrEventPublisher() {}; - virtual void subscribe(VrEventSubscriber *subscriber, vr::Event::EventType type) final; - virtual void subscribe(VrEventSubscriber *subscriber, std::vector type) final; - virtual void unsubscribe(VrEventSubscriber *s, vr::Event::EventType c) final; - + virtual void subscribe(VrEventSubscriber *subscriber, vr::Event::EventType type); + virtual void subscribe(VrEventSubscriber *subscriber, std::vector type); + virtual void unsubscribe(VrEventSubscriber *s, vr::Event::EventType c); + virtual void notify_subscribers(std::unique_ptr event); private: - std::map> subscribers; - -protected: - virtual void notify_subscribers(std::unique_ptr event) final; - virtual void dispatch_events() final; - virtual void generate_events() = 0; - std::list> event_queue; }; diff --git a/kernels/ray_caster_kernel.cl b/kernels/ray_caster_kernel.cl index 066a82f..9c5986e 100644 --- a/kernels/ray_caster_kernel.cl +++ b/kernels/ray_caster_kernel.cl @@ -375,7 +375,7 @@ __kernel void raycaster( bool shadow_ray = false; // Andrew Woo's raycasting algo - while (distance_traveled < max_distance && bounce_count < 4) { + while (distance_traveled < max_distance && bounce_count < 2) { // Fancy no branch version of the logic step face_mask = intersection_t.xyz <= min(intersection_t.yzx, intersection_t.zxy); @@ -387,7 +387,6 @@ __kernel void raycaster( voxel_data = 5; voxel.xyz -= voxel_step.xyz * face_mask.xyz; first_strike = mix(fog_color, voxel_color, 1.0 - max(distance_traveled / 700.0f, (float)0)); - break; } @@ -538,10 +537,10 @@ __kernel void raycaster( texture_atlas, convert_int2(tile_face_position * convert_float2(*atlas_dim / *tile_dim)) + convert_int2((float2)(3, 4) * convert_float2(*atlas_dim / *tile_dim)) - ).xyz/4; + ).xyz/2; - voxel_color -= 0.3f; - max_distance = 700; + voxel_color.w += 0.3f; + max_distance = 500; distance_traveled = 0; float3 hit_pos = convert_float3(voxel) + face_position; diff --git a/src/Application.cpp b/src/Application.cpp index bc92a68..b1d8418 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -110,43 +110,17 @@ bool Application::game_loop() { // Time keeping elapsed_time = elap_time(); - - // time between this and the last frame delta_time = elapsed_time - current_time; - - // Setup the time for the next tick current_time = elapsed_time; - - // If the delta exceeded 0.2f, then limit the max lag we'll allow - // 1 / float is how you get the fps. 0.2f == 5fps if (delta_time > 0.2f) delta_time = 0.2f; - - // Add the the physics accumulator our delta accumulator_time += delta_time; - - // We want to keep our physics at a constant step size but we have a variable frame rate. - // 0.016 == physics preferred timestep - // 0.030 == average 30 fps frame rate - // we must run the physics step ~twice every render frame to keep consistency - - int count = 0; while ((accumulator_time - step_size) >= step_size) { - - - count++; accumulator_time -= step_size; - // do physics at step size rate - - for (int i = 0; i < 1000; i++) { - int x = 9; - int r = i + x * 4; - current_time = elapsed_time; - } // ==== DELTA TIME LOCKED ==== } - std::cout << count << "\n"; + // ==== FPS LOCKED ==== window->clear(sf::Color::Black); @@ -172,6 +146,94 @@ bool Application::game_loop() { fps.draw(); Gui::do_render(); + + ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar; + bool window_show = true; + + + if (ImGui::BeginMenuBar()) + { + if (ImGui::BeginMenu("Menu")) + { + ImGui::Button("asdoifjasodif"); + ImGui::EndMenu(); + } + ImGui::EndMenuBar(); + } + + ImGui::Begin("Window"); + ImGui::InputText("filename", screenshot_buf, 128); + if (ImGui::Button("Take Screen shot")) { + + std::string path = "../assets/"; + std::string filename(screenshot_buf); + filename += ".png"; + + sf::Texture window_texture; + window_texture.create(window->getSize().x, window->getSize().y); + window_texture.update(*window); + + sf::Image image = window_texture.copyToImage(); + image.saveToFile(path + filename); + + } + + ImGui::NextColumn(); + + if (ImGui::Button("Pause")) { + + paused = !paused; + + if (paused) + Logger::log("Pausing", Logger::LogLevel::INFO); + else + Logger::log("Unpausing", Logger::LogLevel::INFO); + + } + ImGui::End(); + + + ImGui::Begin("Controller debugger"); + + ImDrawList* draw_list = ImGui::GetWindowDrawList(); + static ImVec4 col = ImVec4(1.0f, 0.0f, 1.0f, 1.0f); + const ImVec2 p = ImGui::GetCursorScreenPos(); + const ImU32 col32 = ImColor(col); + + std::vector axis_values = { + sf::Joystick::getAxisPosition(0, sf::Joystick::Axis::X) / 2, + sf::Joystick::getAxisPosition(0, sf::Joystick::Axis::Y) / 2, + sf::Joystick::getAxisPosition(0, sf::Joystick::Axis::U) / 2, + sf::Joystick::getAxisPosition(0, sf::Joystick::Axis::R) / 2, + sf::Joystick::getAxisPosition(0, sf::Joystick::Axis::Z) / 2, + sf::Joystick::getAxisPosition(0, sf::Joystick::Axis::V) / 2 + }; + + ImGui::Columns(3, "Axis's"); // 4-ways, with border + ImGui::Separator(); + ImGui::Text("X Y"); ImGui::NextColumn(); + ImGui::Text("U R"); ImGui::NextColumn(); + ImGui::Text("Z V"); ImGui::NextColumn(); + ImGui::Separator(); + + for (int i = 0; i < 3; i++) { + + + float offset = ImGui::GetColumnWidth(i); + + draw_list->AddLine(ImVec2(p.x + 0 + offset * i, p.y + 50), ImVec2(p.x + 100 + offset * i, p.y + 50), col32, 1.0); + draw_list->AddLine(ImVec2(p.x + 50 + offset * i, p.y + 0), ImVec2(p.x + 50 + offset * i, p.y + 100), col32, 1.0); + draw_list->AddCircleFilled(ImVec2(p.x + axis_values[2 * i] + 50 + offset * i, p.y + axis_values[2 * i + 1] + 50), 6, col32, 32); + + ImGui::Dummy(ImVec2(100, 100)); + ImGui::NextColumn(); + } + + + ImGui::End(); + + //ImGui::ShowTestWindow(); + ImGui::Render(); // ImGUI messes up somthing in the SFML GL state, so we need a single draw call to right things @@ -195,40 +257,3 @@ float Application::elap_time() { return static_cast(elapsed_time.count()); } -void Application::render_gui() { - - ImGui::Begin("Window"); - ImGui::InputText("filename", screenshot_buf, 128); - if (ImGui::Button("Take Screen shot")) { - - std::string path = "../assets/"; - std::string filename(screenshot_buf); - filename += ".png"; - - sf::Texture window_texture; - window_texture.create(window->getSize().x, window->getSize().y); - window_texture.update(*window); - - sf::Image image = window_texture.copyToImage(); - image.saveToFile(path + filename); - - } - - ImGui::NextColumn(); - - if (ImGui::Button("Pause")) { - - paused = !paused; - - if (paused) - Logger::log("Pausing", Logger::LogLevel::INFO); - else - Logger::log("Unpausing", Logger::LogLevel::INFO); - - } - ImGui::End(); -} - -void Application::update_gui() { -} - diff --git a/src/Camera.cpp b/src/Camera.cpp index 6956b16..1aa3e94 100644 --- a/src/Camera.cpp +++ b/src/Camera.cpp @@ -97,7 +97,7 @@ void Camera::recieve_event(VrEventPublisher* publisher, std::unique_ptrcode == sf::Keyboard::C) { - look_at(sf::Vector3f(128, 128, 10)); + look_at_center(); } else if (held_event->code == sf::Keyboard::Q) { add_relative_impulse(Camera::DIRECTION::DOWN, default_impulse); @@ -230,10 +230,9 @@ void Camera::update_gui() { rendering = true; } -void Camera::look_at(sf::Vector3f position) -{ +void Camera::look_at_center() { - direction = CartToNormalizedSphere(position - this->position); + direction = CartToNormalizedSphere(sf::Vector3f(60, 60, 35) - position); } sf::Vector2f* Camera::get_direction_pointer() { diff --git a/src/FrameWatcher.cpp b/src/FrameWatcher.cpp deleted file mode 100644 index f6ffab9..0000000 --- a/src/FrameWatcher.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -#include "FrameWatcher.h" -#include - -FrameWatcher::FrameWatcher() { - -} - -FrameWatcher::~FrameWatcher() -{ - -} - -void FrameWatcher::do_tick() { - - - elapsed_time = get_elapsed_time(); - delta_time = elapsed_time - current_time; - current_time = elapsed_time; - - if (delta_time > 0.2f) - delta_time = 0.2f; - - accumulator_time += delta_time; - - while ((accumulator_time - step_size) >= step_size) { - accumulator_time -= step_size; - - // ==== DELTA TIME LOCKED ==== - } - -} - -float FrameWatcher::get_elapsed_time() { - - static std::chrono::time_point start; - static bool started = false; - - if (!started) { - start = std::chrono::system_clock::now(); - started = true; - } - - std::chrono::time_point now = std::chrono::system_clock::now(); - std::chrono::duration elapsed_time = now - start; - return static_cast(elapsed_time.count()); -} - diff --git a/src/Gui.cpp b/src/Gui.cpp index 6861ce9..c2174e6 100644 --- a/src/Gui.cpp +++ b/src/Gui.cpp @@ -1,4 +1,4 @@ -#include "Gui.h" - -std::mutex Gui::container_lock; +#include "Gui.h" + +std::mutex Gui::container_lock; std::list Gui::renderable_container; \ No newline at end of file diff --git a/src/Input.cpp b/src/Input.cpp index 61e6906..98010ff 100644 --- a/src/Input.cpp +++ b/src/Input.cpp @@ -112,6 +112,16 @@ void Input::handle_held_keys() { } +void Input::dispatch_events() { + + while (event_queue.size() != 0) { + notify_subscribers(std::move(event_queue.front())); + event_queue.pop_front(); + } + +} + + void Input::render_gui() { ImGui::Begin("Input Debugger"); @@ -282,111 +292,108 @@ void Input::transpose_sf_events(std::list sf_event_queue) { } } -const std::vector Input::key_strings = { - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "Num0", - "Num1", - "Num2", - "Num3", - "Num4", - "Num5", - "Num6", - "Num7", - "Num8", - "Num9", - "Escape", - "LControl", - "LShift", - "LAlt", - "LSystem", - "RControl", - "RShift", - "RAlt", - "RSystem", - "Menu", - "LBracket", - "RBracket", - "SemiColon", - "Comma", - "Period", - "Quote", - "Slash", - "BackSlash", - "Tilde", - "Equal", - "Dash", - "Space", - "Return", - "BackSpace", - "Tab", - "PageUp", - "PageDown", - "End", - "Home", - "Insert", - "Delete", - "Add", - "Subtract", - "Multiply", - "Divide", - "Left", - "Right", - "Up", - "Down", - "Numpad0", - "Numpad1", - "Numpad2", - "Numpad3", - "Numpad4", - "Numpad5", - "Numpad6", - "Numpad7", - "Numpad8", - "Numpad9", - "F1" , - "F2" , - "F3" , - "F4" , - "F5" , - "F6" , - "F7" , - "F8" , - "F9" , - "F10", - "F11", - "F12", - "F13", - "F14", - "F15", +const std::vector Input::key_strings = { + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "Num0", + "Num1", + "Num2", + "Num3", + "Num4", + "Num5", + "Num6", + "Num7", + "Num8", + "Num9", + "Escape", + "LControl", + "LShift", + "LAlt", + "LSystem", + "RControl", + "RShift", + "RAlt", + "RSystem", + "Menu", + "LBracket", + "RBracket", + "SemiColon", + "Comma", + "Period", + "Quote", + "Slash", + "BackSlash", + "Tilde", + "Equal", + "Dash", + "Space", + "Return", + "BackSpace", + "Tab", + "PageUp", + "PageDown", + "End", + "Home", + "Insert", + "Delete", + "Add", + "Subtract", + "Multiply", + "Divide", + "Left", + "Right", + "Up", + "Down", + "Numpad0", + "Numpad1", + "Numpad2", + "Numpad3", + "Numpad4", + "Numpad5", + "Numpad6", + "Numpad7", + "Numpad8", + "Numpad9", + "F1" , + "F2" , + "F3" , + "F4" , + "F5" , + "F6" , + "F7" , + "F8" , + "F9" , + "F10", + "F11", + "F12", + "F13", + "F14", + "F15", "Pause" }; -void Input::generate_events() { -} - diff --git a/src/NetworkInput.cpp b/src/NetworkInput.cpp index d04d9fb..b3b59e9 100644 --- a/src/NetworkInput.cpp +++ b/src/NetworkInput.cpp @@ -26,6 +26,14 @@ void NetworkInput::recieve_from_clients() } +void NetworkInput::dispatch_events() +{ + while (event_queue.size() != 0) { + notify_subscribers(std::move(event_queue.front())); + event_queue.pop_front(); + } +} + void NetworkInput::threaded_client_listener(int port) { listener.listen(port); diff --git a/src/Pub_Sub.cpp b/src/Pub_Sub.cpp index 37e8ffa..2a9f376 100644 --- a/src/Pub_Sub.cpp +++ b/src/Pub_Sub.cpp @@ -42,10 +42,3 @@ void VrEventPublisher::notify_subscribers(std::unique_ptr event) { } } - -void VrEventPublisher::dispatch_events() { - while (event_queue.size() != 0) { - notify_subscribers(std::move(event_queue.front())); - event_queue.pop_front(); - } -} diff --git a/src/map/Old_Map.cpp b/src/map/Old_Map.cpp index bc52087..51889ac 100644 --- a/src/map/Old_Map.cpp +++ b/src/map/Old_Map.cpp @@ -215,7 +215,7 @@ void Old_Map::generate_terrain() { for (int x = dimensions.x / 2; x < dimensions.x / 2 + dimensions.x / 64; x++) { for (int y = dimensions.x / 2; y < dimensions.y / 2 + dimensions.x / 64; y++) { - for (int z = 5; z < 15; z++) { + for (int z = 0; z < 5; z++) { voxel_data[x + dimensions.x * (y + dimensions.z * z)] = 6; } @@ -249,63 +249,63 @@ void Old_Map::generate_terrain() { // Hand code in some constructions - //std::vector> maze = - // generate_maze(sf::Vector2i(8, 8), sf::Vector2i(0, 0)); + std::vector> maze = + generate_maze(sf::Vector2i(8, 8), sf::Vector2i(0, 0)); + + for (int x = 0; x < maze.size(); x++) { + for (int y = 0; y < maze.at(0).size(); y++) { + + switch(maze.at(x).at(y)) { + + case 1: { // North + voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + dimensions.z * 1)] = 6; + voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; + voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 5; + //voxel_data[x * 3 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 6; + //voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 6; + break; + } + case 2: { // South + voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + dimensions.z * 1)] = 5; + voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; + voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 6; + //voxel_data[x * 3 + dimensions.x * (y * 3 + dimensions.z * 1)] = 6; + //voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + dimensions.z * 1)] = 6; + break; + } + case 3: { // East + voxel_data[x * 3 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; + voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; + voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 5; + //voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + dimensions.z * 1)] = 6; + //voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 6; + break; + } + case 4: { // West + voxel_data[x * 3 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 5; + voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; + voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; + //voxel_data[x * 3 + dimensions.x * (y * 3 + dimensions.z * 1)] = 6; + //voxel_data[x * 3 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 6; + break; + } + + } + + + } + } - //for (int x = 0; x < maze.size(); x++) { - // for (int y = 0; y < maze.at(0).size(); y++) { - // - // switch(maze.at(x).at(y)) { - // - // case 1: { // North - // voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + dimensions.z * 1)] = 6; - // voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; - // voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 5; - // //voxel_data[x * 3 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 6; - // //voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 6; - // break; - // } - // case 2: { // South - // voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + dimensions.z * 1)] = 5; - // voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; - // voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 6; - // //voxel_data[x * 3 + dimensions.x * (y * 3 + dimensions.z * 1)] = 6; - // //voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + dimensions.z * 1)] = 6; - // break; - // } - // case 3: { // East - // voxel_data[x * 3 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; - // voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; - // voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 5; - // //voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + dimensions.z * 1)] = 6; - // //voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 6; - // break; - // } - // case 4: { // West - // voxel_data[x * 3 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 5; - // voxel_data[x * 3 + 1 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; - // voxel_data[x * 3 + 2 + dimensions.x * (y * 3 + 1 + dimensions.z * 1)] = 6; - // //voxel_data[x * 3 + dimensions.x * (y * 3 + dimensions.z * 1)] = 6; - // //voxel_data[x * 3 + dimensions.x * (y * 3 + 2 + dimensions.z * 1)] = 6; - // break; - // } - // - // } - // - // + + //for (int x = 0; x < dimensions.x; x++) { + // for (int y = 0; y < dimensions.y; y++) { + // voxel_data[x + dimensions.x * (y + dimensions.z * 1)] = 6; // } //} - - ////for (int x = 0; x < dimensions.x; x++) { - //// for (int y = 0; y < dimensions.y; y++) { - //// voxel_data[x + dimensions.x * (y + dimensions.z * 1)] = 6; - //// } - ////} - - //set_voxel(sf::Vector3i(45, 70, 6), 6); - //set_voxel(sf::Vector3i(47, 70, 6), 6); - //set_voxel(sf::Vector3i(100, 100, 50), 1); + set_voxel(sf::Vector3i(45, 70, 6), 6); + set_voxel(sf::Vector3i(47, 70, 6), 6); + set_voxel(sf::Vector3i(100, 100, 50), 1); }