Removed some extra headers in util, restricted the scope of some others
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include <util.hpp>
|
#include <util.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "Pub_Sub.h"
|
#include "Pub_Sub.h"
|
||||||
|
#include "Vector4.hpp"
|
||||||
|
|
||||||
|
|
||||||
// Light Handle :
|
// Light Handle :
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <SFML/System/Vector3.hpp>
|
#include <SFML/System/Vector3.hpp>
|
||||||
|
#include <SFML/System/Clock.hpp>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include "util.hpp"
|
#include "util.hpp"
|
||||||
#include "map/Octree.h"
|
#include "map/Octree.h"
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#define _USE_MATH_DEFINES
|
#define _USE_MATH_DEFINES
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <raycaster/RayCaster.h>
|
#include <raycaster/RayCaster.h>
|
||||||
|
#include <Vector4.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <SFML/System/Vector3.hpp>
|
#include "Vector4.hpp"
|
||||||
#include <SFML/System/Vector2.hpp>
|
|
||||||
#include <map/Map.h>
|
#include <map/Map.h>
|
||||||
|
#include <SFML/Graphics.hpp>
|
||||||
|
|
||||||
|
|
||||||
class Old_Map;
|
class Old_Map;
|
||||||
class Camera;
|
class Camera;
|
||||||
struct PackedData;
|
struct PackedData;
|
||||||
|
|
||||||
|
|
||||||
class RayCaster {
|
class RayCaster {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,23 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <SFML/Graphics.hpp>
|
#include <SFML/System/Vector3.hpp>
|
||||||
#include "Vector4.hpp"
|
#include <SFML/System/Vector2.hpp>
|
||||||
#include <math.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iterator>
|
|
||||||
#include <list>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
|
|
||||||
const double PI = 3.141592653589793238463;
|
const double PI = 3.141592653589793238463;
|
||||||
const float PI_F = 3.14159265358979f;
|
const float PI_F = 3.14159265358979f;
|
||||||
|
|
||||||
struct fps_counter {
|
struct fps_counter {
|
||||||
public:
|
public:
|
||||||
fps_counter() {};
|
fps_counter() {};
|
||||||
|
|
||||||
void frame(double delta_time) {
|
void frame(double delta_time) {
|
||||||
|
|
||||||
// Apply 100 units of smoothing
|
// Apply 100 units of smoothing
|
||||||
if (frame_count == 100) {
|
if (frame_count == 100) {
|
||||||
frame_count = 0;
|
frame_count = 0;
|
||||||
@@ -53,33 +50,6 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct debug_text {
|
|
||||||
public:
|
|
||||||
debug_text(int slot, int pixel_spacing, void* data_, std::string prefix_) : data(data_), prefix(prefix_) {
|
|
||||||
if (!f.loadFromFile("../assets/fonts/Arial.ttf")) {
|
|
||||||
std::cout << "couldn't find the fall back Arial font in ../assets/fonts/" << std::endl;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
t.setFont(f);
|
|
||||||
t.setCharacterSize(20);
|
|
||||||
t.setPosition(static_cast<float>(20), static_cast<float>(slot * pixel_spacing));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void draw(sf::RenderWindow *r) {
|
|
||||||
t.setString(prefix + std::to_string(*(float*)data));
|
|
||||||
r->draw(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void* data;
|
|
||||||
std::string prefix;
|
|
||||||
sf::Font f;
|
|
||||||
sf::Text t;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
struct oct_state {
|
struct oct_state {
|
||||||
|
|
||||||
int parent_stack_position = 0;
|
int parent_stack_position = 0;
|
||||||
@@ -129,7 +99,6 @@ inline sf::Vector2f CartToNormalizedSphere(sf::Vector3f in) {
|
|||||||
atan2(sqrt(in.x * in.x + in.y * in.y), in.z),
|
atan2(sqrt(in.x * in.x + in.y * in.y), in.z),
|
||||||
atan2(in.y, in.x)
|
atan2(in.y, in.x)
|
||||||
);
|
);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,9 +115,9 @@ inline sf::Vector3f Normalize(sf::Vector3f in) {
|
|||||||
in.z / multiplier
|
in.z / multiplier
|
||||||
);
|
);
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline float DotProduct(sf::Vector3f a, sf::Vector3f b){
|
inline float DotProduct(sf::Vector3f a, sf::Vector3f b){
|
||||||
return a.x * b.x + a.y * b.y + a.z * b.z;
|
return a.x * b.x + a.y * b.y + a.z * b.z;
|
||||||
}
|
}
|
||||||
@@ -174,6 +143,7 @@ inline float RadiansToDegrees(float in) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline std::string read_file(std::string file_name){
|
inline std::string read_file(std::string file_name){
|
||||||
|
|
||||||
std::ifstream input_file(file_name);
|
std::ifstream input_file(file_name);
|
||||||
|
|
||||||
if (!input_file.is_open()){
|
if (!input_file.is_open()){
|
||||||
@@ -194,7 +164,6 @@ inline void PrettyPrintUINT64(uint64_t i, std::stringstream* ss) {
|
|||||||
*ss << "[" << std::bitset<8>(i >> 16) << "]";
|
*ss << "[" << std::bitset<8>(i >> 16) << "]";
|
||||||
*ss << "[" << std::bitset<8>(i >> 24) << "]";
|
*ss << "[" << std::bitset<8>(i >> 24) << "]";
|
||||||
*ss << "[" << std::bitset<32>(i >> 32) << "]";
|
*ss << "[" << std::bitset<32>(i >> 32) << "]";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void PrettyPrintUINT64(uint64_t i) {
|
inline void PrettyPrintUINT64(uint64_t i) {
|
||||||
@@ -204,7 +173,6 @@ inline void PrettyPrintUINT64(uint64_t i) {
|
|||||||
std::cout << "[" << std::bitset<8>(i >> 16) << "]";
|
std::cout << "[" << std::bitset<8>(i >> 16) << "]";
|
||||||
std::cout << "[" << std::bitset<8>(i >> 24) << "]";
|
std::cout << "[" << std::bitset<8>(i >> 24) << "]";
|
||||||
std::cout << "[" << std::bitset<32>(i >> 32) << "]" << std::endl;
|
std::cout << "[" << std::bitset<32>(i >> 32) << "]" << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void DumpLog(std::stringstream* ss, std::string file_name) {
|
inline void DumpLog(std::stringstream* ss, std::string file_name) {
|
||||||
@@ -213,9 +181,7 @@ inline void DumpLog(std::stringstream* ss, std::string file_name) {
|
|||||||
log_file.open(file_name);
|
log_file.open(file_name);
|
||||||
|
|
||||||
log_file << ss->str();
|
log_file << ss->str();
|
||||||
|
|
||||||
log_file.close();
|
log_file.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@@ -310,9 +276,8 @@ inline bool IsLeaf(const uint64_t descriptor) {
|
|||||||
// Only if valid and leaf are contiguous, then it's a leaf
|
// Only if valid and leaf are contiguous, then it's a leaf
|
||||||
if ((descriptor & leaf_mask) == leaf_mask)
|
if ((descriptor & leaf_mask) == leaf_mask)
|
||||||
return true;
|
return true;
|
||||||
else
|
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -277,11 +277,11 @@ int main() {
|
|||||||
handle->set_position(light);
|
handle->set_position(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
light_pos[0] = static_cast<float>(sin(elapsed_time) * 100.0f + 300.0f);
|
//light_pos[0] = static_cast<float>(sin(elapsed_time) * 100.0f + 300.0f);
|
||||||
light_pos[1] = static_cast<float>(sin(elapsed_time) * 100.0f + 300.0f);
|
//light_pos[1] = static_cast<float>(sin(elapsed_time) * 100.0f + 300.0f);
|
||||||
|
|
||||||
sf::Vector3f light(light_pos[0], light_pos[1], light_pos[2]);
|
//sf::Vector3f light(light_pos[0], light_pos[1], light_pos[2]);
|
||||||
handle->set_position(light);
|
//handle->set_position(light);
|
||||||
|
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ Map::Map(uint32_t dimensions) {
|
|||||||
else
|
else
|
||||||
voxel_data[i] = 1;
|
voxel_data[i] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Map::generate_children(sf::Vector3i pos, int voxel_scale) {
|
uint64_t Map::generate_children(sf::Vector3i pos, int voxel_scale) {
|
||||||
|
|||||||
Reference in New Issue
Block a user