Did this work?

master
mitchellhansen 7 years ago
parent 2d2a854f0f
commit 58ef1da02a

@ -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

@ -1,3 +1,3 @@
[GRAPHICS]
x_resolution = 800
y_resolution = 800
[GRAPHICS]
x_resolution = 800
y_resolution = 800

@ -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<WindowHandler> 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;
};
};

@ -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();

@ -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) {};

@ -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;
};

@ -1,66 +1,66 @@
#pragma once
#include <mutex>
#include <Logger.h>
#include <list>
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<Gui*> renderable_container;
protected:
bool rendering = true;
// Derived class will handle imgui calls
};
#pragma once
#include <mutex>
#include <Logger.h>
#include <list>
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<Gui*> renderable_container;
protected:
bool rendering = false;
// Derived class will handle imgui calls
};

@ -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<std::string> key_strings;
std::list<std::unique_ptr<vr::Event>> 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<vr::KeyPressed*>(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<vr::KeyPressed*>(event.get());
if (key_event->code == sf::Keyboard::Escape) {
window_ref->close();
}
}
};

@ -23,9 +23,13 @@ public:
void stop_recieving_from_clients();
void generate_events();
void dispatch_events();
private:
std::list<std::unique_ptr<vr::Event>> event_queue;
std::vector<sf::TcpSocket*> client_sockets;
sf::SocketSelector socket_selector;

@ -3,7 +3,6 @@
#include <iostream>
#include "Event.hpp"
#include <memory>
#include <list>
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<vr::Event::EventType> 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<vr::Event::EventType> type);
virtual void unsubscribe(VrEventSubscriber *s, vr::Event::EventType c);
virtual void notify_subscribers(std::unique_ptr<vr::Event> event);
private:
std::map<vr::Event::EventType, std::vector<VrEventSubscriber*>> subscribers;
protected:
virtual void notify_subscribers(std::unique_ptr<vr::Event> event) final;
virtual void dispatch_events() final;
virtual void generate_events() = 0;
std::list<std::unique_ptr<vr::Event>> event_queue;
};

@ -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;

@ -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<float> 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<float>(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() {
}

@ -97,7 +97,7 @@ void Camera::recieve_event(VrEventPublisher* publisher, std::unique_ptr<vr::Even
default_impulse = 1.0f;
}
else if (held_event->code == 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() {

@ -1,48 +0,0 @@
#include "FrameWatcher.h"
#include <chrono>
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<std::chrono::system_clock> start;
static bool started = false;
if (!started) {
start = std::chrono::system_clock::now();
started = true;
}
std::chrono::time_point<std::chrono::system_clock> now = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_time = now - start;
return static_cast<float>(elapsed_time.count());
}

@ -1,4 +1,4 @@
#include "Gui.h"
std::mutex Gui::container_lock;
#include "Gui.h"
std::mutex Gui::container_lock;
std::list<Gui*> Gui::renderable_container;

@ -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> sf_event_queue) {
}
}
const std::vector<std::string> 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<std::string> 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() {
}

@ -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);

@ -42,10 +42,3 @@ void VrEventPublisher::notify_subscribers(std::unique_ptr<vr::Event> event) {
}
}
void VrEventPublisher::dispatch_events() {
while (event_queue.size() != 0) {
notify_subscribers(std::move(event_queue.front()));
event_queue.pop_front();
}
}

@ -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<std::vector<int>> maze =
// generate_maze(sf::Vector2i(8, 8), sf::Vector2i(0, 0));
std::vector<std::vector<int>> 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);
}

Loading…
Cancel
Save