Initial Commit, fresh git start
This commit is contained in:
commit
1fc1256846
20
.clang-format
Normal file
20
.clang-format
Normal file
@ -0,0 +1,20 @@
|
||||
BasedOnStyle: LLVM
|
||||
UseTab: ForIndentation
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
BreakBeforeBraces: Attach
|
||||
NamespaceIndentation: All
|
||||
PointerAlignment: Left
|
||||
ColumnLimit: 0
|
||||
16
.gitignore
vendored
Executable file
16
.gitignore
vendored
Executable file
@ -0,0 +1,16 @@
|
||||
*.vcxproj
|
||||
*.vcxproj.filters
|
||||
*.vcxproj.user
|
||||
*.sln
|
||||
*.dbscn
|
||||
*.make
|
||||
*.code-workspace
|
||||
Makefile
|
||||
|
||||
as.predefined_tmp
|
||||
|
||||
.vscode/
|
||||
bin/
|
||||
.vs/
|
||||
AS_DEBUG/
|
||||
Tasks/
|
||||
22
Build-Service.lua
Executable file
22
Build-Service.lua
Executable file
@ -0,0 +1,22 @@
|
||||
require("premakeExtensions/premake-vscode")
|
||||
|
||||
workspace "Deer"
|
||||
architecture "x64"
|
||||
configurations { "Debug", "Release", "Dist" }
|
||||
startproject "App"
|
||||
|
||||
|
||||
OutputDir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}"
|
||||
|
||||
group "core"
|
||||
include "Deer/Build-Service.lua"
|
||||
group ""
|
||||
|
||||
group "external"
|
||||
include "Deer/vendor/spdlog/Build.lua"
|
||||
include "Deer/vendor/angelScript/Build.lua"
|
||||
group ""
|
||||
|
||||
group "Runtime"
|
||||
include "DeerServer/Build.lua"
|
||||
group ""
|
||||
58
Deer/Build-Service.lua
Normal file
58
Deer/Build-Service.lua
Normal file
@ -0,0 +1,58 @@
|
||||
project "DeerService"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
cppdialect "C++20"
|
||||
targetdir "bin/%{cfg.buildcfg}"
|
||||
staticruntime "off"
|
||||
|
||||
|
||||
files {
|
||||
"src/Deer/**.h",
|
||||
"src/Deer/**.cpp"
|
||||
}
|
||||
includedirs
|
||||
{
|
||||
"src",
|
||||
"Include",
|
||||
"vendor/spdlog/include",
|
||||
"vendor/glm",
|
||||
"vendor/entt/include",
|
||||
"vendor/cereal/include",
|
||||
"vendor/angelScript/include",
|
||||
"vendor/smallVector"
|
||||
}
|
||||
|
||||
targetdir ("../bin/" .. OutputDir .. "/%{prj.name}")
|
||||
objdir ("../bin/int/" .. OutputDir .. "/%{prj.name}")
|
||||
|
||||
filter "system:windows"
|
||||
systemversion "latest"
|
||||
defines { "WINDOWS"}
|
||||
defines { }
|
||||
|
||||
filter "system:linux"
|
||||
toolset "clang"
|
||||
buildoptions { "-std=c++20" }
|
||||
defines { "LINUX"}
|
||||
files {
|
||||
"src/Plattform/linux/**.h",
|
||||
"src/Plattform/linux/**.cpp"
|
||||
}
|
||||
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines { "DEBUG" }
|
||||
runtime "Debug"
|
||||
symbols "On"
|
||||
|
||||
filter "configurations:Release"
|
||||
defines { "RELEASE" }
|
||||
runtime "Release"
|
||||
optimize "On"
|
||||
symbols "On"
|
||||
|
||||
filter "configurations:Dist"
|
||||
defines { "DIST" }
|
||||
runtime "Release"
|
||||
optimize "On"
|
||||
symbols "Off"
|
||||
112
Deer/Build.lua
Executable file
112
Deer/Build.lua
Executable file
@ -0,0 +1,112 @@
|
||||
project "Deer"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
cppdialect "C++20"
|
||||
targetdir "bin/%{cfg.buildcfg}"
|
||||
staticruntime "off"
|
||||
|
||||
files {
|
||||
"src/Deer/**.h",
|
||||
"src/Deer/**.cpp",
|
||||
"src/DeerRender/**.h",
|
||||
"src/DeerRender/**.cpp",
|
||||
"src/Plattform/OpenGL/**.h",
|
||||
"src/Plattform/OpenGL/**.cpp",
|
||||
"src/Plattform/ImGUI/**.h",
|
||||
"src/Plattform/ImGUI/**.cpp",
|
||||
"vendor/ImGuizmo/**.cpp"
|
||||
}
|
||||
|
||||
links { "spdlog", "GLFW", "glad", "ImGui", "angelScript" }
|
||||
defines { "DEER_RENDER" }
|
||||
|
||||
includedirs
|
||||
{
|
||||
"src",
|
||||
"Include",
|
||||
"vendor/spdlog/include",
|
||||
"vendor/GLFW/include",
|
||||
"vendor/glad/include",
|
||||
"vendor/imgui",
|
||||
"vendor/glm",
|
||||
"vendor/stb",
|
||||
"vendor/ImGuizmo",
|
||||
"vendor/entt/include",
|
||||
"vendor/cereal/include",
|
||||
"vendor/objload/include/objload",
|
||||
"vendor/angelScript/include",
|
||||
"vendor/smallVector"
|
||||
}
|
||||
|
||||
targetdir ("../bin/" .. OutputDir .. "/%{prj.name}")
|
||||
objdir ("../bin/int/" .. OutputDir .. "/%{prj.name}")
|
||||
|
||||
filter "system:windows"
|
||||
systemversion "latest"
|
||||
defines {"WINDOWS"}
|
||||
files {
|
||||
"src/Plattform/windows/**.h",
|
||||
"src/Plattform/windows/**.cpp"
|
||||
}
|
||||
|
||||
filter "system:linux"
|
||||
toolset "clang"
|
||||
defines {"LINUX"}
|
||||
buildoptions { "-std=c++20" }
|
||||
|
||||
local gtk_libs = os.outputof("pkg-config --libs gtk+-3.0")
|
||||
|
||||
links { "GL" }
|
||||
-- Files for GTK
|
||||
includedirs {
|
||||
"/usr/include/gtk-3.0", -- GTK3 headers
|
||||
"/usr/include/gdk-pixbuf-2.0", -- GDK Pixbuf headers
|
||||
"/usr/include/cairo", -- Cairo graphics library headers
|
||||
"/usr/include/pango-1.0", -- Pango text layout and rendering headers
|
||||
"/usr/include/atk-1.0", -- ATK accessibility toolkit headers
|
||||
"/usr/include/gdk-3.0", -- GDK headers
|
||||
"/usr/include/glib-2.0", -- GLib headers
|
||||
"/usr/lib/x86_64-linux-gnu/glib-2.0/include", -- GLib additional headers
|
||||
"/usr/include/harfbuzz"
|
||||
}
|
||||
|
||||
-- Link libraries for GTK3 and its dependencies
|
||||
links {
|
||||
"gtk-3", -- GTK3 library
|
||||
"gdk-3", -- GDK library
|
||||
"glib-2.0", -- GLib library
|
||||
"pango-1.0", -- Pango library
|
||||
"atk-1.0", -- ATK library
|
||||
"cairo", -- Cairo graphics library
|
||||
"gdk_pixbuf-2.0", -- GDK Pixbuf library
|
||||
"gio-2.0", -- GIO library
|
||||
"gobject-2.0", -- GObject library
|
||||
"pthread" -- POSIX threads library
|
||||
}
|
||||
|
||||
|
||||
links { "pthread" }
|
||||
buildoptions { "-pthread" }
|
||||
linkoptions { "-pthread" }
|
||||
|
||||
files {
|
||||
"src/Plattform/Linux/**.h",
|
||||
"src/Plattform/Linux/**.cpp"
|
||||
}
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines { "DEBUG" }
|
||||
runtime "Debug"
|
||||
symbols "On"
|
||||
|
||||
filter "configurations:Release"
|
||||
defines { "RELEASE" }
|
||||
runtime "Release"
|
||||
optimize "On"
|
||||
symbols "On"
|
||||
|
||||
filter "configurations:Dist"
|
||||
defines { "DIST" }
|
||||
runtime "Release"
|
||||
optimize "On"
|
||||
symbols "Off"
|
||||
32
Deer/Include/Deer/Application.h
Executable file
32
Deer/Include/Deer/Application.h
Executable file
@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Memory.h"
|
||||
|
||||
namespace Deer {
|
||||
class ImGuiLayer;
|
||||
namespace Core {
|
||||
extern int argc;
|
||||
extern char** argv;
|
||||
} // namespace Core
|
||||
|
||||
class Timestep {
|
||||
public:
|
||||
Timestep(float time = 0.0f) : m_time(time) {}
|
||||
|
||||
float getSeconds() const { return m_time; }
|
||||
float getMilliseconds() const { return m_time * 1000; }
|
||||
|
||||
private:
|
||||
float m_time;
|
||||
};
|
||||
|
||||
namespace Application {
|
||||
using Function = void (*)();
|
||||
|
||||
extern bool running;
|
||||
|
||||
void run();
|
||||
void setTickCallback(Function);
|
||||
|
||||
void shutdown();
|
||||
} // namespace Application
|
||||
} // namespace Deer
|
||||
91
Deer/Include/Deer/Components.h
Executable file
91
Deer/Include/Deer/Components.h
Executable file
@ -0,0 +1,91 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Memory.h"
|
||||
#include "Deer/Tools/SmallVector.h"
|
||||
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <stdint.h>
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Deer/Log.h"
|
||||
#include "glm/glm.hpp"
|
||||
#include "glm/gtc/quaternion.hpp"
|
||||
|
||||
#define ENTITY_BUFFER_CHILDREN 8
|
||||
// Here we define the core components of the ECS
|
||||
|
||||
namespace Deer {
|
||||
class ComponentScriptInstance;
|
||||
|
||||
struct TagComponent {
|
||||
std::string tag;
|
||||
uint32_t entityUID;
|
||||
|
||||
TagComponent() = default;
|
||||
TagComponent(const TagComponent&) = default;
|
||||
TagComponent(std::string name, uint32_t _id = 0)
|
||||
: tag(name), entityUID(_id) {}
|
||||
};
|
||||
|
||||
struct RelationshipComponent {
|
||||
uint16_t parent_id = 0;
|
||||
|
||||
// Use p-ranav's small_vector for children storage
|
||||
// Inline capacity ENTITY_MAX_CHILDREN, fallback to heap if exceeded
|
||||
ankerl::svector<uint16_t, ENTITY_BUFFER_CHILDREN> children;
|
||||
|
||||
inline uint16_t getChildId(size_t i) const {
|
||||
DEER_CORE_ASSERT(i < children.size() && children[i] != 0, "Invalid child request {0}", i);
|
||||
return children[i];
|
||||
}
|
||||
|
||||
inline void addChildId(uint16_t childId) {
|
||||
// Prevent duplicates
|
||||
for (auto id : children)
|
||||
if (id == childId)
|
||||
return;
|
||||
children.push_back(childId);
|
||||
}
|
||||
|
||||
inline bool removeChild(uint16_t childId) {
|
||||
for (size_t i = 0; i < children.size(); ++i) {
|
||||
if (children[i] == childId) {
|
||||
// Swap-remove for O(1)
|
||||
std::swap(children[i], children.back());
|
||||
children.pop_back();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline size_t getChildCount() const {
|
||||
return children.size();
|
||||
}
|
||||
|
||||
RelationshipComponent() = default;
|
||||
RelationshipComponent(const RelationshipComponent&) = default;
|
||||
RelationshipComponent(uint16_t _parent) : parent_id(_parent) {}
|
||||
};
|
||||
|
||||
struct TransformComponent {
|
||||
glm::vec3 position = glm::vec3(0.0f);
|
||||
glm::vec3 scale = glm::vec3(1.0f);
|
||||
glm::quat rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
TransformComponent() = default;
|
||||
TransformComponent(glm::vec3 _position) : position(_position) {}
|
||||
TransformComponent(const TransformComponent&) = default;
|
||||
|
||||
inline const glm::vec3 getEulerAngles() {
|
||||
return glm::degrees(glm::eulerAngles(rotation));
|
||||
}
|
||||
inline void setEulerAngles(const glm::vec3& eulerAngles) {
|
||||
rotation = glm::quat(glm::radians(eulerAngles));
|
||||
}
|
||||
|
||||
glm::mat4 getMatrix() const;
|
||||
};
|
||||
} // namespace Deer
|
||||
83
Deer/Include/Deer/DataManagment.h
Normal file
83
Deer/Include/Deer/DataManagment.h
Normal file
@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Memory.h"
|
||||
#include "Deer/Tools/TypeDefs.h"
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace Deer {
|
||||
/*
|
||||
class DataSource {
|
||||
public:
|
||||
using DataImporter = [ClassOfTheDataImporter]
|
||||
};
|
||||
*/
|
||||
using StorageMetadata = std::unordered_map<std::string, std::string>;
|
||||
template <typename T>
|
||||
concept HasMetadata = requires(const std::string& location) {
|
||||
{ T::loadMetadata(location) } -> std::same_as<StorageMetadata>;
|
||||
{ T::saveMetadata(StorageMetadata{}, location) };
|
||||
};
|
||||
|
||||
class StorageData {
|
||||
public:
|
||||
StorageData() = default;
|
||||
StorageData(uint32_t dataSize) : size(dataSize), data(MakeScope<uint8_t[]>(dataSize)) {}
|
||||
|
||||
inline uint8_t* getData() { return data.get(); }
|
||||
inline const uint8_t* getData() const { return data.get(); }
|
||||
inline uint32_t getSize() const { return size; }
|
||||
inline StorageMetadata& getMetadata() { return metadata; }
|
||||
|
||||
template <typename DataImporter, typename T>
|
||||
Scope<T> deserialize();
|
||||
|
||||
template <typename DataImporter, typename T>
|
||||
static StorageData serialize(const T&);
|
||||
|
||||
inline explicit operator bool() const { return size != 0; }
|
||||
|
||||
private:
|
||||
StorageMetadata metadata;
|
||||
Scope<uint8_t[]> data = nullptr;
|
||||
uint32_t size = 0;
|
||||
};
|
||||
|
||||
template <typename DataSource>
|
||||
class StorageBackend {
|
||||
public:
|
||||
static StorageData loadData(const std::string& location);
|
||||
static void saveData(const std::string& location, const StorageData& data);
|
||||
|
||||
static StorageMetadata loadMetadata(const std::string& location);
|
||||
static void saveMetadata(const StorageMetadata& metadata, const std::string& location);
|
||||
|
||||
static std::vector<std::string> indexResources(const std::string& location);
|
||||
};
|
||||
|
||||
template <typename DataSource>
|
||||
class DataManager {
|
||||
public:
|
||||
template <typename T>
|
||||
static Scope<T> load(const std::string& dataId) {
|
||||
StorageData data = StorageBackend<DataSource>::loadData(dataId);
|
||||
|
||||
if constexpr (HasMetadata<StorageBackend<DataSource>>) {
|
||||
data.getMetadata() = StorageBackend<DataSource>::loadMetadata(dataId);
|
||||
data.getMetadata()["dataId"] = dataId;
|
||||
}
|
||||
|
||||
return data.deserialize<typename DataSource::DataImporter, T>();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void store(const std::string& dataId, T& value) {
|
||||
StorageData data = StorageData::serialize<typename DataSource::DataImporter, T>(value);
|
||||
StorageBackend<DataSource>::saveData(dataId, data);
|
||||
if constexpr (HasMetadata<StorageBackend<DataSource>>) {
|
||||
StorageBackend<DataSource>::saveMetadata(data.getMetadata(), dataId);
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace Deer
|
||||
62
Deer/Include/Deer/DataStore.h
Executable file
62
Deer/Include/Deer/DataStore.h
Executable file
@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Deer/Tools/Path.h"
|
||||
|
||||
#define DEER_RESOURCE_PATH "Assets"
|
||||
|
||||
#define DEER_VOXEL_PATH "Voxels"
|
||||
#define DEER_VOXEL_DATA_PATH "Voxels/Data"
|
||||
#define DEER_VOXEL_ASPECT_PATH "Voxels/Visuals"
|
||||
#define DEER_VOXEL_TEXTURE_PATH "Voxels/Textures"
|
||||
#define DEER_VOXEL_SHADER_PATH "Voxels/Shaders"
|
||||
|
||||
#define DEER_EDITOR_PATH "Editor"
|
||||
#define DEER_EDITOR_PANEL_PATH "Editor/Panels"
|
||||
#define DEER_EDITOR_SERVICE_PATH "Editor/Services"
|
||||
|
||||
#define DEER_MESH_EXTENSION ".dmesh"
|
||||
#define DEER_SHADER_EXTENSION ".glsl"
|
||||
#define DEER_SCRIPT_EXTENSION ".as"
|
||||
|
||||
#define DEER_BIN_PATH "bin"
|
||||
#define DEER_TEMP_PATH "tmp"
|
||||
#define DEER_NULL_PATH "null"
|
||||
|
||||
namespace Deer {
|
||||
|
||||
struct DirectoryData {
|
||||
std::vector<Path> dirs;
|
||||
std::vector<Path> elements;
|
||||
};
|
||||
|
||||
// Namespace to manage memory interactions
|
||||
namespace DataStore {
|
||||
// Clears the cache of dir data
|
||||
void clearCache();
|
||||
|
||||
// Rerturns a directory data with the elements relative to the id
|
||||
const DirectoryData& getDirData(const Path& id, const Path& dir, const char* extension);
|
||||
|
||||
// TODO: Add safety
|
||||
// Returns the data of the specified file path
|
||||
bool loadFileData(const Path& id, const Path& name, uint8_t** data, uint32_t* size);
|
||||
// Returns the data of the specified file path avoiding extension
|
||||
bool loadGlobalFileData(const Path& id, const Path& name, uint8_t** data, uint32_t* size);
|
||||
void freeFileData(uint8_t*);
|
||||
|
||||
void createFolder(const Path& path);
|
||||
|
||||
void saveFile(const Path&, uint8_t* data, uint32_t size);
|
||||
uint8_t* readFile(const Path&, uint32_t* size);
|
||||
void deleteFile(const Path&);
|
||||
|
||||
// Refactor----
|
||||
void compressFiles(std::vector<Path> files, const Path& path);
|
||||
std::vector<Path> getFiles(const Path& path,
|
||||
const std::string& extension);
|
||||
// Refactor----
|
||||
} // namespace DataStore
|
||||
} // namespace Deer
|
||||
153
Deer/Include/Deer/Enviroment.h
Executable file
153
Deer/Include/Deer/Enviroment.h
Executable file
@ -0,0 +1,153 @@
|
||||
#pragma once
|
||||
#include "Deer/Components.h"
|
||||
#include "Deer/Log.h"
|
||||
#include "Deer/Tools/Memory.h"
|
||||
|
||||
#include "entt/entt.hpp"
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
#include "DeerRender/Render/FrameBuffer.h"
|
||||
#include "DeerRender/Scene.h"
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace Deer {
|
||||
class Entity;
|
||||
|
||||
class Environment {
|
||||
// Note: Outdated note
|
||||
///////// NOTES ///////////
|
||||
// - The entity id means the position in a array defined in Environment
|
||||
// - The entity id is relative to a Environment so it can be a complete
|
||||
// diferent entity in other environments
|
||||
// - The entity number 0 is allways the root
|
||||
// - There is a limit defined by ENVIRONMENT_MAX_ENTITIES of how many
|
||||
// entities can be in an Environment
|
||||
///////// NOTES ///////////
|
||||
public:
|
||||
Environment();
|
||||
~Environment();
|
||||
// This class can not be copyed
|
||||
Environment(const Environment&) = delete;
|
||||
Environment& operator=(Environment&) = delete;
|
||||
|
||||
// Clears all entities
|
||||
void clear();
|
||||
// Obtains the entity
|
||||
Entity& getEntity(uint16_t id);
|
||||
bool entityExists(uint16_t id) const;
|
||||
uint16_t getEntityCount() const;
|
||||
|
||||
// Creates a entity child at root
|
||||
// WARNING: This method can change internal pointers and invalidate entitiy references
|
||||
Entity& createEntity(const std::string& name = "");
|
||||
// Can be slow! This has to empty the stack of empty entities in case its necessary so use it in ascendent order!
|
||||
// WARNING: This method can change internal pointers and invalidate entitiy references
|
||||
Entity& createEntityWithId(uint16_t id, const std::string& name = "");
|
||||
void destroyEntity(uint16_t id);
|
||||
|
||||
// Special behaviour
|
||||
// WARNING: This method can change internal pointers and invalidate entitiy references
|
||||
Entity createEmptyEntity();
|
||||
|
||||
// FEO
|
||||
uint16_t tryGetMainCamera() const;
|
||||
void setMainCamera(Entity& entity);
|
||||
|
||||
// Obtains the entity that is on the root of the environment
|
||||
inline Entity& getRoot() { return getEntity(0); }
|
||||
#ifdef DEER_RENDER
|
||||
void render(SceneCamera& camera);
|
||||
#endif
|
||||
Scope<entt::registry> m_registry;
|
||||
|
||||
private:
|
||||
uint16_t m_mainCamera = 0;
|
||||
|
||||
std::stack<u_int16_t> unused_entities_spaces;
|
||||
std::vector<Entity> entities;
|
||||
|
||||
friend class Entity;
|
||||
};
|
||||
|
||||
// Warning: This calss does not initialize for performance
|
||||
class Entity {
|
||||
public:
|
||||
Entity() {}
|
||||
Entity(const Entity&) = delete;
|
||||
|
||||
Entity(Entity&&) noexcept;
|
||||
Entity& operator=(Entity&&) noexcept;
|
||||
|
||||
Entity& duplicate();
|
||||
void destroy();
|
||||
|
||||
uint16_t getId() const { return entId; }
|
||||
Entity& getParent() const;
|
||||
inline uint16_t getParentId() const { return parentId; }
|
||||
|
||||
// TODO, enable transfer entitys from difrent environments
|
||||
void setParent(Entity& parent);
|
||||
bool isDescendantOf(Entity& parent) const;
|
||||
|
||||
Environment* getEnvironment() const { return environment; }
|
||||
|
||||
bool isRoot() const { return entId == 0; }
|
||||
glm::mat4 getWorldMatrix() const;
|
||||
glm::mat4 getRelativeMatrix() const;
|
||||
|
||||
void tickExecution();
|
||||
void clear();
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
private:
|
||||
Environment* environment = nullptr;
|
||||
entt::entity entHandle = entt::null;
|
||||
uint16_t entId = 0;
|
||||
uint16_t parentId = 0;
|
||||
|
||||
Entity(entt::entity handle, Environment* scene, uint16_t entityID);
|
||||
|
||||
friend class Environment;
|
||||
|
||||
public:
|
||||
template <typename T, typename... Args>
|
||||
T& addComponent(Args&&... args) const {
|
||||
DEER_CORE_ASSERT(
|
||||
!environment->m_registry->all_of<T>(entHandle),
|
||||
"Entity already have component {0}", typeid(T).name());
|
||||
|
||||
return environment->m_registry->emplace<T>(
|
||||
entHandle, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T& getComponent() const {
|
||||
DEER_CORE_ASSERT(
|
||||
environment->m_registry->all_of<T>(entHandle),
|
||||
"Entity has no component {0}", typeid(T).name());
|
||||
|
||||
return environment->m_registry->get<T>(entHandle);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool hasComponent() const {
|
||||
return environment->m_registry->all_of<T>(entHandle);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void removeComponent() const {
|
||||
DEER_CORE_ASSERT(
|
||||
environment->m_registry->all_of<T>(entHandle),
|
||||
"Entity does not have component {0}", typeid(T).name());
|
||||
|
||||
environment->m_registry->remove<T>(entHandle);
|
||||
}
|
||||
};
|
||||
} // namespace Deer
|
||||
78
Deer/Include/Deer/Log.h
Executable file
78
Deer/Include/Deer/Log.h
Executable file
@ -0,0 +1,78 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Memory.h"
|
||||
#include "spdlog/sinks/stdout_color_sinks.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
namespace spdlog {
|
||||
class logger;
|
||||
}
|
||||
|
||||
// Simple file to define logs functions optimized depending on the compilation
|
||||
|
||||
namespace Deer {
|
||||
class Log {
|
||||
public:
|
||||
static void init();
|
||||
static void shutdown();
|
||||
|
||||
static void coreTrace(const char* msg);
|
||||
|
||||
static inline Ref<spdlog::logger>& getCoreLogger() {
|
||||
return coreLogger;
|
||||
}
|
||||
static inline Ref<spdlog::logger>& getClientLogger() {
|
||||
return clientLogger;
|
||||
}
|
||||
static inline Ref<spdlog::logger>& getScriptLogger() {
|
||||
return scriptLogger;
|
||||
}
|
||||
static inline Ref<spdlog::logger>& getEditorEngineLogger() {
|
||||
return EditorEngineLogger;
|
||||
}
|
||||
|
||||
private:
|
||||
static Ref<spdlog::logger> coreLogger;
|
||||
static Ref<spdlog::logger> clientLogger;
|
||||
static Ref<spdlog::logger> scriptLogger;
|
||||
static Ref<spdlog::logger> EditorEngineLogger;
|
||||
};
|
||||
} // namespace Deer
|
||||
|
||||
#define DEER_CORE_TRACE(...) Deer::Log::getCoreLogger()->trace(__VA_ARGS__)
|
||||
#define DEER_CORE_INFO(...) Deer::Log::getCoreLogger()->info(__VA_ARGS__)
|
||||
#define DEER_CORE_WARN(...) Deer::Log::getCoreLogger()->warn(__VA_ARGS__)
|
||||
#define DEER_CORE_ERROR(...) Deer::Log::getCoreLogger()->error(__VA_ARGS__)
|
||||
|
||||
#define DEER_SCRIPT_TRACE(...) Deer::Log::getScriptLogger()->trace(__VA_ARGS__)
|
||||
#define DEER_SCRIPT_INFO(...) Deer::Log::getScriptLogger()->info(__VA_ARGS__)
|
||||
#define DEER_SCRIPT_WARN(...) Deer::Log::getScriptLogger()->warn(__VA_ARGS__)
|
||||
#define DEER_SCRIPT_ERROR(...) Deer::Log::getScriptLogger()->error(__VA_ARGS__)
|
||||
|
||||
#define DEER_EDITOR_ENGINE_TRACE(...) Deer::Log::getEditorEngineLogger()->trace(__VA_ARGS__)
|
||||
#define DEER_EDITOR_ENGINE_INFO(...) Deer::Log::getEditorEngineLogger()->info(__VA_ARGS__)
|
||||
#define DEER_EDITOR_ENGINE_WARN(...) Deer::Log::getEditorEngineLogger()->warn(__VA_ARGS__)
|
||||
#define DEER_EDITOR_ENGINE_ERROR(...) Deer::Log::getEditorEngineLogger()->error(__VA_ARGS__)
|
||||
|
||||
#ifdef LINUX
|
||||
#define DEER_CORE_ASSERT(condition, ...) \
|
||||
if (!(condition)) { \
|
||||
Deer::Log::getCoreLogger()->error(__VA_ARGS__); \
|
||||
__builtin_trap(); \
|
||||
}
|
||||
#define DEER_SCRIPT_ASSERT(condition, ...) \
|
||||
if (!(condition)) { \
|
||||
Deer::Log::getScriptLogger()->error(__VA_ARGS__); \
|
||||
}
|
||||
#endif
|
||||
#ifdef WINDOWS
|
||||
#define DEER_CORE_ASSERT(condition, ...) \
|
||||
if (!(condition)) { \
|
||||
Deer::Log::getCoreLogger()->error(__VA_ARGS__); \
|
||||
__debugbreak(); \
|
||||
}
|
||||
#define DEER_SCRIPT_ASSERT(condition, ...) \
|
||||
if (!(condition)) { \
|
||||
Deer::Log::getScriptLogger()->error(__VA_ARGS__); \
|
||||
__debugbreak(); \
|
||||
}
|
||||
#endif
|
||||
51
Deer/Include/Deer/Scene.h
Executable file
51
Deer/Include/Deer/Scene.h
Executable file
@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include "Deer/DataStore.h"
|
||||
#include "Deer/Tools/Memory.h"
|
||||
#include "Deer/Tools/Path.h"
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
#include "DeerRender/GizmoRenderer.h"
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Deer {
|
||||
class Environment;
|
||||
class GizmoRenderer;
|
||||
|
||||
// A scene is a 3d simulation with its environment and voxel world in case
|
||||
// of initialized, here things can be simulated
|
||||
namespace Scene {
|
||||
// Clears all the assets and memory the Scene had conained
|
||||
void clear();
|
||||
|
||||
// This is the cycle to execution of scripts and physics
|
||||
void initExecution();
|
||||
void tickExecution();
|
||||
void endExecution();
|
||||
|
||||
bool getExecutingState();
|
||||
uint32_t getCurrentExTick();
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
// This function renders with the default camera in the environment
|
||||
void render();
|
||||
void render(SceneCamera);
|
||||
|
||||
extern GizmoRenderer gizmoRenderer;
|
||||
#endif
|
||||
extern Environment environment;
|
||||
} // namespace Scene
|
||||
|
||||
// Namespace to manage scenes in memory
|
||||
namespace DataStore {
|
||||
void loadScene(const Path& name);
|
||||
void exportScene(const Path& name);
|
||||
|
||||
void exportRuntimeScene();
|
||||
void importRuntimeScene();
|
||||
} // namespace DataStore
|
||||
} // namespace Deer
|
||||
20
Deer/Include/Deer/Tools/Memory.h
Normal file
20
Deer/Include/Deer/Tools/Memory.h
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
// Simple file to redefine memory for easier usage
|
||||
|
||||
namespace Deer {
|
||||
template <typename T>
|
||||
using Scope = std::unique_ptr<T>;
|
||||
|
||||
template <typename T, typename... Args>
|
||||
constexpr auto MakeScope(Args&&... args) {
|
||||
return std::make_unique<T>(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
using Ref = std::shared_ptr<T>;
|
||||
|
||||
template <typename T>
|
||||
using WeakRef = std::weak_ptr<T>;
|
||||
} // namespace Deer
|
||||
10
Deer/Include/Deer/Tools/Path.h
Executable file
10
Deer/Include/Deer/Tools/Path.h
Executable file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include <filesystem>
|
||||
|
||||
// Simple file to rename path for easier usage
|
||||
|
||||
namespace Deer {
|
||||
using Path = std::filesystem::path;
|
||||
|
||||
Path toLowerCasePath(const Path& inputPath);
|
||||
} // namespace Deer
|
||||
1000
Deer/Include/Deer/Tools/SmallVector.h
Normal file
1000
Deer/Include/Deer/Tools/SmallVector.h
Normal file
File diff suppressed because it is too large
Load Diff
2
Deer/Include/Deer/Tools/TypeDefs.h
Normal file
2
Deer/Include/Deer/Tools/TypeDefs.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
296
Deer/Include/Deer/Voxel.h
Executable file
296
Deer/Include/Deer/Voxel.h
Executable file
@ -0,0 +1,296 @@
|
||||
// Structure definition for voxel and voxel manipulation
|
||||
// copyright Copyright (c) 2025 Deer
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Deer/Tools/Memory.h"
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
#include "DeerRender/VoxelAspect.h"
|
||||
|
||||
namespace Deer {
|
||||
class Texture2D;
|
||||
class Shader;
|
||||
} // namespace Deer
|
||||
#endif
|
||||
|
||||
#define VOXEL_INFO_TYPE_AIR "air"
|
||||
#define VOXEL_INFO_TYPE_VOXEL "voxel"
|
||||
#define VOXEL_INFO_TYPE_TRANSPARENT_VOXEL "transparentVoxel"
|
||||
#define VOXEL_INFO_TYPE_CUSTOM "custom"
|
||||
|
||||
#define CHUNK_SIZE_X 32
|
||||
#define CHUNK_SIZE_Y 32
|
||||
#define CHUNK_SIZE_Z 32
|
||||
#define CHUNK_SIZE(axis) \
|
||||
((axis == 0) ? CHUNK_SIZE_X : (axis == 1) ? CHUNK_SIZE_Y \
|
||||
: CHUNK_SIZE_Z)
|
||||
|
||||
#define LAYER_VOXELS CHUNK_SIZE_X* CHUNK_SIZE_Z
|
||||
#define CHUNK_VOXELS CHUNK_SIZE_X* CHUNK_SIZE_Y* CHUNK_SIZE_Z
|
||||
|
||||
// TODO: Change this to be a inline function
|
||||
#define VOXEL_POSITION(id) \
|
||||
id.z + id.y* CHUNK_SIZE_Z + id.x* CHUNK_SIZE_Z* CHUNK_SIZE_Y
|
||||
#define LAYER_VOXEL_POSITION(id) id.z + id.x* CHUNK_SIZE_Z
|
||||
|
||||
#define X_AXIS 0
|
||||
#define Y_AXIS 1
|
||||
#define Z_AXIS 2
|
||||
|
||||
// TODO: Change this to be a inline function
|
||||
#define NORMAL_DIR(axis, normal) normalDirs[axis + normal * 3]
|
||||
|
||||
namespace Deer {
|
||||
struct Voxel;
|
||||
struct LayerVoxel;
|
||||
|
||||
extern Voxel nullVoxel;
|
||||
extern Voxel emptyVoxel;
|
||||
extern LayerVoxel nullLayerVoxel;
|
||||
extern int normalDirs[3 * 6];
|
||||
|
||||
enum NormalDirection : uint8_t {
|
||||
NORMAL_LEFT = 0,
|
||||
NORMAL_RIGHT = 1,
|
||||
NORMAL_DOWN = 2,
|
||||
NORMAL_UP = 3,
|
||||
NORMAL_BACK = 4,
|
||||
NORMAL_FRONT = 5
|
||||
};
|
||||
|
||||
enum class VoxelInfoType : uint8_t {
|
||||
Air = 0,
|
||||
Voxel = 1,
|
||||
TransparentVoxel = 2,
|
||||
Custom = 3
|
||||
};
|
||||
|
||||
// Defines the general data of a voxel id stored in the array
|
||||
// DataStore::voxelsInfo
|
||||
struct VoxelInfo {
|
||||
std::string name;
|
||||
VoxelInfoType type = VoxelInfoType::Air;
|
||||
};
|
||||
|
||||
// Namespace to load and manage voxel data
|
||||
namespace DataStore {
|
||||
// List of the voxels loaded with loadVoxelsData()
|
||||
extern std::vector<VoxelInfo> voxelsInfo;
|
||||
|
||||
// Loads basic voxel data from folder DEER_VOXEL_DATA_PATH defined in
|
||||
// DataStore.h
|
||||
void loadVoxelsData();
|
||||
void createExampleVoxelData();
|
||||
|
||||
int32_t getVoxelID(const std::string&);
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
// List of the voxels Aspect loaded with loadVoxelsAspect()
|
||||
extern std::vector<VoxelAspect> voxelsAspect;
|
||||
|
||||
// Loads voxel aspect from folder DEER_VOXEL_ASPECT_PATH defined in
|
||||
// DataStore.h
|
||||
void loadVoxelsAspect();
|
||||
void createExampleVoxelAspect();
|
||||
|
||||
// Generates the texture atlas that the voxels demanded from folder
|
||||
// DEER_VOXEL_TEXTURE_PATH defined in DataStore.h Warning : This
|
||||
// function must be called with a render context, otherwise this will
|
||||
// crash
|
||||
void generateTextureAtlas();
|
||||
// Loads the shaders for rendering chunks from folder
|
||||
// DEER_VOXEL_SHADER_PATH defined in DataStore.h
|
||||
void loadVoxelsShaders();
|
||||
|
||||
// Returns with & height of the texture atlas generated
|
||||
// Warning: If you call this before generate Texture Atlas the return
|
||||
// value will be 0
|
||||
int getVoxelTextureAtlasSize();
|
||||
// Texture atlas created with generateTextureAtlas() call
|
||||
// Warning: You must have called generateTextureAtlas() in order to work
|
||||
/// Ref<Texture2D>& getVoxelColorTextureAtlas();
|
||||
// Returns the shader created with loadVoxelsShaders()
|
||||
// Warning: You must have called loadVoxelsShaders() in order to work
|
||||
/// Ref<Shader>& getSolidVoxelShader();
|
||||
|
||||
#endif
|
||||
} // namespace DataStore
|
||||
|
||||
// Structure to define what a voxel inside a world must have
|
||||
struct Voxel {
|
||||
// Reference to the voxel id
|
||||
uint16_t id = 0;
|
||||
|
||||
Voxel() = default;
|
||||
Voxel(uint16_t _id) : id(_id) {}
|
||||
|
||||
inline bool operator==(const Voxel& b) const { return id == b.id; }
|
||||
inline bool isVoxelType() const {
|
||||
return DataStore::voxelsInfo[id].type == VoxelInfoType::Voxel;
|
||||
}
|
||||
};
|
||||
|
||||
// Structure to define the general cordinates of a voxel in the world
|
||||
struct VoxelCordinates {
|
||||
union {
|
||||
struct {
|
||||
int32_t x, y, z;
|
||||
};
|
||||
std::array<int32_t, 3> data;
|
||||
};
|
||||
|
||||
VoxelCordinates(int32_t _x = 0, int32_t _y = 0, int32_t _z = 0)
|
||||
: x(_x), y(_y), z(_z) {}
|
||||
|
||||
inline int32_t& operator[](int id) { return data[id]; }
|
||||
inline bool operator==(const VoxelCordinates& b) const {
|
||||
return x == b.x && y == b.y && z == b.z;
|
||||
}
|
||||
inline bool isNull() const { return x < 0 || y < 0 || z < 0; }
|
||||
inline void makeNull() { x = -1; }
|
||||
};
|
||||
|
||||
// Stucture that defines the info of a layer voxel
|
||||
struct LayerVoxel {
|
||||
uint16_t height = 0;
|
||||
#ifdef DEER_RENDER
|
||||
uint16_t ambient_light_height = 0;
|
||||
#endif
|
||||
|
||||
LayerVoxel() = default;
|
||||
LayerVoxel(uint16_t _height) : height(_height) {}
|
||||
};
|
||||
|
||||
// Returning info of a raycast
|
||||
struct VoxelRayResult {
|
||||
float distance = 0;
|
||||
VoxelCordinates hitPos;
|
||||
uint8_t face = 0;
|
||||
};
|
||||
|
||||
// Coordinates of a chunk
|
||||
struct ChunkID {
|
||||
union {
|
||||
struct {
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
uint16_t z;
|
||||
};
|
||||
std::array<uint16_t, 3> axis;
|
||||
};
|
||||
|
||||
ChunkID(uint16_t _x = 0, uint16_t _y = 0, uint16_t _z = 0)
|
||||
: x(_x), y(_y), z(_z) {}
|
||||
|
||||
inline bool operator==(const ChunkID& b) const {
|
||||
return x == b.x && y == b.y && z == b.z;
|
||||
}
|
||||
inline uint16_t& operator[](size_t i) { return axis[i]; }
|
||||
};
|
||||
|
||||
struct ChunkIDHash {
|
||||
size_t operator()(const ChunkID& chunk) const {
|
||||
size_t h1 = std::hash<uint16_t>{}(chunk.x);
|
||||
size_t h2 = std::hash<uint16_t>{}(chunk.y);
|
||||
size_t h3 = std::hash<uint16_t>{}(chunk.z);
|
||||
|
||||
size_t result = h1;
|
||||
result = result * 31 + h2;
|
||||
result = result * 31 + h3;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
// Cordinates of a Layer
|
||||
struct LayerID {
|
||||
uint16_t x = 0;
|
||||
uint16_t z = 0;
|
||||
|
||||
LayerID() = default;
|
||||
LayerID(uint16_t _x, uint16_t _z) : x(_x), z(_z) {}
|
||||
inline bool operator==(const LayerID& b) const {
|
||||
return x == b.x && z == b.z;
|
||||
}
|
||||
};
|
||||
|
||||
// Coordinates of a layer voxel relative to the Layer Chunk
|
||||
struct LayerVoxelID {
|
||||
uint8_t x = 0;
|
||||
uint8_t z = 0;
|
||||
|
||||
LayerVoxelID() = default;
|
||||
LayerVoxelID(uint8_t _x, uint8_t _z = 0) : x(_x), z(_z) {}
|
||||
};
|
||||
|
||||
// Coordinates of a voxel inside a Chunk
|
||||
struct ChunkVoxelID {
|
||||
union {
|
||||
struct {
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
uint8_t z;
|
||||
};
|
||||
std::array<uint8_t, 3> axis;
|
||||
};
|
||||
|
||||
ChunkVoxelID(uint8_t _x = 0, uint8_t _y = 0, uint8_t _z = 0)
|
||||
: x(_x), y(_y), z(_z) {}
|
||||
inline uint8_t& operator[](size_t i) { return axis[i]; }
|
||||
};
|
||||
|
||||
// Extracts the chunk coordinaes and the chunk voxel coordinates from a
|
||||
// world position
|
||||
inline void extractChunkCordinates(uint32_t x, uint32_t y, uint32_t z,
|
||||
ChunkID& _chunkID,
|
||||
ChunkVoxelID& _chunkVoxelID) {
|
||||
uint16_t posX = x;
|
||||
uint16_t posY = y;
|
||||
uint16_t posZ = z;
|
||||
|
||||
_chunkID.x = posX >> 5;
|
||||
_chunkID.y = posY >> 5;
|
||||
_chunkID.z = posZ >> 5;
|
||||
|
||||
_chunkVoxelID.x = posX & 31;
|
||||
_chunkVoxelID.y = posY & 31;
|
||||
_chunkVoxelID.z = posZ & 31;
|
||||
}
|
||||
|
||||
// Extracts the chunk coordinaes and the chunk voxel chunk coordinates from
|
||||
// a world position
|
||||
inline void extractChunkCordinates(VoxelCordinates coords,
|
||||
ChunkID& _chunkID,
|
||||
ChunkVoxelID& _chunkVoxelID) {
|
||||
uint16_t posX = coords.x;
|
||||
uint16_t posY = coords.y;
|
||||
uint16_t posZ = coords.z;
|
||||
|
||||
_chunkID.x = posX >> 5;
|
||||
_chunkID.y = posY >> 5;
|
||||
_chunkID.z = posZ >> 5;
|
||||
|
||||
_chunkVoxelID.x = posX & 31;
|
||||
_chunkVoxelID.y = posY & 31;
|
||||
_chunkVoxelID.z = posZ & 31;
|
||||
}
|
||||
|
||||
// Extracts the layer chunk coordinaes and the layer chunk voxel coordinates
|
||||
// from a world position
|
||||
inline void extractLayerCordinates(uint32_t x, uint32_t z,
|
||||
LayerID& _layerID,
|
||||
LayerVoxelID& _layerVoxelID) {
|
||||
uint16_t posX = x;
|
||||
uint16_t posZ = z;
|
||||
|
||||
_layerID.x = posX >> 5;
|
||||
_layerID.z = posZ >> 5;
|
||||
|
||||
_layerVoxelID.x = posX & 31;
|
||||
_layerVoxelID.z = posZ & 31;
|
||||
}
|
||||
} // namespace Deer
|
||||
209
Deer/Include/Deer/VoxelWorld.h
Executable file
209
Deer/Include/Deer/VoxelWorld.h
Executable file
@ -0,0 +1,209 @@
|
||||
// copyright Copyright (c) 2025 Deer
|
||||
#pragma once
|
||||
#include <array>
|
||||
|
||||
#include "Deer/Tools/Memory.h"
|
||||
#include "Deer/Voxel.h"
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
#include "DeerRender/Voxel.h"
|
||||
#endif
|
||||
|
||||
#include "glm/glm.hpp"
|
||||
|
||||
namespace Deer {
|
||||
class Chunk;
|
||||
class Layer;
|
||||
struct SceneCamera;
|
||||
struct VoxelWorldProps;
|
||||
struct VoxelWorldRenderData;
|
||||
|
||||
// Properties of a Voxel World
|
||||
struct VoxelWorldProps {
|
||||
union {
|
||||
struct {
|
||||
uint8_t chunkSizeX;
|
||||
uint8_t chunkSizeY;
|
||||
uint8_t chunkSizeZ;
|
||||
};
|
||||
std::array<uint8_t, 3> axis;
|
||||
};
|
||||
|
||||
VoxelWorldProps() = default;
|
||||
VoxelWorldProps(uint8_t _chunkSizeX, uint8_t _chunkSizeY,
|
||||
uint8_t _chunkSizeZ)
|
||||
: chunkSizeX(_chunkSizeX),
|
||||
chunkSizeY(_chunkSizeY),
|
||||
chunkSizeZ(_chunkSizeZ) {}
|
||||
|
||||
inline uint8_t& operator[](size_t i) { return axis[i]; }
|
||||
|
||||
// Returns the count of chunks
|
||||
inline int getChunkCount() const {
|
||||
return chunkSizeX * chunkSizeY * chunkSizeZ;
|
||||
}
|
||||
// Returns the count of layers
|
||||
inline int getLayerCount() const { return chunkSizeX * chunkSizeZ; }
|
||||
// Returns the internal id of a chunk relative to a Voxel World Props
|
||||
// from a chunk id
|
||||
inline int getWorldChunkID(ChunkID chunkID) const {
|
||||
return chunkID.z + chunkID.y * chunkSizeZ +
|
||||
chunkID.x * chunkSizeZ * chunkSizeY;
|
||||
}
|
||||
// Returns the internal id of a layer relative to a Voxel World Props
|
||||
// from a Layer id
|
||||
inline int getWorldLayerID(LayerID layerID) const {
|
||||
return layerID.z + layerID.x * chunkSizeZ;
|
||||
}
|
||||
|
||||
// Extracts the LayerID from a internal Layer id relative to Voxel World
|
||||
// Props
|
||||
inline LayerID getLayerID(int id) const {
|
||||
LayerID l_id;
|
||||
|
||||
l_id.x = id / chunkSizeZ;
|
||||
id -= l_id.x * chunkSizeZ;
|
||||
|
||||
l_id.z = id;
|
||||
return l_id;
|
||||
}
|
||||
// Extracts the ChunkID from a internal Chunk id relative to Voxel World
|
||||
// Props
|
||||
inline ChunkID getChunkID(int id) const {
|
||||
ChunkID c_id;
|
||||
|
||||
c_id.x = id / (chunkSizeZ * chunkSizeY);
|
||||
id -= c_id.x * (chunkSizeZ * chunkSizeY);
|
||||
|
||||
c_id.y = id / chunkSizeZ;
|
||||
id -= c_id.y * chunkSizeZ;
|
||||
|
||||
c_id.z = id;
|
||||
return c_id;
|
||||
}
|
||||
|
||||
// Checks if the Chunk id is inside the voxel World bounds
|
||||
inline bool isValid(ChunkID chunkID) const {
|
||||
return chunkID.x >= 0 && chunkID.x < chunkSizeX && chunkID.y >= 0 &&
|
||||
chunkID.y < chunkSizeY && chunkID.z >= 0 &&
|
||||
chunkID.z < chunkSizeZ;
|
||||
}
|
||||
|
||||
// Checks if the Layer id is inside the voxel World bounds
|
||||
inline bool isValid(LayerID layerID) const {
|
||||
return layerID.x >= 0 && layerID.x < chunkSizeX && layerID.z >= 0 &&
|
||||
layerID.z < chunkSizeZ;
|
||||
}
|
||||
|
||||
// Returns the max amount of voxels in the Voxel World Props
|
||||
inline int getMaxVoxelCount() const {
|
||||
return getChunkCount() * CHUNK_VOXELS;
|
||||
}
|
||||
|
||||
// Clamps the coordinates of a Voxel World Coordinates to be inside the
|
||||
// voxel world props
|
||||
inline void clampCordinates(VoxelCordinates& coords) const {
|
||||
if (coords.x < 0)
|
||||
coords.x = 0;
|
||||
else if (coords.x >= chunkSizeX * CHUNK_SIZE_X)
|
||||
coords.x = chunkSizeX * CHUNK_SIZE_X - 1;
|
||||
|
||||
if (coords.y < 0)
|
||||
coords.y = 0;
|
||||
else if (coords.y >= chunkSizeY * CHUNK_SIZE_Y)
|
||||
coords.y = chunkSizeY * CHUNK_SIZE_Y - 1;
|
||||
|
||||
if (coords.z < 0)
|
||||
coords.z = 0;
|
||||
else if (coords.z >= chunkSizeZ * CHUNK_SIZE_Z)
|
||||
coords.z = chunkSizeZ * CHUNK_SIZE_Z - 1;
|
||||
}
|
||||
|
||||
// Takes 2 Voxel coordinates and outputs them in the same variables
|
||||
// being the min with the min values and the max with the max This is
|
||||
// useful for loops
|
||||
inline void clampAndSetMinMax(VoxelCordinates& min,
|
||||
VoxelCordinates& max) const {
|
||||
VoxelCordinates a_cache = min;
|
||||
VoxelCordinates b_cache = max;
|
||||
|
||||
for (int x = 0; x < 3; x++) {
|
||||
if (a_cache[x] > b_cache[x]) {
|
||||
max[x] = a_cache[x];
|
||||
min[x] = b_cache[x];
|
||||
} else {
|
||||
min[x] = a_cache[x];
|
||||
max[x] = b_cache[x];
|
||||
}
|
||||
}
|
||||
|
||||
clampCordinates(min);
|
||||
clampCordinates(max);
|
||||
}
|
||||
};
|
||||
|
||||
// Class to manage the voxels
|
||||
namespace VoxelWorld {
|
||||
void initialize(const VoxelWorldProps&);
|
||||
void clear();
|
||||
|
||||
// Returns the voxel in a voxel coordinates
|
||||
Voxel readVoxel(VoxelCordinates);
|
||||
// Sets the voxel in the coordinates to the value
|
||||
void setVoxel(VoxelCordinates, Voxel value);
|
||||
|
||||
// Fills a space with the voxel value inside the 2 coordinates
|
||||
// Note that you don't have to give then ordeered by min and max
|
||||
void fillVoxels(VoxelCordinates, VoxelCordinates, Voxel value);
|
||||
// Remplaces the ref voxel with the value of a space inside the 2 coordinates
|
||||
// Note that you don't have to give then ordeered by min and max
|
||||
void remplaceVoxels(VoxelCordinates, VoxelCordinates, Voxel ref, Voxel value);
|
||||
|
||||
// Returns the layer data of a woorld coordinates
|
||||
// Note out of bounds will return a default Layer Voxel
|
||||
LayerVoxel readLayerVoxel(int x, int z);
|
||||
// Calculates the max height of a layer in a space
|
||||
// Note out of bounds will return a 0 of height
|
||||
// Tip: this will calculate, you should use the cached height in a layer voxel
|
||||
uint16_t calculateLayerVoxelHeight(int x, int z);
|
||||
|
||||
// Raycast a ray from a source and dir
|
||||
VoxelRayResult rayCast(glm::vec3 position, glm::vec3 dir,
|
||||
float maxDistance = 10.0f);
|
||||
// Raycast a ray from a source and dir ignoring if the ray stats inside a voxel
|
||||
VoxelRayResult rayCast_editor(glm::vec3 position, glm::vec3 dir,
|
||||
float maxDistance = 10.0f);
|
||||
|
||||
bool isInitialized();
|
||||
|
||||
// Returns the voxel world props used in the voxel world
|
||||
// Note that you can't change the world size unless you create a new Voxel World
|
||||
const VoxelWorldProps& getWorldProps();
|
||||
#ifdef DEER_RENDER
|
||||
// Renders the current voxel world with a specified scene camera
|
||||
void render(const SceneCamera&);
|
||||
// Generates the next chunk mesh
|
||||
void bakeNextChunk();
|
||||
|
||||
// Light data
|
||||
VoxelLight readLight(VoxelCordinates);
|
||||
VoxelLight& modLight(VoxelCordinates);
|
||||
|
||||
// Chunk vertex creation
|
||||
void genSolidVoxel(ChunkID chunkID, ChunkVoxelID chunkVoxelID);
|
||||
|
||||
// --- Light propagation ---
|
||||
// Warning: This function is private and needs to have min and max
|
||||
// clamped and in order
|
||||
void bakeVoxelLight(VoxelCordinates min, VoxelCordinates max);
|
||||
void bakeVoxelLightFromPoint(VoxelCordinates);
|
||||
void bakeAmbientLight(int minX, int maxX, int minZ, int maxZ);
|
||||
void bakeAmbientLightFromPoint(int x, int z);
|
||||
|
||||
void resolveNextAmbientLightPropagation();
|
||||
void resolveNextVoxelLightPropagation();
|
||||
#endif
|
||||
|
||||
LayerVoxel& modLayerVoxel(int x, int z);
|
||||
} // namespace VoxelWorld
|
||||
} // namespace Deer
|
||||
21
Deer/Include/DeerRender/Application.h
Normal file
21
Deer/Include/DeerRender/Application.h
Normal file
@ -0,0 +1,21 @@
|
||||
#include "Deer/Application.h"
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
#include "DeerRender/Events/ApplicationEvent.h"
|
||||
#include "DeerRender/Events/Event.h"
|
||||
#include "DeerRender/Window.h"
|
||||
#endif
|
||||
|
||||
namespace Deer {
|
||||
namespace Application {
|
||||
using EventFunction = void(*)(Event&);
|
||||
|
||||
void initWindow();
|
||||
void shutdownWindow();
|
||||
|
||||
void setRenderCallback(Function);
|
||||
void setEventCallback(EventFunction);
|
||||
|
||||
Window& getWindow();
|
||||
}
|
||||
}
|
||||
51
Deer/Include/DeerRender/Components.h
Executable file
51
Deer/Include/DeerRender/Components.h
Executable file
@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include "Deer/Components.h"
|
||||
|
||||
#include "DeerRender/Mesh.h"
|
||||
#include "DeerRender/Shader.h"
|
||||
#include "DeerRender/Texture.h"
|
||||
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include "glm/glm.hpp"
|
||||
#include "glm/gtc/matrix_transform.hpp"
|
||||
#include "glm/gtc/quaternion.hpp"
|
||||
#define MAX_TEXTURE_BINDINGS 4
|
||||
|
||||
namespace Deer {
|
||||
struct MeshComponent {
|
||||
MeshComponent() = default;
|
||||
MeshComponent(Resource<GPUMesh> _mesh) : mesh(_mesh) {}
|
||||
MeshComponent(const MeshComponent&) = default;
|
||||
|
||||
Resource<GPUMesh> mesh;
|
||||
bool active = true;
|
||||
};
|
||||
|
||||
struct ShaderComponent {
|
||||
ShaderComponent() = default;
|
||||
ShaderComponent(Resource<Shader> _shader) : shader(_shader) {}
|
||||
ShaderComponent(const ShaderComponent&) = default;
|
||||
|
||||
Resource<Shader> shader;
|
||||
Resource<Texture> texture;
|
||||
};
|
||||
|
||||
struct CameraComponent {
|
||||
CameraComponent() = default;
|
||||
CameraComponent(const CameraComponent&) = default;
|
||||
|
||||
float fov = glm::radians(50.0f);
|
||||
float aspect = 16 / 9;
|
||||
float nearZ = 0.1f;
|
||||
float farZ = 1000;
|
||||
|
||||
inline glm::mat4 getMatrix() const { return glm::perspective(fov, aspect, nearZ, farZ); }
|
||||
};
|
||||
|
||||
struct TextureComponent {
|
||||
TextureComponent() = default;
|
||||
TextureComponent(const TextureComponent&) = default;
|
||||
|
||||
Resource<Texture> texture;
|
||||
};
|
||||
} // namespace Deer
|
||||
2
Deer/Include/DeerRender/DataManager.h
Normal file
2
Deer/Include/DeerRender/DataManager.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "Deer/DataManager.h"
|
||||
2
Deer/Include/DeerRender/DataManagment.h
Normal file
2
Deer/Include/DeerRender/DataManagment.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "Deer/DataManagment.h"
|
||||
2
Deer/Include/DeerRender/DataStore.h
Normal file
2
Deer/Include/DeerRender/DataStore.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "Deer/DataStore.h"
|
||||
2
Deer/Include/DeerRender/Enviroment.h
Normal file
2
Deer/Include/DeerRender/Enviroment.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "Deer/Enviroment.h"
|
||||
36
Deer/Include/DeerRender/Events/ApplicationEvent.h
Executable file
36
Deer/Include/DeerRender/Events/ApplicationEvent.h
Executable file
@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
#include "DeerRender/Events/Event.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace Deer {
|
||||
class WindowResizeEvent : public Event {
|
||||
public:
|
||||
WindowResizeEvent(unsigned int width, unsigned int height)
|
||||
: m_Width(width), m_Height(height) {}
|
||||
|
||||
inline unsigned int getWidth() const { return m_Width; }
|
||||
inline unsigned int getHeight() const { return m_Height; }
|
||||
|
||||
std::string toString() const override {
|
||||
std::stringstream ss;
|
||||
ss << "WindowResizeEvent: " << m_Width << ", " << m_Height;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
EVENT_CLASS_TYPE(WindowResize)
|
||||
EVENT_CLASS_CATEGORY(EventCategoryApplication)
|
||||
private:
|
||||
unsigned int m_Width, m_Height;
|
||||
};
|
||||
|
||||
class WindowCloseEvent : public Event {
|
||||
public:
|
||||
WindowCloseEvent() = default;
|
||||
std::string toString() const override {
|
||||
return "Window close";
|
||||
}
|
||||
|
||||
EVENT_CLASS_TYPE(WindowClose)
|
||||
EVENT_CLASS_CATEGORY(EventCategoryApplication)
|
||||
};
|
||||
}
|
||||
68
Deer/Include/DeerRender/Events/Event.h
Executable file
68
Deer/Include/DeerRender/Events/Event.h
Executable file
@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <functional>
|
||||
|
||||
namespace Deer {
|
||||
enum class EventType
|
||||
{
|
||||
None = 0,
|
||||
WindowClose, WindowMinimize, WindowResize, WindowFocus, WindowLostFocus, WindowMoved,
|
||||
AppUpdate, AppRender,
|
||||
KeyPressed, KeyReleased, KeyTyped,
|
||||
MouseButtonPressed, MouseButtonReleased, MouseButtonDown, MouseMoved, MouseScrolled
|
||||
};
|
||||
|
||||
enum EventCategory {
|
||||
None = 0,
|
||||
EventCategoryApplication = 1 << 0,
|
||||
EventCategoryInput = 1 << 1,
|
||||
EventCategoryKeyboard = 1 << 2,
|
||||
EventCategoryMouse = 1 << 3,
|
||||
EventCategoryMouseButton = 1 << 4
|
||||
};
|
||||
|
||||
#define EVENT_CLASS_TYPE(type) static EventType getStaticType() { return EventType::type; }\
|
||||
virtual EventType getEventType() const override { return getStaticType(); }\
|
||||
virtual const char* getName() const override { return #type; }
|
||||
|
||||
#define EVENT_CLASS_CATEGORY(category) virtual int getCategoryFlags() const override { return category; }
|
||||
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
bool handled = false;
|
||||
|
||||
virtual ~Event() {}
|
||||
virtual EventType getEventType() const = 0;
|
||||
virtual const char* getName() const = 0;
|
||||
virtual int getCategoryFlags() const = 0;
|
||||
virtual std::string toString() const { return getName(); }
|
||||
|
||||
inline bool isInCategory(EventCategory category)
|
||||
{
|
||||
return getCategoryFlags() & category;
|
||||
}
|
||||
};
|
||||
|
||||
class EventDispatcher
|
||||
{
|
||||
template<typename T>
|
||||
using EventFn = std::function<bool(T&)>;
|
||||
public:
|
||||
EventDispatcher(Event& event)
|
||||
: m_event(event) {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool dispatch(EventFn<T> func) {
|
||||
if (m_event.getEventType() == T::getStaticType() && !m_event.handled)
|
||||
{
|
||||
m_event.handled = func(*(T*)&m_event);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
Event& m_event;
|
||||
};
|
||||
}
|
||||
71
Deer/Include/DeerRender/Events/KeyEvent.h
Executable file
71
Deer/Include/DeerRender/Events/KeyEvent.h
Executable file
@ -0,0 +1,71 @@
|
||||
#pragma once
|
||||
#include "DeerRender/Events/Event.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace Deer {
|
||||
|
||||
class KeyEvent : public Event
|
||||
{
|
||||
public:
|
||||
inline unsigned short getKeyCode() const { return m_KeyCode; }
|
||||
|
||||
EVENT_CLASS_CATEGORY(EventCategoryKeyboard | EventCategoryInput)
|
||||
protected:
|
||||
KeyEvent(unsigned short keycode)
|
||||
: m_KeyCode(keycode) {}
|
||||
|
||||
unsigned short m_KeyCode;
|
||||
};
|
||||
|
||||
class KeyPressedEvent : public KeyEvent
|
||||
{
|
||||
public:
|
||||
KeyPressedEvent(unsigned int keycode, int repeatCount)
|
||||
: KeyEvent(keycode), m_RepeatCount(repeatCount) {}
|
||||
|
||||
inline int getRepeatCount() const { return m_RepeatCount; }
|
||||
|
||||
std::string toString() const override
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "KeyPressedEvent: " << m_KeyCode << " (" << m_RepeatCount << " repeats)";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
EVENT_CLASS_TYPE(KeyPressed)
|
||||
private:
|
||||
int m_RepeatCount;
|
||||
};
|
||||
|
||||
class KeyReleasedEvent : public KeyEvent
|
||||
{
|
||||
public:
|
||||
KeyReleasedEvent(unsigned int keycode)
|
||||
: KeyEvent(keycode) {}
|
||||
|
||||
std::string toString() const override
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "KeyReleasedEvent: " << m_KeyCode;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
EVENT_CLASS_TYPE(KeyReleased)
|
||||
};
|
||||
|
||||
class KeyTypedEvent : public KeyEvent
|
||||
{
|
||||
public:
|
||||
KeyTypedEvent(unsigned int keycode)
|
||||
: KeyEvent(keycode) {}
|
||||
|
||||
std::string toString() const override
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "KeyTypedEvent: " << m_KeyCode;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
EVENT_CLASS_TYPE(KeyTyped)
|
||||
};
|
||||
}
|
||||
108
Deer/Include/DeerRender/Events/MouseEvent.h
Executable file
108
Deer/Include/DeerRender/Events/MouseEvent.h
Executable file
@ -0,0 +1,108 @@
|
||||
#pragma once
|
||||
#include "DeerRender/Events/Event.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace Deer {
|
||||
class MouseMovedEvent : public Event
|
||||
{
|
||||
public:
|
||||
MouseMovedEvent(float x, float y)
|
||||
: m_MouseX(x), m_MouseY(y) {}
|
||||
|
||||
inline float getX() const { return m_MouseX; }
|
||||
inline float getY() const { return m_MouseY; }
|
||||
|
||||
std::string toString() const override
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "MouseMovedEvent: " << m_MouseX << ", " << m_MouseY;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
EVENT_CLASS_TYPE(MouseMoved)
|
||||
EVENT_CLASS_CATEGORY(EventCategoryMouse | EventCategoryInput)
|
||||
private:
|
||||
float m_MouseX, m_MouseY;
|
||||
};
|
||||
|
||||
class MouseScrolledEvent : public Event
|
||||
{
|
||||
public:
|
||||
MouseScrolledEvent(float xOffset, float yOffset)
|
||||
: m_XOffset(xOffset), m_YOffset(yOffset) {}
|
||||
|
||||
inline float getXOffset() const { return m_XOffset; }
|
||||
inline float getYOffset() const { return m_YOffset; }
|
||||
|
||||
std::string toString() const override
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "MouseScrolledEvent: " << getXOffset() << ", " << getYOffset();
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
EVENT_CLASS_TYPE(MouseScrolled)
|
||||
EVENT_CLASS_CATEGORY(EventCategoryMouse | EventCategoryInput)
|
||||
private:
|
||||
float m_XOffset, m_YOffset;
|
||||
};
|
||||
|
||||
class MouseButtonEvent : public Event
|
||||
{
|
||||
public:
|
||||
inline int getMouseButton() const { return m_Button; }
|
||||
|
||||
EVENT_CLASS_CATEGORY(EventCategoryMouse | EventCategoryInput)
|
||||
protected:
|
||||
MouseButtonEvent(int button)
|
||||
: m_Button(button) {}
|
||||
|
||||
int m_Button;
|
||||
};
|
||||
|
||||
class MouseButtonPressedEvent : public MouseButtonEvent
|
||||
{
|
||||
public:
|
||||
MouseButtonPressedEvent(int button)
|
||||
: MouseButtonEvent(button) {}
|
||||
|
||||
std::string toString() const override {
|
||||
std::stringstream ss;
|
||||
ss << "MouseButtonPressedEvent: " << m_Button;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
EVENT_CLASS_TYPE(MouseButtonPressed)
|
||||
};
|
||||
|
||||
class MouseButtonReleasedEvent : public MouseButtonEvent
|
||||
{
|
||||
public:
|
||||
MouseButtonReleasedEvent(int button)
|
||||
: MouseButtonEvent(button) {}
|
||||
|
||||
std::string toString() const override {
|
||||
std::stringstream ss;
|
||||
ss << "MouseButtonReleasedEvent: " << m_Button;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
EVENT_CLASS_TYPE(MouseButtonReleased)
|
||||
};
|
||||
|
||||
class MouseButtonDownEvent : public MouseButtonEvent
|
||||
{
|
||||
public:
|
||||
MouseButtonDownEvent(int button)
|
||||
: MouseButtonEvent(button) {
|
||||
}
|
||||
|
||||
std::string toString() const override {
|
||||
std::stringstream ss;
|
||||
ss << "MouseButtonDownEvent: " << m_Button;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
EVENT_CLASS_TYPE(MouseButtonDown)
|
||||
};
|
||||
}
|
||||
22
Deer/Include/DeerRender/FrameBuffer.h
Normal file
22
Deer/Include/DeerRender/FrameBuffer.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include "DeerRender/Render/FrameBuffer.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Deer {
|
||||
// TODO: Add safety
|
||||
namespace FrameBufferManager {
|
||||
uint16_t createRGBA8FrameBuffer(std::string& name, int, int);
|
||||
void resizeFrameBuffer(uint16_t frameBufferId, int, int);
|
||||
|
||||
int getFrameBufferWidth(uint16_t frameBufferId);
|
||||
int getFrameBufferHeight(uint16_t frameBufferId);
|
||||
|
||||
const std::string& getFrameBufferName(uint16_t);
|
||||
uint16_t getFrameBufferId(std::string& name);
|
||||
FrameBuffer& getFrameBuffer(uint16_t);
|
||||
|
||||
void unloadAllFrameBuffer();
|
||||
}
|
||||
}
|
||||
33
Deer/Include/DeerRender/GizmoRenderer.h
Executable file
33
Deer/Include/DeerRender/GizmoRenderer.h
Executable file
@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include "glm/glm.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <array>
|
||||
|
||||
#define GIZMO_DEPTH 8
|
||||
|
||||
namespace Deer {
|
||||
struct SceneCamera;
|
||||
struct GizmoFace {
|
||||
glm::vec3 positions[4];
|
||||
uint16_t textureID;
|
||||
uint8_t face;
|
||||
};
|
||||
|
||||
class GizmoRenderer {
|
||||
public:
|
||||
void drawLine(glm::vec3 a, glm::vec3 b, glm::vec3 color = glm::vec3(1.0f, 1.0f, 1.0f));
|
||||
void drawVoxelLine(int x, int y, int z, glm::vec3 color = glm::vec3(1.0f, 1.0f, 1.0f));
|
||||
void drawVoxelLineFace(int x, int y, int z, uint8_t face, glm::vec3 color = glm::vec3(1.0f, 1.0f, 1.0f));
|
||||
|
||||
void drawVoxelFace(int x, int y, int z, uint16_t voxelID, uint8_t face, uint8_t priority = 0);
|
||||
void drawVoxelFaceInverted(int x, int y, int z, uint16_t voxelID, uint8_t face, uint8_t priority = 0);
|
||||
|
||||
void render(const SceneCamera& camera);
|
||||
void refresh();
|
||||
private:
|
||||
std::vector<std::array<glm::vec3, 3>> m_lines;
|
||||
std::array<std::vector<GizmoFace>, GIZMO_DEPTH> m_faces;
|
||||
};
|
||||
}
|
||||
|
||||
148
Deer/Include/DeerRender/Input.h
Executable file
148
Deer/Include/DeerRender/Input.h
Executable file
@ -0,0 +1,148 @@
|
||||
#pragma once
|
||||
#include "Deer/Application.h"
|
||||
|
||||
namespace Deer {
|
||||
class Input {
|
||||
public:
|
||||
static bool isKeyPressed(unsigned int key);
|
||||
static bool isMouseButtonPressed(int button);
|
||||
static void getMousePos(float& x, float& y);
|
||||
};
|
||||
} // namespace Deer
|
||||
|
||||
// From GLFW
|
||||
#define DEER_KEY_SPACE 32
|
||||
#define DEER_KEY_APOSTROPHE 39 /* ' */
|
||||
#define DEER_KEY_COMMA 44 /* , */
|
||||
#define DEER_KEY_MINUS 45 /* - */
|
||||
#define DEER_KEY_PERIOD 46 /* . */
|
||||
#define DEER_KEY_SLASH 47 /* / */
|
||||
#define DEER_KEY_0 48
|
||||
#define DEER_KEY_1 49
|
||||
#define DEER_KEY_2 50
|
||||
#define DEER_KEY_3 51
|
||||
#define DEER_KEY_4 52
|
||||
#define DEER_KEY_5 53
|
||||
#define DEER_KEY_6 54
|
||||
#define DEER_KEY_7 55
|
||||
#define DEER_KEY_8 56
|
||||
#define DEER_KEY_9 57
|
||||
#define DEER_KEY_SEMICOLON 59 /* ; */
|
||||
#define DEER_KEY_EQUAL 61 /* = */
|
||||
#define DEER_KEY_A 65
|
||||
#define DEER_KEY_B 66
|
||||
#define DEER_KEY_C 67
|
||||
#define DEER_KEY_D 68
|
||||
#define DEER_KEY_E 69
|
||||
#define DEER_KEY_F 70
|
||||
#define DEER_KEY_G 71
|
||||
#define DEER_KEY_H 72
|
||||
#define DEER_KEY_I 73
|
||||
#define DEER_KEY_J 74
|
||||
#define DEER_KEY_K 75
|
||||
#define DEER_KEY_L 76
|
||||
#define DEER_KEY_M 77
|
||||
#define DEER_KEY_N 78
|
||||
#define DEER_KEY_O 79
|
||||
#define DEER_KEY_P 80
|
||||
#define DEER_KEY_Q 81
|
||||
#define DEER_KEY_R 82
|
||||
#define DEER_KEY_S 83
|
||||
#define DEER_KEY_T 84
|
||||
#define DEER_KEY_U 85
|
||||
#define DEER_KEY_V 86
|
||||
#define DEER_KEY_W 87
|
||||
#define DEER_KEY_X 88
|
||||
#define DEER_KEY_Y 89
|
||||
#define DEER_KEY_Z 90
|
||||
#define DEER_KEY_LEFT_BRACKET 91 /* [ */
|
||||
#define DEER_KEY_BACKSLASH 92 /* \ */
|
||||
#define DEER_KEY_RIGHT_BRACKET 93 /* ] */
|
||||
#define DEER_KEY_GRAVE_ACCENT 96 /* ` */
|
||||
#define DEER_KEY_WORLD_1 161 /* non-US #1 */
|
||||
#define DEER_KEY_WORLD_2 162 /* non-US #2 */
|
||||
|
||||
/* Function keys */
|
||||
#define DEER_KEY_ESCAPE 256
|
||||
#define DEER_KEY_ENTER 257
|
||||
#define DEER_KEY_TAB 258
|
||||
#define DEER_KEY_BACKSPACE 259
|
||||
#define DEER_KEY_INSERT 260
|
||||
#define DEER_KEY_DELETE 261
|
||||
#define DEER_KEY_RIGHT 262
|
||||
#define DEER_KEY_LEFT 263
|
||||
#define DEER_KEY_DOWN 264
|
||||
#define DEER_KEY_UP 265
|
||||
#define DEER_KEY_PAGE_UP 266
|
||||
#define DEER_KEY_PAGE_DOWN 267
|
||||
#define DEER_KEY_HOME 268
|
||||
#define DEER_KEY_END 269
|
||||
#define DEER_KEY_CAPS_LOCK 280
|
||||
#define DEER_KEY_SCROLL_LOCK 281
|
||||
#define DEER_KEY_NUM_LOCK 282
|
||||
#define DEER_KEY_PRINT_SCREEN 283
|
||||
#define DEER_KEY_PAUSE 284
|
||||
#define DEER_KEY_F1 290
|
||||
#define DEER_KEY_F2 291
|
||||
#define DEER_KEY_F3 292
|
||||
#define DEER_KEY_F4 293
|
||||
#define DEER_KEY_F5 294
|
||||
#define DEER_KEY_F6 295
|
||||
#define DEER_KEY_F7 296
|
||||
#define DEER_KEY_F8 297
|
||||
#define DEER_KEY_F9 298
|
||||
#define DEER_KEY_F10 299
|
||||
#define DEER_KEY_F11 300
|
||||
#define DEER_KEY_F12 301
|
||||
#define DEER_KEY_F13 302
|
||||
#define DEER_KEY_F14 303
|
||||
#define DEER_KEY_F15 304
|
||||
#define DEER_KEY_F16 305
|
||||
#define DEER_KEY_F17 306
|
||||
#define DEER_KEY_F18 307
|
||||
#define DEER_KEY_F19 308
|
||||
#define DEER_KEY_F20 309
|
||||
#define DEER_KEY_F21 310
|
||||
#define DEER_KEY_F22 311
|
||||
#define DEER_KEY_F23 312
|
||||
#define DEER_KEY_F24 313
|
||||
#define DEER_KEY_F25 314
|
||||
#define DEER_KEY_KP_0 320
|
||||
#define DEER_KEY_KP_1 321
|
||||
#define DEER_KEY_KP_2 322
|
||||
#define DEER_KEY_KP_3 323
|
||||
#define DEER_KEY_KP_4 324
|
||||
#define DEER_KEY_KP_5 325
|
||||
#define DEER_KEY_KP_6 326
|
||||
#define DEER_KEY_KP_7 327
|
||||
#define DEER_KEY_KP_8 328
|
||||
#define DEER_KEY_KP_9 329
|
||||
#define DEER_KEY_KP_DECIMAL 330
|
||||
#define DEER_KEY_KP_DIVIDE 331
|
||||
#define DEER_KEY_KP_MULTIPLY 332
|
||||
#define DEER_KEY_KP_SUBTRACT 333
|
||||
#define DEER_KEY_KP_ADD 334
|
||||
#define DEER_KEY_KP_ENTER 335
|
||||
#define DEER_KEY_KP_EQUAL 336
|
||||
#define DEER_KEY_LEFT_SHIFT 340
|
||||
#define DEER_KEY_LEFT_CONTROL 341
|
||||
#define DEER_KEY_LEFT_ALT 342
|
||||
#define DEER_KEY_LEFT_SUPER 343
|
||||
#define DEER_KEY_RIGHT_SHIFT 344
|
||||
#define DEER_KEY_RIGHT_CONTROL 345
|
||||
#define DEER_KEY_RIGHT_ALT 346
|
||||
#define DEER_KEY_RIGHT_SUPER 347
|
||||
#define DEER_KEY_MENU 348
|
||||
|
||||
#define DEER_MOUSE_BUTTON_1 0
|
||||
#define DEER_MOUSE_BUTTON_2 1
|
||||
#define DEER_MOUSE_BUTTON_3 2
|
||||
#define DEER_MOUSE_BUTTON_4 3
|
||||
#define DEER_MOUSE_BUTTON_5 4
|
||||
#define DEER_MOUSE_BUTTON_6 5
|
||||
#define DEER_MOUSE_BUTTON_7 6
|
||||
#define DEER_MOUSE_BUTTON_8 7
|
||||
#define DEER_MOUSE_BUTTON_LAST DEER_MOUSE_BUTTON_8
|
||||
#define DEER_MOUSE_BUTTON_LEFT DEER_MOUSE_BUTTON_1
|
||||
#define DEER_MOUSE_BUTTON_RIGHT DEER_MOUSE_BUTTON_2
|
||||
#define DEER_MOUSE_BUTTON_MIDDLE DEER_MOUSE_BUTTON_3
|
||||
2
Deer/Include/DeerRender/Log.h
Normal file
2
Deer/Include/DeerRender/Log.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "Deer/Log.h"
|
||||
97
Deer/Include/DeerRender/Mesh.h
Normal file
97
Deer/Include/DeerRender/Mesh.h
Normal file
@ -0,0 +1,97 @@
|
||||
#pragma once
|
||||
#include "DeerRender/Render/VertexArray.h"
|
||||
#include "DeerRender/Resource.h"
|
||||
#include "DeerRender/Tools/Memory.h"
|
||||
#include "DeerRender/Tools/Path.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Deer {
|
||||
struct VertexPosition {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
|
||||
VertexPosition() = default;
|
||||
VertexPosition(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {}
|
||||
};
|
||||
|
||||
struct VertexUV {
|
||||
float u;
|
||||
float v;
|
||||
|
||||
VertexUV() = default;
|
||||
VertexUV(float _u, float _v) : u(_u), v(_v) {}
|
||||
};
|
||||
|
||||
// Vertex normal is represented with a number fromn [-64,64], and then its
|
||||
// divided by 64 to know the decimal number
|
||||
struct VertexNormal {
|
||||
int8_t x = 0;
|
||||
int8_t y = 0;
|
||||
int8_t z = 0;
|
||||
|
||||
VertexNormal() = default;
|
||||
VertexNormal(int8_t _x, int8_t _y, int8_t _z) : x(_x), y(_y), z(_z) {}
|
||||
};
|
||||
|
||||
struct MeshData {
|
||||
public:
|
||||
void createVertices(uint32_t count) {
|
||||
vertexPositionsData = MakeScope<VertexPosition[]>(count);
|
||||
vertexNormalData = MakeScope<VertexNormal[]>(count);
|
||||
vertexCount = count;
|
||||
}
|
||||
void createUVData() { vertexUVData = MakeScope<VertexUV[]>(vertexCount); }
|
||||
void createIndices(uint32_t count) {
|
||||
indexData = MakeScope<uint32_t[]>(count);
|
||||
indexCount = count;
|
||||
}
|
||||
|
||||
inline VertexPosition* getVertexPosition() const { return vertexPositionsData.get(); }
|
||||
inline VertexNormal* getVertexNormal() const { return vertexNormalData.get(); }
|
||||
inline VertexUV* getVertexUV() const { return vertexUVData.get(); }
|
||||
inline uint32_t* getIndexData() const { return indexData.get(); }
|
||||
|
||||
inline uint32_t getVertexCount() const { return vertexCount; }
|
||||
inline uint32_t getIndexCount() const { return indexCount; }
|
||||
|
||||
private:
|
||||
uint32_t vertexCount = 0;
|
||||
Scope<VertexPosition[]> vertexPositionsData;
|
||||
Scope<VertexNormal[]> vertexNormalData;
|
||||
Scope<VertexUV[]> vertexUVData;
|
||||
|
||||
uint32_t indexCount = 0;
|
||||
Scope<uint32_t[]> indexData;
|
||||
};
|
||||
|
||||
struct GPUMesh {
|
||||
Scope<VertexArray> vertexArray;
|
||||
};
|
||||
|
||||
template <>
|
||||
class ResourceBuilder<GPUMesh> {
|
||||
public:
|
||||
using BaseDataType = MeshData;
|
||||
static Scope<GPUMesh> buildResource(const BaseDataType& baseData);
|
||||
};
|
||||
|
||||
namespace MeshManager {
|
||||
uint16_t loadModel(const Path&);
|
||||
uint16_t loadModel(const MeshData&, const Path&);
|
||||
VertexArray& getModel(uint16_t model_id);
|
||||
const Path& getModelName(uint16_t model_id);
|
||||
|
||||
void unloadAllModels();
|
||||
} // namespace MeshManager
|
||||
|
||||
namespace DataStore {
|
||||
void saveModel(const MeshData&, const Path& name);
|
||||
void loadModel(MeshData&, const Path& name);
|
||||
|
||||
void saveBinModel(const MeshData&, const Path& name);
|
||||
|
||||
void createExampleMeshData();
|
||||
} // namespace DataStore
|
||||
} // namespace Deer
|
||||
121
Deer/Include/DeerRender/Render/Buffer.h
Executable file
121
Deer/Include/DeerRender/Render/Buffer.h
Executable file
@ -0,0 +1,121 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Memory.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Deer {
|
||||
enum class ShaderDataType {
|
||||
None = 0,
|
||||
FloatingPoint,
|
||||
NormalizedFloatingPoint,
|
||||
Integer
|
||||
};
|
||||
|
||||
enum class DataType {
|
||||
None = 0,
|
||||
Half,
|
||||
Half2,
|
||||
Half3,
|
||||
Half4,
|
||||
Float,
|
||||
Float2,
|
||||
Float3,
|
||||
Float4,
|
||||
|
||||
Byte,
|
||||
Byte2,
|
||||
Byte3,
|
||||
Byte4,
|
||||
Short,
|
||||
Short2,
|
||||
Short3,
|
||||
Short4,
|
||||
Int,
|
||||
Int2,
|
||||
Int3,
|
||||
Int4,
|
||||
|
||||
Unsigned_Byte,
|
||||
Unsigned_Byte2,
|
||||
Unsigned_Byte3,
|
||||
Unsigned_Byte4,
|
||||
Unsigned_Short,
|
||||
Unsigned_Short2,
|
||||
Unsigned_Short3,
|
||||
Unsigned_Short4,
|
||||
Unsigned_Int,
|
||||
Unsigned_Int2,
|
||||
Unsigned_Int3,
|
||||
Unsigned_Int4
|
||||
};
|
||||
|
||||
enum class IndexDataType {
|
||||
None = 0,
|
||||
Unsigned_Byte,
|
||||
Unsigned_Short,
|
||||
Unsigned_Int,
|
||||
};
|
||||
|
||||
unsigned int dataTypeSize(DataType type);
|
||||
unsigned int dataTypeCount(DataType type);
|
||||
unsigned int indexDataTypeSize(IndexDataType type);
|
||||
|
||||
struct BufferElement {
|
||||
std::string name;
|
||||
DataType type;
|
||||
ShaderDataType shaderType;
|
||||
int offset;
|
||||
|
||||
BufferElement(std::string _name, DataType _type, ShaderDataType _shaderType = ShaderDataType::FloatingPoint,
|
||||
int _offset = -1)
|
||||
: name(_name), type(_type), shaderType(_shaderType), offset(_offset) {
|
||||
}
|
||||
};
|
||||
|
||||
class BufferLayout {
|
||||
public:
|
||||
BufferLayout() {}
|
||||
BufferLayout(const std::initializer_list<BufferElement>& elements, int _stride = -1)
|
||||
: m_bufferElements(elements), m_stride(_stride) {
|
||||
calculateOffsetAndStride();
|
||||
}
|
||||
BufferLayout(const std::vector<BufferElement> elements)
|
||||
: m_bufferElements(elements) {
|
||||
calculateOffsetAndStride();
|
||||
}
|
||||
|
||||
inline std::vector<BufferElement>::iterator begin() { return m_bufferElements.begin(); }
|
||||
inline std::vector<BufferElement>::iterator end() { return m_bufferElements.end(); }
|
||||
inline std::vector<BufferElement> getElements() { return m_bufferElements; }
|
||||
inline int getStride() { return m_stride; }
|
||||
|
||||
private:
|
||||
void calculateOffsetAndStride();
|
||||
|
||||
std::vector<BufferElement> m_bufferElements;
|
||||
int m_stride;
|
||||
};
|
||||
|
||||
class VertexBuffer {
|
||||
public:
|
||||
virtual ~VertexBuffer() = default;
|
||||
|
||||
virtual void bind() const = 0;
|
||||
virtual void setLayout(BufferLayout& layout) = 0;
|
||||
virtual BufferLayout& getLayout() = 0;
|
||||
|
||||
static Ref<VertexBuffer> create(void* data, unsigned int size);
|
||||
};
|
||||
|
||||
class IndexBuffer {
|
||||
public:
|
||||
virtual ~IndexBuffer() = default;
|
||||
|
||||
virtual void bind() const = 0;
|
||||
virtual unsigned int getCount() const = 0;
|
||||
virtual IndexDataType getIndexDataType() const = 0;
|
||||
|
||||
static Ref<IndexBuffer> create(void* data, unsigned int size, IndexDataType indexDataType);
|
||||
};
|
||||
} // namespace Deer
|
||||
35
Deer/Include/DeerRender/Render/Camera.h
Executable file
35
Deer/Include/DeerRender/Render/Camera.h
Executable file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include "glm/glm.hpp"
|
||||
#include "glm/gtc/quaternion.hpp"
|
||||
|
||||
namespace Deer {
|
||||
class Camera {
|
||||
public:
|
||||
Camera(float aspect, float fov = 60, float nearZ = 0.1f, float farZ = 500);
|
||||
|
||||
void setPosition(const glm::vec3& position) { m_position = position; }
|
||||
const glm::vec3& getPosition() { return m_position; }
|
||||
|
||||
void setRotation(const glm::quat& rotation) { m_rotation = rotation; }
|
||||
const glm::quat& getRotation() { return m_rotation; }
|
||||
|
||||
void setAspect(float aspect) { m_aspect = aspect; }
|
||||
float getAspect() { return m_aspect; }
|
||||
|
||||
void setFov(float fov) { m_fov = fov; }
|
||||
float getFov() { return m_fov; }
|
||||
|
||||
void recalculateMatrices();
|
||||
const glm::mat4& getProjectionMatrix() { return m_projectionMatrix; }
|
||||
const glm::mat4& getViewMatrix() { return m_viewMatrix; }
|
||||
private:
|
||||
float m_fov, m_aspect, m_nearZ, m_farZ;
|
||||
glm::mat4 m_projectionMatrix;
|
||||
glm::mat4 m_viewMatrix;
|
||||
|
||||
glm::vec3 m_position;
|
||||
glm::quat m_rotation;
|
||||
};
|
||||
}
|
||||
|
||||
44
Deer/Include/DeerRender/Render/FrameBuffer.h
Executable file
44
Deer/Include/DeerRender/Render/FrameBuffer.h
Executable file
@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "Deer/Log.h"
|
||||
|
||||
#include <vector>
|
||||
#include <initializer_list>
|
||||
|
||||
namespace Deer {
|
||||
enum class TextureBufferType {
|
||||
RGBA8,
|
||||
RED_INTEGER
|
||||
};
|
||||
|
||||
struct FrameBufferSpecification {
|
||||
unsigned int width, height;
|
||||
unsigned int samples;
|
||||
std::vector<TextureBufferType> frameBufferTextures;
|
||||
|
||||
bool swapChainTarget = false;
|
||||
FrameBufferSpecification(unsigned int _width, unsigned int _height, std::initializer_list<TextureBufferType> _frameBufferTextures, unsigned int _samples = 1, bool _swapChainTarget = false)
|
||||
: width(_width), height(_height), samples(_samples), frameBufferTextures(_frameBufferTextures), swapChainTarget(_swapChainTarget) {
|
||||
}
|
||||
};
|
||||
|
||||
class FrameBuffer {
|
||||
public:
|
||||
virtual ~FrameBuffer() = default;
|
||||
virtual const FrameBufferSpecification& getSpecification() = 0;
|
||||
|
||||
virtual void bind() = 0;
|
||||
virtual void unbind() = 0;
|
||||
|
||||
virtual void clear() = 0;
|
||||
virtual void resize(unsigned int width, unsigned int height) = 0;
|
||||
|
||||
virtual unsigned int getTextureBufferID(int id = 0) = 0;
|
||||
virtual void clearBuffer(unsigned int bufferId, void* data) = 0;
|
||||
|
||||
virtual int getTextureBufferPixel(int id, unsigned int x, unsigned int y) = 0;
|
||||
|
||||
static FrameBuffer* create(const FrameBufferSpecification& spec);
|
||||
};
|
||||
}
|
||||
|
||||
27
Deer/Include/DeerRender/Render/Shader.h
Executable file
27
Deer/Include/DeerRender/Render/Shader.h
Executable file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Memory.h"
|
||||
|
||||
#include "glm/glm.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Deer {
|
||||
class Shader {
|
||||
public:
|
||||
virtual void bind() const = 0;
|
||||
virtual ~Shader() = default;
|
||||
|
||||
virtual void uploadUniformFloat(const std::string& name, float value) = 0;
|
||||
virtual void uploadUniformFloat2(const std::string& name, const glm::vec2& value) = 0;
|
||||
virtual void uploadUniformFloat3(const std::string& name, const glm::vec3& value) = 0;
|
||||
virtual void uploadUniformFloat4(const std::string& name, const glm::vec4& value) = 0;
|
||||
|
||||
virtual void uploadUniformInt(const std::string& name, int value) = 0;
|
||||
virtual void uploadUniformMat4(const std::string& name, const glm::mat4 mat) = 0;
|
||||
|
||||
static Ref<Shader> create(const std::string& filePath);
|
||||
static Ref<Shader> create(uint8_t* data, uint32_t size);
|
||||
|
||||
static Shader* create(const std::string& vertexSrc, const std::string& fragmentSrc);
|
||||
};
|
||||
} // namespace Deer
|
||||
23
Deer/Include/DeerRender/Render/Texture.h
Executable file
23
Deer/Include/DeerRender/Render/Texture.h
Executable file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Memory.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Deer {
|
||||
class Texture {
|
||||
public:
|
||||
virtual ~Texture() = default;
|
||||
|
||||
virtual unsigned int getWidth() = 0;
|
||||
virtual unsigned int getHeight() = 0;
|
||||
virtual unsigned int getTextureID() = 0;
|
||||
|
||||
virtual void bind(unsigned int slot) = 0;
|
||||
virtual void unbind(unsigned int slot) = 0;
|
||||
};
|
||||
|
||||
class Texture2D : public Texture {
|
||||
public:
|
||||
static Texture2D* create(const uint8_t* data, uint32_t width, uint32_t height, int channels);
|
||||
};
|
||||
} // namespace Deer
|
||||
28
Deer/Include/DeerRender/Render/VertexArray.h
Executable file
28
Deer/Include/DeerRender/Render/VertexArray.h
Executable file
@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
#include "DeerRender/Render/Buffer.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace Deer {
|
||||
class VertexArray;
|
||||
|
||||
class VertexArray {
|
||||
public:
|
||||
virtual ~VertexArray() = default;
|
||||
|
||||
virtual void bind() const = 0;
|
||||
virtual void unbind() const = 0;
|
||||
|
||||
virtual void addVertexBuffer(const Ref<VertexBuffer>& vertexBuffer) = 0;
|
||||
virtual void setIndexBuffer(const Ref<IndexBuffer>& indexBuffer) = 0;
|
||||
|
||||
virtual const Ref<IndexBuffer>& getIndexBuffer() = 0;
|
||||
|
||||
//static Ref<VertexArray> create();
|
||||
//static Ref<VertexArray> create(uint8_t* data, uint32_t size);
|
||||
static VertexArray* create();
|
||||
static VertexArray* create(uint8_t* data, uint32_t size);
|
||||
};
|
||||
}
|
||||
|
||||
22
Deer/Include/DeerRender/RenderPiperline.h
Normal file
22
Deer/Include/DeerRender/RenderPiperline.h
Normal file
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include "DeerRender/Render/FrameBuffer.h"
|
||||
#include "DeerRender/Tools/Memory.h"
|
||||
#include "DeerRender/Enviroment.h"
|
||||
|
||||
namespace Deer {
|
||||
class RenderPiperline {
|
||||
public:
|
||||
RenderPiperline(RenderPiperline&) = delete;
|
||||
RenderPiperline(PiperlineOptions);
|
||||
|
||||
void render(const Environment&);
|
||||
private:
|
||||
Scope<FrameBuffer> resultImage;
|
||||
PiperlineOptions options;
|
||||
};
|
||||
|
||||
struct PiperlineOptions {
|
||||
int width = 100;
|
||||
int height = 100;
|
||||
};
|
||||
}
|
||||
120
Deer/Include/DeerRender/Resource.h
Normal file
120
Deer/Include/DeerRender/Resource.h
Normal file
@ -0,0 +1,120 @@
|
||||
#pragma once
|
||||
#include "DeerRender/DataManagment.h"
|
||||
#include "DeerRender/Log.h"
|
||||
#include "DeerRender/Tools/Memory.h"
|
||||
#include "DeerRender/Tools/Path.h"
|
||||
#include "DeerRender/Tools/TypeDefs.h"
|
||||
|
||||
#include <cxxabi.h>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace Deer {
|
||||
template <typename T>
|
||||
class ResourceManager;
|
||||
|
||||
template <typename T>
|
||||
class Resource {
|
||||
public:
|
||||
int32_t getResourceId() const { return resourceId; }
|
||||
|
||||
bool isValid() const { return ResourceManager<T>::isValid(*this); }
|
||||
T& getData() { return ResourceManager<T>::getResourceData(*this); }
|
||||
|
||||
const std::string& getStorageId() const { return ResourceManager<T>::getStorageId(); }
|
||||
|
||||
inline explicit operator bool() const { return resourceId >= 0; }
|
||||
|
||||
static Resource<T> unsafeFromId(int32_t id) {
|
||||
Resource<T> res;
|
||||
res.resourceId = id;
|
||||
return res;
|
||||
}
|
||||
|
||||
private:
|
||||
// -1 = no resource loaded
|
||||
int32_t resourceId = -1;
|
||||
friend ResourceManager<T>;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class ResourceBuilder {
|
||||
public:
|
||||
using BaseDataType = char;
|
||||
static Scope<T> buildResource(const BaseDataType& baseData) {
|
||||
static_assert(sizeof(T) == 0, "ResourceBuilder must be specialized for this type T");
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class ResourceManager {
|
||||
private:
|
||||
struct ResourceData {
|
||||
public:
|
||||
ResourceData(const std::string& _resourceId, Scope<T>&& _data)
|
||||
: storageId(_resourceId), data(std::move(_data)) {}
|
||||
|
||||
Scope<T> data;
|
||||
const std::string storageId;
|
||||
};
|
||||
|
||||
static std::vector<ResourceData> resources;
|
||||
static std::unordered_map<std::string, Resource<T>> resourceCache;
|
||||
|
||||
public:
|
||||
template <typename DataSource>
|
||||
static Resource<T> loadResource(const std::string& storageId) {
|
||||
if (resourceCache.contains(storageId))
|
||||
return resourceCache[storageId];
|
||||
|
||||
using ResourceBuilderBaseDataType = typename ResourceBuilder<T>::BaseDataType;
|
||||
Scope<T> data;
|
||||
|
||||
if constexpr (!std::is_void_v<ResourceBuilderBaseDataType>) {
|
||||
Scope<ResourceBuilderBaseDataType> baseData = DataManager<DataSource>::template load<ResourceBuilderBaseDataType>(storageId);
|
||||
if (!baseData) {
|
||||
const char* baseDataType = abi::__cxa_demangle(typeid(ResourceBuilderBaseDataType).name(), 0, 0, nullptr);
|
||||
const char* dataType = abi::__cxa_demangle(typeid(T).name(), 0, 0, nullptr);
|
||||
DEER_CORE_ERROR("Error loading base resource {} for resource {} with id {}", baseDataType, dataType, storageId.c_str());
|
||||
return Resource<T>();
|
||||
}
|
||||
data = ResourceBuilder<T>::buildResource(*baseData.get());
|
||||
} else {
|
||||
data = ResourceBuilder<T>::buildResource(); // No base data
|
||||
}
|
||||
|
||||
Resource<T> resource = Resource<T>::unsafeFromId(resources.size());
|
||||
resources.push_back({storageId, std::move(data)});
|
||||
resourceCache[storageId] = resource;
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
static void unloadResources() {
|
||||
resourceCache.clear();
|
||||
resources.clear();
|
||||
}
|
||||
|
||||
static inline bool isValid(Resource<T> res) {
|
||||
return res.resourceId >= 0 && res.resourceId < static_cast<int32_t>(resources.size());
|
||||
}
|
||||
|
||||
static inline const std::string& getStorageId(Resource<T> res) {
|
||||
const static std::string invalid("NULL");
|
||||
if (!isValid(res))
|
||||
return invalid;
|
||||
|
||||
return resources[res.resourceId].storageId;
|
||||
}
|
||||
|
||||
static T& getResourceData(Resource<T> res) {
|
||||
return *resources[res.resourceId].data;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
std::vector<typename ResourceManager<T>::ResourceData> ResourceManager<T>::resources;
|
||||
template <typename T>
|
||||
std::unordered_map<std::string, Resource<T>> ResourceManager<T>::resourceCache;
|
||||
} // namespace Deer
|
||||
13
Deer/Include/DeerRender/Scene.h
Executable file
13
Deer/Include/DeerRender/Scene.h
Executable file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "Deer/Scene.h"
|
||||
#include "DeerRender/Components.h"
|
||||
|
||||
namespace Deer {
|
||||
struct SceneCamera {
|
||||
TransformComponent transform;
|
||||
CameraComponent camera;
|
||||
|
||||
SceneCamera() {}
|
||||
SceneCamera(TransformComponent _transform, CameraComponent _camera) : transform(_transform), camera(_camera) {}
|
||||
};
|
||||
} // namespace Deer
|
||||
35
Deer/Include/DeerRender/Shader.h
Normal file
35
Deer/Include/DeerRender/Shader.h
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Path.h"
|
||||
#include "DeerRender/Render/Shader.h"
|
||||
#include "DeerRender/Resource.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Deer {
|
||||
struct ShaderData {
|
||||
std::string vertexShader;
|
||||
std::string fragmentShader;
|
||||
|
||||
ShaderData() = default;
|
||||
~ShaderData() = default;
|
||||
|
||||
ShaderData(const ShaderData&) = delete;
|
||||
ShaderData& operator=(const ShaderData&) = delete;
|
||||
|
||||
void freeData() {
|
||||
vertexShader.clear();
|
||||
fragmentShader.clear();
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class ResourceBuilder<Shader> {
|
||||
public:
|
||||
using BaseDataType = ShaderData;
|
||||
static Scope<Shader> buildResource(const BaseDataType& baseData);
|
||||
};
|
||||
|
||||
namespace DataStore {
|
||||
void loadShader(ShaderData& data, const Path& name);
|
||||
} // namespace DataStore
|
||||
} // namespace Deer
|
||||
44
Deer/Include/DeerRender/Texture.h
Normal file
44
Deer/Include/DeerRender/Texture.h
Normal file
@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
#include "DeerRender/Render/Texture.h"
|
||||
#include "DeerRender/Resource.h"
|
||||
#include "DeerRender/Tools/Memory.h"
|
||||
|
||||
namespace Deer {
|
||||
enum TextureFormat : uint32_t {
|
||||
NONE = 0,
|
||||
R8 = 1,
|
||||
RGB8 = 3,
|
||||
RGBA8 = 4
|
||||
};
|
||||
|
||||
struct TextureData {
|
||||
TextureData() = default;
|
||||
TextureData(TextureFormat _format, uint32_t _width, uint32_t _height)
|
||||
: height(_height), width(_width), textureFormat(_format) {
|
||||
textureData = MakeScope<uint8_t[]>(getSize());
|
||||
}
|
||||
|
||||
inline uint8_t* getPixel(uint32_t x, uint32_t y) { return &textureData[(y * width + x) * (int)textureFormat]; }
|
||||
inline TextureFormat getTextureFormat() const { return textureFormat; }
|
||||
|
||||
inline uint32_t getWidth() const { return width; }
|
||||
inline uint32_t getHeight() const { return height; }
|
||||
|
||||
inline const uint8_t* getData() const { return textureData.get(); }
|
||||
inline uint8_t* getData() { return textureData.get(); }
|
||||
inline int getSize() { return width * height * (int)textureFormat; }
|
||||
|
||||
private:
|
||||
Scope<uint8_t[]> textureData;
|
||||
TextureFormat textureFormat = NONE;
|
||||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
};
|
||||
|
||||
template <>
|
||||
class ResourceBuilder<Texture> {
|
||||
public:
|
||||
using BaseDataType = TextureData;
|
||||
static Scope<Texture> buildResource(const BaseDataType& baseData);
|
||||
};
|
||||
} // namespace Deer
|
||||
2
Deer/Include/DeerRender/Tools/Memory.h
Normal file
2
Deer/Include/DeerRender/Tools/Memory.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Memory.h"
|
||||
2
Deer/Include/DeerRender/Tools/Path.h
Normal file
2
Deer/Include/DeerRender/Tools/Path.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Path.h"
|
||||
2
Deer/Include/DeerRender/Tools/SmallVector.h
Normal file
2
Deer/Include/DeerRender/Tools/SmallVector.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/SmallVector.h"
|
||||
2
Deer/Include/DeerRender/Tools/TypeDefs.h
Normal file
2
Deer/Include/DeerRender/Tools/TypeDefs.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/TypeDefs.h"
|
||||
33
Deer/Include/DeerRender/Voxel.h
Executable file
33
Deer/Include/DeerRender/Voxel.h
Executable file
@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include "Deer/Voxel.h"
|
||||
|
||||
#define LIGHT_PROPAGATION_COMPLEX_DIRS 18
|
||||
#define LIGHT_PROPAGATION_COMPLEX_DIR(id, dir) lightPropagationComplexDir[id + dir * 2]
|
||||
#define LIGHT_PROPAGATION_SIMPLE_FALL 16
|
||||
#define LIGHT_PROPAGATION_COMPLEX_FALL 23
|
||||
|
||||
#define NORMAL_VERTEX_POS(axis, id, normal) normalFacePositions[axis + id * 3 + normal * 3 * 4]
|
||||
#define VERTEX_UV(axis, id) uvFace[axis + id * 2]
|
||||
#define AMBIENT_OCCLUSION_VERTEX(axis, id, vertex, normal) ambientOcclusionVertex[axis + id * 3 + vertex * 3 * 2 + normal * 3 * 2 * 4]
|
||||
#define LAYER_CHECK_DIRS(axis, id) layerCheckDirections[axis + id * 2]
|
||||
|
||||
namespace Deer {
|
||||
struct VoxelLight;
|
||||
extern VoxelLight lightVoxel;
|
||||
|
||||
extern int lightPropagationComplexDir[12 * 2];
|
||||
extern int normalFacePositions[3 * 4 * 6];
|
||||
extern int uvFace[2 * 4];
|
||||
// 6 Dirs * 4 vertices * 2 checks * 3 dirs
|
||||
extern int ambientOcclusionVertex[6 * 4 * 2 * 3];
|
||||
extern int layerCheckDirections[2 * 8];
|
||||
|
||||
struct VoxelLight {
|
||||
uint8_t r_light;
|
||||
uint8_t g_light;
|
||||
uint8_t b_light;
|
||||
uint8_t ambient_light;
|
||||
|
||||
VoxelLight(uint8_t _ambient_light = 0) : r_light(0), g_light(0), b_light(0), ambient_light(_ambient_light) {}
|
||||
};
|
||||
} // namespace Deer
|
||||
54
Deer/Include/DeerRender/VoxelAspect.h
Normal file
54
Deer/Include/DeerRender/VoxelAspect.h
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @file VoxelAspect.h
|
||||
* @author chewico@frostdeer.com
|
||||
* @brief File to save the voxel aspect data
|
||||
*
|
||||
* @copyright Copyright (c) 2025
|
||||
*/
|
||||
#pragma once
|
||||
#include "Deer/Voxel.h"
|
||||
|
||||
// TEMP
|
||||
#define VOXEL_TEXTURE_SIZE_X 128
|
||||
#define VOXEL_TEXTURE_SIZE_Y 128
|
||||
|
||||
namespace Deer {
|
||||
struct VoxelTextureFaceDefinition {
|
||||
std::string textureFaces[6];
|
||||
|
||||
inline std::string& operator[](size_t index) {
|
||||
return textureFaces[index];
|
||||
}
|
||||
};
|
||||
|
||||
struct VoxelColorEmission {
|
||||
uint8_t r_value = 0;
|
||||
uint8_t g_value = 0;
|
||||
uint8_t b_value = 0;
|
||||
};
|
||||
|
||||
struct VoxelAspectDefinition {
|
||||
std::string voxelName;
|
||||
VoxelTextureFaceDefinition textureFaces;
|
||||
VoxelColorEmission colorEmission;
|
||||
|
||||
VoxelAspectDefinition() = default;
|
||||
};
|
||||
|
||||
struct VoxelAspect {
|
||||
VoxelAspectDefinition definition;
|
||||
uint16_t textureFacesIDs[6]{};
|
||||
|
||||
inline bool isLightSource() {
|
||||
return definition.colorEmission.r_value || definition.colorEmission.g_value || definition.colorEmission.b_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the texture id for the voxel face
|
||||
*
|
||||
* @param face face of the texture defined in the enum NormalDirection of Voxel.h
|
||||
* @return uint16_t texture id in the texture atlas
|
||||
*/
|
||||
inline uint16_t getTextureID(uint8_t face) { return textureFacesIDs[face]; }
|
||||
};
|
||||
}
|
||||
2
Deer/Include/DeerRender/VoxelWorld.h
Normal file
2
Deer/Include/DeerRender/VoxelWorld.h
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include "Deer/VoxelWorld.h"
|
||||
46
Deer/Include/DeerRender/Window.h
Executable file
46
Deer/Include/DeerRender/Window.h
Executable file
@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Path.h"
|
||||
#include "DeerRender/Events/Event.h"
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
namespace Deer {
|
||||
struct WindowProps {
|
||||
std::string title;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
|
||||
WindowProps(const std::string& _title = "Deer Engine",
|
||||
unsigned int _width = 1280,
|
||||
unsigned int _height = 720)
|
||||
: title(_title), width(_width), height(_height) {
|
||||
}
|
||||
};
|
||||
|
||||
class Window {
|
||||
public:
|
||||
virtual ~Window() = default;
|
||||
virtual void initWindow() = 0;
|
||||
|
||||
virtual void onRender() = 0;
|
||||
virtual void clear() = 0;
|
||||
virtual void resolveEvents() = 0;
|
||||
|
||||
inline virtual int getWitdth() const = 0;
|
||||
inline virtual int getHeight() const = 0;
|
||||
|
||||
virtual void setEventCallback(std::function<void(Event&)>) = 0;
|
||||
virtual void setVSync(bool enabled) = 0;
|
||||
inline virtual bool isVSync() const = 0;
|
||||
|
||||
virtual bool getKeyPressed(unsigned int key) = 0;
|
||||
virtual bool getMouseButton(int button) = 0;
|
||||
virtual void getMousePos(float& x, float& y) = 0;
|
||||
virtual void initImGUI() = 0;
|
||||
|
||||
virtual Path folderDialog(const char*) = 0;
|
||||
|
||||
static Window* create(const WindowProps& props = WindowProps());
|
||||
};
|
||||
} // namespace Deer
|
||||
1
Deer/build/.cmake/api/v1/query/client-vscode/query.json
Normal file
1
Deer/build/.cmake/api/v1/query/client-vscode/query.json
Normal file
@ -0,0 +1 @@
|
||||
{"requests":[{"kind":"cache","version":2},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1},{"kind":"cmakeFiles","version":1}]}
|
||||
987
Deer/build/CMakeCache.txt
Normal file
987
Deer/build/CMakeCache.txt
Normal file
@ -0,0 +1,987 @@
|
||||
# This is the CMakeCache file.
|
||||
# For build in directory: /home/chewico/Dev/DeerEngine/Deer/build
|
||||
# It was generated by CMake: /usr/bin/cmake
|
||||
# You can edit this file to change values found and used by cmake.
|
||||
# If you do not want to change any of the values, simply exit the editor.
|
||||
# If you do want to change a value, simply edit, save, and exit the editor.
|
||||
# The syntax for the file is as follows:
|
||||
# KEY:TYPE=VALUE
|
||||
# KEY is the name of a variable in the cache.
|
||||
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
|
||||
# VALUE is the current value for the KEY.
|
||||
|
||||
########################
|
||||
# EXTERNAL cache entries
|
||||
########################
|
||||
|
||||
//Build shared libraries
|
||||
BUILD_SHARED_LIBS:BOOL=OFF
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_AR:FILEPATH=/usr/bin/ar
|
||||
|
||||
//No help, variable specified on the command line.
|
||||
CMAKE_BUILD_TYPE:STRING=Debug
|
||||
|
||||
//No help, variable specified on the command line.
|
||||
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++
|
||||
|
||||
//No help, variable specified on the command line.
|
||||
CMAKE_C_COMPILER:FILEPATH=/usr/bin/clang
|
||||
|
||||
//LLVM archiver
|
||||
CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/llvm-ar-14
|
||||
|
||||
//Generate index for LLVM archive
|
||||
CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/llvm-ranlib-14
|
||||
|
||||
//Flags used by the C compiler during all build types.
|
||||
CMAKE_C_FLAGS:STRING=
|
||||
|
||||
//Flags used by the C compiler during DEBUG builds.
|
||||
CMAKE_C_FLAGS_DEBUG:STRING=-g
|
||||
|
||||
//Flags used by the C compiler during MINSIZEREL builds.
|
||||
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
|
||||
|
||||
//Flags used by the C compiler during RELEASE builds.
|
||||
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
|
||||
|
||||
//Flags used by the C compiler during RELWITHDEBINFO builds.
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND
|
||||
|
||||
//Flags used by the linker during all build types.
|
||||
CMAKE_EXE_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during DEBUG builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during MINSIZEREL builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during RELEASE builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during RELWITHDEBINFO builds.
|
||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//No help, variable specified on the command line.
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE
|
||||
|
||||
//Value Computed by CMake.
|
||||
CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/pkgRedirects
|
||||
|
||||
//User executables (bin)
|
||||
CMAKE_INSTALL_BINDIR:PATH=bin
|
||||
|
||||
//Read-only architecture-independent data (DATAROOTDIR)
|
||||
CMAKE_INSTALL_DATADIR:PATH=
|
||||
|
||||
//Read-only architecture-independent data root (share)
|
||||
CMAKE_INSTALL_DATAROOTDIR:PATH=share
|
||||
|
||||
//Documentation root (DATAROOTDIR/doc/PROJECT_NAME)
|
||||
CMAKE_INSTALL_DOCDIR:PATH=
|
||||
|
||||
//C header files (include)
|
||||
CMAKE_INSTALL_INCLUDEDIR:PATH=include
|
||||
|
||||
//Info documentation (DATAROOTDIR/info)
|
||||
CMAKE_INSTALL_INFODIR:PATH=
|
||||
|
||||
//Object code libraries (lib)
|
||||
CMAKE_INSTALL_LIBDIR:PATH=lib
|
||||
|
||||
//Program executables (libexec)
|
||||
CMAKE_INSTALL_LIBEXECDIR:PATH=libexec
|
||||
|
||||
//Locale-dependent data (DATAROOTDIR/locale)
|
||||
CMAKE_INSTALL_LOCALEDIR:PATH=
|
||||
|
||||
//Modifiable single-machine data (var)
|
||||
CMAKE_INSTALL_LOCALSTATEDIR:PATH=var
|
||||
|
||||
//Man documentation (DATAROOTDIR/man)
|
||||
CMAKE_INSTALL_MANDIR:PATH=
|
||||
|
||||
//C header files for non-gcc (/usr/include)
|
||||
CMAKE_INSTALL_OLDINCLUDEDIR:PATH=/usr/include
|
||||
|
||||
//Install path prefix, prepended onto install directories.
|
||||
CMAKE_INSTALL_PREFIX:PATH=/usr/local
|
||||
|
||||
//Run-time variable data (LOCALSTATEDIR/run)
|
||||
CMAKE_INSTALL_RUNSTATEDIR:PATH=
|
||||
|
||||
//System admin executables (sbin)
|
||||
CMAKE_INSTALL_SBINDIR:PATH=sbin
|
||||
|
||||
//Modifiable architecture-independent data (com)
|
||||
CMAKE_INSTALL_SHAREDSTATEDIR:PATH=com
|
||||
|
||||
//Read-only single-machine data (etc)
|
||||
CMAKE_INSTALL_SYSCONFDIR:PATH=etc
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_LINKER:FILEPATH=/usr/bin/ld.lld
|
||||
|
||||
//Program used to build from build.ninja files.
|
||||
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/ninja
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// all build types.
|
||||
CMAKE_MODULE_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// DEBUG builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// MINSIZEREL builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// RELEASE builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of modules during
|
||||
// RELWITHDEBINFO builds.
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_NM:FILEPATH=/usr/bin/nm
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_DESCRIPTION:STATIC=
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_NAME:STATIC=GLFW
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION:STATIC=3.4.0
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION_MAJOR:STATIC=3
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION_MINOR:STATIC=4
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION_PATCH:STATIC=0
|
||||
|
||||
//Value Computed by CMake
|
||||
CMAKE_PROJECT_VERSION_TWEAK:STATIC=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_READELF:FILEPATH=/usr/bin/readelf
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during all build types.
|
||||
CMAKE_SHARED_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during DEBUG builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during MINSIZEREL builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during RELEASE builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of shared libraries
|
||||
// during RELWITHDEBINFO builds.
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//If set, runtime paths are not added when installing shared libraries,
|
||||
// but are added when building.
|
||||
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
|
||||
|
||||
//If set, runtime paths are not added when using shared libraries.
|
||||
CMAKE_SKIP_RPATH:BOOL=NO
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during all build types.
|
||||
CMAKE_STATIC_LINKER_FLAGS:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during DEBUG builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during MINSIZEREL builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during RELEASE builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
|
||||
|
||||
//Flags used by the linker during the creation of static libraries
|
||||
// during RELWITHDEBINFO builds.
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
|
||||
|
||||
//Path to a program.
|
||||
CMAKE_STRIP:FILEPATH=/usr/bin/strip
|
||||
|
||||
//If this value is on, makefiles will be generated without the
|
||||
// .SILENT directive, and all commands will be echoed to the console
|
||||
// during the make. This is useful for debugging only. With Visual
|
||||
// Studio IDE projects all commands are done without /nologo.
|
||||
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
|
||||
|
||||
//Doxygen documentation generation tool (https://www.doxygen.nl)
|
||||
DOXYGEN_EXECUTABLE:FILEPATH=DOXYGEN_EXECUTABLE-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
FREETYPE_INCLUDE_DIR_freetype2:PATH=/usr/include/freetype2
|
||||
|
||||
//Path to a file.
|
||||
FREETYPE_INCLUDE_DIR_ft2build:PATH=/usr/include/freetype2
|
||||
|
||||
//Path to a library.
|
||||
FREETYPE_LIBRARY_DEBUG:FILEPATH=FREETYPE_LIBRARY_DEBUG-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
FREETYPE_LIBRARY_RELEASE:FILEPATH=/usr/lib/x86_64-linux-gnu/libfreetype.so
|
||||
|
||||
//Path to a file.
|
||||
Fontconfig_INCLUDE_DIR:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
Fontconfig_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libfontconfig.so
|
||||
|
||||
//Value Computed by CMake
|
||||
GLFW_BINARY_DIR:STATIC=/home/chewico/Dev/DeerEngine/Deer/build
|
||||
|
||||
//Build the GLFW documentation
|
||||
GLFW_BUILD_DOCS:BOOL=ON
|
||||
|
||||
//Build the GLFW example programs
|
||||
GLFW_BUILD_EXAMPLES:BOOL=ON
|
||||
|
||||
//Build the GLFW test programs
|
||||
GLFW_BUILD_TESTS:BOOL=ON
|
||||
|
||||
//Build support for Wayland
|
||||
GLFW_BUILD_WAYLAND:BOOL=OFF
|
||||
|
||||
//Build support for X11
|
||||
GLFW_BUILD_X11:BOOL=ON
|
||||
|
||||
//Generate installation target
|
||||
GLFW_INSTALL:BOOL=ON
|
||||
|
||||
//Value Computed by CMake
|
||||
GLFW_IS_TOP_LEVEL:STATIC=ON
|
||||
|
||||
//Library type override for GLFW (SHARED, STATIC, OBJECT, or empty
|
||||
// to follow BUILD_SHARED_LIBS)
|
||||
GLFW_LIBRARY_TYPE:STRING=
|
||||
|
||||
//Value Computed by CMake
|
||||
GLFW_SOURCE_DIR:STATIC=/home/chewico/Dev/DeerEngine/Deer/vendor/GLFW
|
||||
|
||||
//Path to a library.
|
||||
MATH_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libm.so
|
||||
|
||||
//Arguments to supply to pkg-config
|
||||
PKG_CONFIG_ARGN:STRING=
|
||||
|
||||
//pkg-config executable
|
||||
PKG_CONFIG_EXECUTABLE:FILEPATH=/usr/bin/pkg-config
|
||||
|
||||
//Path to a library.
|
||||
RT_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/librt.a
|
||||
|
||||
//Path to a file.
|
||||
X11_ICE_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_ICE_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libICE.so
|
||||
|
||||
//Path to a file.
|
||||
X11_SM_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_SM_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libSM.so
|
||||
|
||||
//Path to a file.
|
||||
X11_X11_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_X11_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libX11.so
|
||||
|
||||
//Path to a file.
|
||||
X11_X11_xcb_INCLUDE_PATH:PATH=X11_X11_xcb_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_X11_xcb_LIB:FILEPATH=X11_X11_xcb_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_XRes_INCLUDE_PATH:PATH=X11_XRes_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_XRes_LIB:FILEPATH=X11_XRes_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_XShm_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a file.
|
||||
X11_XSync_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a file.
|
||||
X11_Xaccessrules_INCLUDE_PATH:PATH=X11_Xaccessrules_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_Xaccessstr_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a file.
|
||||
X11_Xau_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xau_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXau.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xaw_INCLUDE_PATH:PATH=X11_Xaw_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_Xaw_LIB:FILEPATH=X11_Xaw_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_Xcomposite_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xcomposite_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXcomposite.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xcursor_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xcursor_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXcursor.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xdamage_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xdamage_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXdamage.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xdmcp_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xdmcp_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXdmcp.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xext_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xext_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXext.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xfixes_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xfixes_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXfixes.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xft_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xft_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXft.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xi_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xi_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXi.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xinerama_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xinerama_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXinerama.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xkb_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a file.
|
||||
X11_Xkblib_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a file.
|
||||
X11_Xlib_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a file.
|
||||
X11_Xmu_INCLUDE_PATH:PATH=X11_Xmu_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_Xmu_LIB:FILEPATH=X11_Xmu_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_Xpm_INCLUDE_PATH:PATH=X11_Xpm_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_Xpm_LIB:FILEPATH=X11_Xpm_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_Xrandr_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xrandr_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXrandr.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xrender_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xrender_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXrender.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xshape_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a file.
|
||||
X11_Xss_INCLUDE_PATH:PATH=X11_Xss_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_Xss_LIB:FILEPATH=X11_Xss_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_Xt_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xt_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXt.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xtst_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_Xtst_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libXtst.so
|
||||
|
||||
//Path to a file.
|
||||
X11_Xutil_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a file.
|
||||
X11_Xv_INCLUDE_PATH:PATH=X11_Xv_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_Xv_LIB:FILEPATH=X11_Xv_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_Xxf86misc_INCLUDE_PATH:PATH=X11_Xxf86misc_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_Xxf86misc_LIB:FILEPATH=X11_Xxf86misc_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_Xxf86vm_INCLUDE_PATH:PATH=X11_Xxf86vm_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_Xxf86vm_LIB:FILEPATH=X11_Xxf86vm_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_dpms_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a file.
|
||||
X11_xcb_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_xcb_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libxcb.so
|
||||
|
||||
//Path to a file.
|
||||
X11_xcb_icccm_INCLUDE_PATH:PATH=X11_xcb_icccm_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_xcb_icccm_LIB:FILEPATH=X11_xcb_icccm_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_xcb_keysyms_INCLUDE_PATH:PATH=X11_xcb_keysyms_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_xcb_keysyms_LIB:FILEPATH=X11_xcb_keysyms_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_xcb_randr_INCLUDE_PATH:PATH=X11_xcb_randr_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_xcb_randr_LIB:FILEPATH=X11_xcb_randr_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_xcb_util_INCLUDE_PATH:PATH=X11_xcb_util_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_xcb_util_LIB:FILEPATH=X11_xcb_util_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_xcb_xfixes_INCLUDE_PATH:PATH=X11_xcb_xfixes_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_xcb_xfixes_LIB:FILEPATH=X11_xcb_xfixes_LIB-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_xcb_xkb_LIB:FILEPATH=X11_xcb_xkb_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_xcb_xtest_INCLUDE_PATH:PATH=X11_xcb_xtest_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_xcb_xtest_LIB:FILEPATH=X11_xcb_xtest_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_xkbcommon_INCLUDE_PATH:PATH=/usr/include
|
||||
|
||||
//Path to a library.
|
||||
X11_xkbcommon_LIB:FILEPATH=/usr/lib/x86_64-linux-gnu/libxkbcommon.so
|
||||
|
||||
//Path to a file.
|
||||
X11_xkbcommon_X11_INCLUDE_PATH:PATH=X11_xkbcommon_X11_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_xkbcommon_X11_LIB:FILEPATH=X11_xkbcommon_X11_LIB-NOTFOUND
|
||||
|
||||
//Path to a file.
|
||||
X11_xkbfile_INCLUDE_PATH:PATH=X11_xkbfile_INCLUDE_PATH-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
X11_xkbfile_LIB:FILEPATH=X11_xkbfile_LIB-NOTFOUND
|
||||
|
||||
//Path to a library.
|
||||
pkgcfg_lib_PKG_FONTCONFIG_fontconfig:FILEPATH=/usr/lib/x86_64-linux-gnu/libfontconfig.so
|
||||
|
||||
//Path to a library.
|
||||
pkgcfg_lib_PKG_FONTCONFIG_freetype:FILEPATH=/usr/lib/x86_64-linux-gnu/libfreetype.so
|
||||
|
||||
|
||||
########################
|
||||
# INTERNAL cache entries
|
||||
########################
|
||||
|
||||
//ADVANCED property for variable: CMAKE_ADDR2LINE
|
||||
CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_AR
|
||||
CMAKE_AR-ADVANCED:INTERNAL=1
|
||||
//This is the directory where this CMakeCache.txt was created
|
||||
CMAKE_CACHEFILE_DIR:INTERNAL=/home/chewico/Dev/DeerEngine/Deer/build
|
||||
//Major version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
|
||||
//Minor version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_MINOR_VERSION:INTERNAL=25
|
||||
//Patch version of cmake used to create the current loaded cache
|
||||
CMAKE_CACHE_PATCH_VERSION:INTERNAL=1
|
||||
//Path to CMake executable.
|
||||
CMAKE_COMMAND:INTERNAL=/usr/bin/cmake
|
||||
//Path to cpack program executable.
|
||||
CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack
|
||||
//Path to ctest program executable.
|
||||
CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER
|
||||
CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER_AR
|
||||
CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB
|
||||
CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS
|
||||
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
|
||||
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
|
||||
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
|
||||
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_DLLTOOL
|
||||
CMAKE_DLLTOOL-ADVANCED:INTERNAL=1
|
||||
//Executable file format
|
||||
CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
|
||||
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
|
||||
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
|
||||
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//Name of external makefile project generator.
|
||||
CMAKE_EXTRA_GENERATOR:INTERNAL=
|
||||
//Name of generator.
|
||||
CMAKE_GENERATOR:INTERNAL=Ninja
|
||||
//Generator instance identifier.
|
||||
CMAKE_GENERATOR_INSTANCE:INTERNAL=
|
||||
//Name of generator platform.
|
||||
CMAKE_GENERATOR_PLATFORM:INTERNAL=
|
||||
//Name of generator toolset.
|
||||
CMAKE_GENERATOR_TOOLSET:INTERNAL=
|
||||
//Have function connect
|
||||
CMAKE_HAVE_CONNECT:INTERNAL=1
|
||||
//Have function gethostbyname
|
||||
CMAKE_HAVE_GETHOSTBYNAME:INTERNAL=1
|
||||
//Test CMAKE_HAVE_LIBC_PTHREAD
|
||||
CMAKE_HAVE_LIBC_PTHREAD:INTERNAL=1
|
||||
//Have function remove
|
||||
CMAKE_HAVE_REMOVE:INTERNAL=1
|
||||
//Have function shmat
|
||||
CMAKE_HAVE_SHMAT:INTERNAL=1
|
||||
//Source directory with the top level CMakeLists.txt file for this
|
||||
// project
|
||||
CMAKE_HOME_DIRECTORY:INTERNAL=/home/chewico/Dev/DeerEngine/Deer/vendor/GLFW
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_BINDIR
|
||||
CMAKE_INSTALL_BINDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_DATADIR
|
||||
CMAKE_INSTALL_DATADIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_DATAROOTDIR
|
||||
CMAKE_INSTALL_DATAROOTDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_DOCDIR
|
||||
CMAKE_INSTALL_DOCDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_INCLUDEDIR
|
||||
CMAKE_INSTALL_INCLUDEDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_INFODIR
|
||||
CMAKE_INSTALL_INFODIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_LIBDIR
|
||||
CMAKE_INSTALL_LIBDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_LIBEXECDIR
|
||||
CMAKE_INSTALL_LIBEXECDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_LOCALEDIR
|
||||
CMAKE_INSTALL_LOCALEDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_LOCALSTATEDIR
|
||||
CMAKE_INSTALL_LOCALSTATEDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_MANDIR
|
||||
CMAKE_INSTALL_MANDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_OLDINCLUDEDIR
|
||||
CMAKE_INSTALL_OLDINCLUDEDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_RUNSTATEDIR
|
||||
CMAKE_INSTALL_RUNSTATEDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_SBINDIR
|
||||
CMAKE_INSTALL_SBINDIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_SHAREDSTATEDIR
|
||||
CMAKE_INSTALL_SHAREDSTATEDIR-ADVANCED:INTERNAL=1
|
||||
//Install .so files without execute permission.
|
||||
CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_INSTALL_SYSCONFDIR
|
||||
CMAKE_INSTALL_SYSCONFDIR-ADVANCED:INTERNAL=1
|
||||
//Have library ICE
|
||||
CMAKE_LIB_ICE_HAS_ICECONNECTIONNUMBER:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_LINKER
|
||||
CMAKE_LINKER-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
|
||||
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
|
||||
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
|
||||
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_NM
|
||||
CMAKE_NM-ADVANCED:INTERNAL=1
|
||||
//number of local generators
|
||||
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=2
|
||||
//ADVANCED property for variable: CMAKE_OBJCOPY
|
||||
CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_OBJDUMP
|
||||
CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
|
||||
//Platform information initialized
|
||||
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_RANLIB
|
||||
CMAKE_RANLIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_READELF
|
||||
CMAKE_READELF-ADVANCED:INTERNAL=1
|
||||
//Path to CMake installation.
|
||||
CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.25
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
|
||||
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
|
||||
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
|
||||
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_SKIP_RPATH
|
||||
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
|
||||
CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
|
||||
CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
|
||||
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
|
||||
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: CMAKE_STRIP
|
||||
CMAKE_STRIP-ADVANCED:INTERNAL=1
|
||||
//uname command
|
||||
CMAKE_UNAME:INTERNAL=/usr/bin/uname
|
||||
//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
|
||||
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: DOXYGEN_EXECUTABLE
|
||||
DOXYGEN_EXECUTABLE-ADVANCED:INTERNAL=1
|
||||
//Details about finding Threads
|
||||
FIND_PACKAGE_MESSAGE_DETAILS_Threads:INTERNAL=[TRUE][v()]
|
||||
//Details about finding X11
|
||||
FIND_PACKAGE_MESSAGE_DETAILS_X11:INTERNAL=[/usr/include][/usr/lib/x86_64-linux-gnu/libX11.so][c ][v()]
|
||||
//ADVANCED property for variable: FREETYPE_INCLUDE_DIR_freetype2
|
||||
FREETYPE_INCLUDE_DIR_freetype2-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: FREETYPE_INCLUDE_DIR_ft2build
|
||||
FREETYPE_INCLUDE_DIR_ft2build-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: FREETYPE_LIBRARY_DEBUG
|
||||
FREETYPE_LIBRARY_DEBUG-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: FREETYPE_LIBRARY_RELEASE
|
||||
FREETYPE_LIBRARY_RELEASE-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Fontconfig_INCLUDE_DIR
|
||||
Fontconfig_INCLUDE_DIR-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: Fontconfig_LIBRARY
|
||||
Fontconfig_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//GLFW pkg-config Libs.private
|
||||
GLFW_PKG_CONFIG_LIBS_PRIVATE:INTERNAL= -lrt -lm -ldl
|
||||
//GLFW pkg-config Requires.private
|
||||
GLFW_PKG_CONFIG_REQUIRES_PRIVATE:INTERNAL=
|
||||
//ADVANCED property for variable: MATH_LIBRARY
|
||||
MATH_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: PKG_CONFIG_ARGN
|
||||
PKG_CONFIG_ARGN-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: PKG_CONFIG_EXECUTABLE
|
||||
PKG_CONFIG_EXECUTABLE-ADVANCED:INTERNAL=1
|
||||
PKG_FONTCONFIG_CFLAGS:INTERNAL=-I/usr/include/freetype2;-I/usr/include/libpng16
|
||||
PKG_FONTCONFIG_CFLAGS_I:INTERNAL=
|
||||
PKG_FONTCONFIG_CFLAGS_OTHER:INTERNAL=
|
||||
PKG_FONTCONFIG_FOUND:INTERNAL=1
|
||||
PKG_FONTCONFIG_INCLUDEDIR:INTERNAL=/usr/include
|
||||
PKG_FONTCONFIG_INCLUDE_DIRS:INTERNAL=/usr/include/freetype2;/usr/include/libpng16
|
||||
PKG_FONTCONFIG_LDFLAGS:INTERNAL=-L/usr/lib/x86_64-linux-gnu;-lfontconfig;-lfreetype
|
||||
PKG_FONTCONFIG_LDFLAGS_OTHER:INTERNAL=
|
||||
PKG_FONTCONFIG_LIBDIR:INTERNAL=/usr/lib/x86_64-linux-gnu
|
||||
PKG_FONTCONFIG_LIBRARIES:INTERNAL=fontconfig;freetype
|
||||
PKG_FONTCONFIG_LIBRARY_DIRS:INTERNAL=/usr/lib/x86_64-linux-gnu
|
||||
PKG_FONTCONFIG_LIBS:INTERNAL=
|
||||
PKG_FONTCONFIG_LIBS_L:INTERNAL=
|
||||
PKG_FONTCONFIG_LIBS_OTHER:INTERNAL=
|
||||
PKG_FONTCONFIG_LIBS_PATHS:INTERNAL=
|
||||
PKG_FONTCONFIG_MODULE_NAME:INTERNAL=fontconfig
|
||||
PKG_FONTCONFIG_PREFIX:INTERNAL=/usr
|
||||
PKG_FONTCONFIG_STATIC_CFLAGS:INTERNAL=-I/usr/include/freetype2;-I/usr/include/libpng16
|
||||
PKG_FONTCONFIG_STATIC_CFLAGS_I:INTERNAL=
|
||||
PKG_FONTCONFIG_STATIC_CFLAGS_OTHER:INTERNAL=
|
||||
PKG_FONTCONFIG_STATIC_INCLUDE_DIRS:INTERNAL=/usr/include/freetype2;/usr/include/libpng16
|
||||
PKG_FONTCONFIG_STATIC_LDFLAGS:INTERNAL=-L/usr/lib/x86_64-linux-gnu;-lfontconfig;-lfreetype;-L/usr/lib/x86_64-linux-gnu;-L/usr/lib/x86_64-linux-gnu;-lz;-lpng16;-lm;-lz;-lm;-L/usr/lib/x86_64-linux-gnu;-L/usr/lib/x86_64-linux-gnu;-lz;-lbrotlidec;-L/usr/lib/x86_64-linux-gnu;-lbrotlicommon;-L/usr/lib/x86_64-linux-gnu;-lexpat;-lm
|
||||
PKG_FONTCONFIG_STATIC_LDFLAGS_OTHER:INTERNAL=
|
||||
PKG_FONTCONFIG_STATIC_LIBDIR:INTERNAL=
|
||||
PKG_FONTCONFIG_STATIC_LIBRARIES:INTERNAL=fontconfig;freetype;z;png16;m;z;m;z;brotlidec;brotlicommon;expat;m
|
||||
PKG_FONTCONFIG_STATIC_LIBRARY_DIRS:INTERNAL=/usr/lib/x86_64-linux-gnu;/usr/lib/x86_64-linux-gnu;/usr/lib/x86_64-linux-gnu;/usr/lib/x86_64-linux-gnu;/usr/lib/x86_64-linux-gnu;/usr/lib/x86_64-linux-gnu;/usr/lib/x86_64-linux-gnu
|
||||
PKG_FONTCONFIG_STATIC_LIBS:INTERNAL=
|
||||
PKG_FONTCONFIG_STATIC_LIBS_L:INTERNAL=
|
||||
PKG_FONTCONFIG_STATIC_LIBS_OTHER:INTERNAL=
|
||||
PKG_FONTCONFIG_STATIC_LIBS_PATHS:INTERNAL=
|
||||
PKG_FONTCONFIG_VERSION:INTERNAL=2.14.1
|
||||
PKG_FONTCONFIG_fontconfig_INCLUDEDIR:INTERNAL=
|
||||
PKG_FONTCONFIG_fontconfig_LIBDIR:INTERNAL=
|
||||
PKG_FONTCONFIG_fontconfig_PREFIX:INTERNAL=
|
||||
PKG_FONTCONFIG_fontconfig_VERSION:INTERNAL=
|
||||
//ADVANCED property for variable: RT_LIBRARY
|
||||
RT_LIBRARY-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_ICE_INCLUDE_PATH
|
||||
X11_ICE_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_ICE_LIB
|
||||
X11_ICE_LIB-ADVANCED:INTERNAL=1
|
||||
//Have library /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
|
||||
X11_LIB_X11_SOLO:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_SM_INCLUDE_PATH
|
||||
X11_SM_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_SM_LIB
|
||||
X11_SM_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_X11_INCLUDE_PATH
|
||||
X11_X11_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_X11_LIB
|
||||
X11_X11_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_X11_xcb_INCLUDE_PATH
|
||||
X11_X11_xcb_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_X11_xcb_LIB
|
||||
X11_X11_xcb_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_XRes_INCLUDE_PATH
|
||||
X11_XRes_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_XRes_LIB
|
||||
X11_XRes_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_XShm_INCLUDE_PATH
|
||||
X11_XShm_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_XSync_INCLUDE_PATH
|
||||
X11_XSync_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xaccessrules_INCLUDE_PATH
|
||||
X11_Xaccessrules_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xaccessstr_INCLUDE_PATH
|
||||
X11_Xaccessstr_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xau_INCLUDE_PATH
|
||||
X11_Xau_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xau_LIB
|
||||
X11_Xau_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xaw_INCLUDE_PATH
|
||||
X11_Xaw_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xaw_LIB
|
||||
X11_Xaw_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xcomposite_INCLUDE_PATH
|
||||
X11_Xcomposite_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xcomposite_LIB
|
||||
X11_Xcomposite_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xcursor_INCLUDE_PATH
|
||||
X11_Xcursor_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xcursor_LIB
|
||||
X11_Xcursor_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xdamage_INCLUDE_PATH
|
||||
X11_Xdamage_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xdamage_LIB
|
||||
X11_Xdamage_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xdmcp_INCLUDE_PATH
|
||||
X11_Xdmcp_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xdmcp_LIB
|
||||
X11_Xdmcp_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xext_INCLUDE_PATH
|
||||
X11_Xext_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xext_LIB
|
||||
X11_Xext_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xfixes_INCLUDE_PATH
|
||||
X11_Xfixes_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xfixes_LIB
|
||||
X11_Xfixes_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xft_INCLUDE_PATH
|
||||
X11_Xft_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xft_LIB
|
||||
X11_Xft_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xi_INCLUDE_PATH
|
||||
X11_Xi_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xi_LIB
|
||||
X11_Xi_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xinerama_INCLUDE_PATH
|
||||
X11_Xinerama_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xinerama_LIB
|
||||
X11_Xinerama_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xkb_INCLUDE_PATH
|
||||
X11_Xkb_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xkblib_INCLUDE_PATH
|
||||
X11_Xkblib_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xlib_INCLUDE_PATH
|
||||
X11_Xlib_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xmu_INCLUDE_PATH
|
||||
X11_Xmu_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xmu_LIB
|
||||
X11_Xmu_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xpm_INCLUDE_PATH
|
||||
X11_Xpm_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xpm_LIB
|
||||
X11_Xpm_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xrandr_INCLUDE_PATH
|
||||
X11_Xrandr_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xrandr_LIB
|
||||
X11_Xrandr_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xrender_INCLUDE_PATH
|
||||
X11_Xrender_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xrender_LIB
|
||||
X11_Xrender_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xshape_INCLUDE_PATH
|
||||
X11_Xshape_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xss_INCLUDE_PATH
|
||||
X11_Xss_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xss_LIB
|
||||
X11_Xss_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xt_INCLUDE_PATH
|
||||
X11_Xt_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xt_LIB
|
||||
X11_Xt_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xtst_INCLUDE_PATH
|
||||
X11_Xtst_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xtst_LIB
|
||||
X11_Xtst_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xutil_INCLUDE_PATH
|
||||
X11_Xutil_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xv_INCLUDE_PATH
|
||||
X11_Xv_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xv_LIB
|
||||
X11_Xv_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xxf86misc_INCLUDE_PATH
|
||||
X11_Xxf86misc_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xxf86misc_LIB
|
||||
X11_Xxf86misc_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xxf86vm_INCLUDE_PATH
|
||||
X11_Xxf86vm_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_Xxf86vm_LIB
|
||||
X11_Xxf86vm_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_dpms_INCLUDE_PATH
|
||||
X11_dpms_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_INCLUDE_PATH
|
||||
X11_xcb_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_LIB
|
||||
X11_xcb_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_icccm_INCLUDE_PATH
|
||||
X11_xcb_icccm_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_icccm_LIB
|
||||
X11_xcb_icccm_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_keysyms_INCLUDE_PATH
|
||||
X11_xcb_keysyms_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_keysyms_LIB
|
||||
X11_xcb_keysyms_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_randr_INCLUDE_PATH
|
||||
X11_xcb_randr_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_randr_LIB
|
||||
X11_xcb_randr_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_util_INCLUDE_PATH
|
||||
X11_xcb_util_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_util_LIB
|
||||
X11_xcb_util_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_xfixes_INCLUDE_PATH
|
||||
X11_xcb_xfixes_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_xfixes_LIB
|
||||
X11_xcb_xfixes_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_xkb_LIB
|
||||
X11_xcb_xkb_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_xtest_INCLUDE_PATH
|
||||
X11_xcb_xtest_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xcb_xtest_LIB
|
||||
X11_xcb_xtest_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xkbcommon_INCLUDE_PATH
|
||||
X11_xkbcommon_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xkbcommon_LIB
|
||||
X11_xkbcommon_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xkbcommon_X11_INCLUDE_PATH
|
||||
X11_xkbcommon_X11_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xkbcommon_X11_LIB
|
||||
X11_xkbcommon_X11_LIB-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xkbfile_INCLUDE_PATH
|
||||
X11_xkbfile_INCLUDE_PATH-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: X11_xkbfile_LIB
|
||||
X11_xkbfile_LIB-ADVANCED:INTERNAL=1
|
||||
//linker supports push/pop state
|
||||
_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED:INTERNAL=TRUE
|
||||
//CMAKE_INSTALL_PREFIX during last run
|
||||
_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX:INTERNAL=/usr/local
|
||||
__pkg_config_arguments_PKG_FONTCONFIG:INTERNAL=QUIET;fontconfig
|
||||
__pkg_config_checked_PKG_FONTCONFIG:INTERNAL=1
|
||||
//ADVANCED property for variable: pkgcfg_lib_PKG_FONTCONFIG_fontconfig
|
||||
pkgcfg_lib_PKG_FONTCONFIG_fontconfig-ADVANCED:INTERNAL=1
|
||||
//ADVANCED property for variable: pkgcfg_lib_PKG_FONTCONFIG_freetype
|
||||
pkgcfg_lib_PKG_FONTCONFIG_freetype-ADVANCED:INTERNAL=1
|
||||
prefix_result:INTERNAL=/usr/lib/x86_64-linux-gnu
|
||||
|
||||
72
Deer/build/CMakeFiles/3.25.1/CMakeCCompiler.cmake
Normal file
72
Deer/build/CMakeFiles/3.25.1/CMakeCCompiler.cmake
Normal file
@ -0,0 +1,72 @@
|
||||
set(CMAKE_C_COMPILER "/usr/bin/clang")
|
||||
set(CMAKE_C_COMPILER_ARG1 "")
|
||||
set(CMAKE_C_COMPILER_ID "Clang")
|
||||
set(CMAKE_C_COMPILER_VERSION "14.0.6")
|
||||
set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
|
||||
set(CMAKE_C_COMPILER_WRAPPER "")
|
||||
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17")
|
||||
set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON")
|
||||
set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23")
|
||||
set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
|
||||
set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
|
||||
set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
|
||||
set(CMAKE_C17_COMPILE_FEATURES "c_std_17")
|
||||
set(CMAKE_C23_COMPILE_FEATURES "c_std_23")
|
||||
|
||||
set(CMAKE_C_PLATFORM_ID "Linux")
|
||||
set(CMAKE_C_SIMULATE_ID "")
|
||||
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU")
|
||||
set(CMAKE_C_SIMULATE_VERSION "")
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_AR "/usr/bin/ar")
|
||||
set(CMAKE_C_COMPILER_AR "/usr/bin/llvm-ar-14")
|
||||
set(CMAKE_RANLIB "/usr/bin/ranlib")
|
||||
set(CMAKE_C_COMPILER_RANLIB "/usr/bin/llvm-ranlib-14")
|
||||
set(CMAKE_LINKER "/usr/bin/ld.lld")
|
||||
set(CMAKE_MT "")
|
||||
set(CMAKE_COMPILER_IS_GNUCC )
|
||||
set(CMAKE_C_COMPILER_LOADED 1)
|
||||
set(CMAKE_C_COMPILER_WORKS TRUE)
|
||||
set(CMAKE_C_ABI_COMPILED TRUE)
|
||||
|
||||
set(CMAKE_C_COMPILER_ENV_VAR "CC")
|
||||
|
||||
set(CMAKE_C_COMPILER_ID_RUN 1)
|
||||
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
|
||||
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
set(CMAKE_C_LINKER_PREFERENCE 10)
|
||||
|
||||
# Save compiler ABI information.
|
||||
set(CMAKE_C_SIZEOF_DATA_PTR "8")
|
||||
set(CMAKE_C_COMPILER_ABI "ELF")
|
||||
set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN")
|
||||
set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
|
||||
|
||||
if(CMAKE_C_SIZEOF_DATA_PTR)
|
||||
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ABI)
|
||||
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_LIBRARY_ARCHITECTURE)
|
||||
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
|
||||
if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
|
||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/llvm-14/lib/clang/14.0.6/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include")
|
||||
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s")
|
||||
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/12;/usr/lib64;/lib/x86_64-linux-gnu;/lib64;/usr/lib/x86_64-linux-gnu;/lib;/usr/lib")
|
||||
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
|
||||
BIN
Deer/build/CMakeFiles/3.25.1/CMakeDetermineCompilerABI_C.bin
Executable file
BIN
Deer/build/CMakeFiles/3.25.1/CMakeDetermineCompilerABI_C.bin
Executable file
Binary file not shown.
15
Deer/build/CMakeFiles/3.25.1/CMakeSystem.cmake
Normal file
15
Deer/build/CMakeFiles/3.25.1/CMakeSystem.cmake
Normal file
@ -0,0 +1,15 @@
|
||||
set(CMAKE_HOST_SYSTEM "Linux-6.1.0-37-amd64")
|
||||
set(CMAKE_HOST_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_HOST_SYSTEM_VERSION "6.1.0-37-amd64")
|
||||
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
|
||||
|
||||
|
||||
|
||||
set(CMAKE_SYSTEM "Linux-6.1.0-37-amd64")
|
||||
set(CMAKE_SYSTEM_NAME "Linux")
|
||||
set(CMAKE_SYSTEM_VERSION "6.1.0-37-amd64")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
|
||||
|
||||
set(CMAKE_CROSSCOMPILING "FALSE")
|
||||
|
||||
set(CMAKE_SYSTEM_LOADED 1)
|
||||
868
Deer/build/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c
Normal file
868
Deer/build/CMakeFiles/3.25.1/CompilerIdC/CMakeCCompilerId.c
Normal file
@ -0,0 +1,868 @@
|
||||
#ifdef __cplusplus
|
||||
# error "A C++ compiler has been selected for C."
|
||||
#endif
|
||||
|
||||
#if defined(__18CXX)
|
||||
# define ID_VOID_MAIN
|
||||
#endif
|
||||
#if defined(__CLASSIC_C__)
|
||||
/* cv-qualifiers did not exist in K&R C */
|
||||
# define const
|
||||
# define volatile
|
||||
#endif
|
||||
|
||||
#if !defined(__has_include)
|
||||
/* If the compiler does not have __has_include, pretend the answer is
|
||||
always no. */
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number components: V=Version, R=Revision, P=Patch
|
||||
Version date components: YYYY=Year, MM=Month, DD=Day */
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(__ICC)
|
||||
# define COMPILER_ID "Intel"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# endif
|
||||
/* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later,
|
||||
except that a few beta releases use the old format with V=2021. */
|
||||
# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
|
||||
# if defined(__INTEL_COMPILER_UPDATE)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
|
||||
# else
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
|
||||
# endif
|
||||
# else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE)
|
||||
/* The third version component from --version is an update index,
|
||||
but no macro is provided for it. */
|
||||
# define COMPILER_VERSION_PATCH DEC(0)
|
||||
# endif
|
||||
# if defined(__INTEL_COMPILER_BUILD_DATE)
|
||||
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
|
||||
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
|
||||
# endif
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
# elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
# endif
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)
|
||||
# define COMPILER_ID "IntelLLVM"
|
||||
#if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
#endif
|
||||
/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
|
||||
* later. Look for 6 digit vs. 8 digit version number to decide encoding.
|
||||
* VVVV is no smaller than the current year when a version is released.
|
||||
*/
|
||||
#if __INTEL_LLVM_COMPILER < 1000000L
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10)
|
||||
#else
|
||||
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100)
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
#endif
|
||||
#if defined(__GNUC__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
#elif defined(__GNUG__)
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
|
||||
#endif
|
||||
#if defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
#endif
|
||||
#if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#elif defined(__PATHCC__)
|
||||
# define COMPILER_ID "PathScale"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
|
||||
# if defined(__PATHCC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
|
||||
# define COMPILER_ID "Embarcadero"
|
||||
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
|
||||
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
|
||||
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
|
||||
|
||||
#elif defined(__BORLANDC__)
|
||||
# define COMPILER_ID "Borland"
|
||||
/* __BORLANDC__ = 0xVRR */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
|
||||
|
||||
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
|
||||
# define COMPILER_ID "Watcom"
|
||||
/* __WATCOMC__ = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# define COMPILER_ID "OpenWatcom"
|
||||
/* __WATCOMC__ = VVRP + 1100 */
|
||||
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
|
||||
# if (__WATCOMC__ % 10) > 0
|
||||
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__SUNPRO_C)
|
||||
# define COMPILER_ID "SunPro"
|
||||
# if __SUNPRO_C >= 0x5100
|
||||
/* __SUNPRO_C = 0xVRRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
||||
# else
|
||||
/* __SUNPRO_CC = 0xVRP */
|
||||
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
|
||||
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
|
||||
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
|
||||
# endif
|
||||
|
||||
#elif defined(__HP_cc)
|
||||
# define COMPILER_ID "HP"
|
||||
/* __HP_cc = VVRRPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
|
||||
|
||||
#elif defined(__DECC)
|
||||
# define COMPILER_ID "Compaq"
|
||||
/* __DECC_VER = VVRRTPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
|
||||
|
||||
#elif defined(__IBMC__) && defined(__COMPILER_VER__)
|
||||
# define COMPILER_ID "zOS"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__open_xl__) && defined(__clang__)
|
||||
# define COMPILER_ID "IBMClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__open_xl_release__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__)
|
||||
|
||||
|
||||
#elif defined(__ibmxl__) && defined(__clang__)
|
||||
# define COMPILER_ID "XLClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
|
||||
|
||||
|
||||
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
|
||||
# define COMPILER_ID "XL"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
|
||||
# define COMPILER_ID "VisualAge"
|
||||
/* __IBMC__ = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
|
||||
|
||||
#elif defined(__NVCOMPILER)
|
||||
# define COMPILER_ID "NVHPC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
|
||||
# if defined(__NVCOMPILER_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(__PGI)
|
||||
# define COMPILER_ID "PGI"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
|
||||
# if defined(__PGIC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_CRAYC)
|
||||
# define COMPILER_ID "Cray"
|
||||
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# define COMPILER_ID "TI"
|
||||
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
|
||||
|
||||
#elif defined(__CLANG_FUJITSU)
|
||||
# define COMPILER_ID "FujitsuClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
|
||||
|
||||
|
||||
#elif defined(__FUJITSU)
|
||||
# define COMPILER_ID "Fujitsu"
|
||||
# if defined(__FCC_version__)
|
||||
# define COMPILER_VERSION __FCC_version__
|
||||
# elif defined(__FCC_major__)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
|
||||
# endif
|
||||
# if defined(__fcc_version)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
|
||||
# elif defined(__FCC_VERSION)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
|
||||
# endif
|
||||
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# define COMPILER_ID "GHS"
|
||||
/* __GHS_VERSION_NUMBER = VVVVRP */
|
||||
# ifdef __GHS_VERSION_NUMBER
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
|
||||
# endif
|
||||
|
||||
#elif defined(__TASKING__)
|
||||
# define COMPILER_ID "Tasking"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__VERSION__)
|
||||
|
||||
#elif defined(__TINYC__)
|
||||
# define COMPILER_ID "TinyCC"
|
||||
|
||||
#elif defined(__BCC__)
|
||||
# define COMPILER_ID "Bruce"
|
||||
|
||||
#elif defined(__SCO_VERSION__)
|
||||
# define COMPILER_ID "SCO"
|
||||
|
||||
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
|
||||
# define COMPILER_ID "ARMCC"
|
||||
#if __ARMCC_VERSION >= 1000000
|
||||
/* __ARMCC_VERSION = VRRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#else
|
||||
/* __ARMCC_VERSION = VRPPPP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
|
||||
#endif
|
||||
|
||||
|
||||
#elif defined(__clang__) && defined(__apple_build_version__)
|
||||
# define COMPILER_ID "AppleClang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
|
||||
|
||||
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
|
||||
# define COMPILER_ID "ARMClang"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
|
||||
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
|
||||
|
||||
#elif defined(__clang__)
|
||||
# define COMPILER_ID "Clang"
|
||||
# if defined(_MSC_VER)
|
||||
# define SIMULATE_ID "MSVC"
|
||||
# endif
|
||||
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
|
||||
# if defined(_MSC_VER)
|
||||
/* _MSC_VER = VVRR */
|
||||
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# endif
|
||||
|
||||
#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))
|
||||
# define COMPILER_ID "LCC"
|
||||
# define COMPILER_VERSION_MAJOR DEC(1)
|
||||
# if defined(__LCC__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__LCC__- 100)
|
||||
# endif
|
||||
# if defined(__LCC_MINOR__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||
# define SIMULATE_ID "GNU"
|
||||
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
|
||||
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
# define COMPILER_ID "GNU"
|
||||
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
|
||||
# if defined(__GNUC_MINOR__)
|
||||
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
|
||||
# endif
|
||||
# if defined(__GNUC_PATCHLEVEL__)
|
||||
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
|
||||
# endif
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
# define COMPILER_ID "MSVC"
|
||||
/* _MSC_VER = VVRR */
|
||||
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
|
||||
# if defined(_MSC_FULL_VER)
|
||||
# if _MSC_VER >= 1400
|
||||
/* _MSC_FULL_VER = VVRRPPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
|
||||
# else
|
||||
/* _MSC_FULL_VER = VVRRPPPP */
|
||||
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
|
||||
# endif
|
||||
# endif
|
||||
# if defined(_MSC_BUILD)
|
||||
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
|
||||
# endif
|
||||
|
||||
#elif defined(_ADI_COMPILER)
|
||||
# define COMPILER_ID "ADSP"
|
||||
#if defined(__VERSIONNUM__)
|
||||
/* __VERSIONNUM__ = 0xVVRRPPTT */
|
||||
# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF)
|
||||
# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF)
|
||||
# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF)
|
||||
# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF)
|
||||
#endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# define COMPILER_ID "IAR"
|
||||
# if defined(__VER__) && defined(__ICCARM__)
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
|
||||
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
|
||||
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
|
||||
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
|
||||
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
|
||||
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
|
||||
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
|
||||
# endif
|
||||
|
||||
#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
|
||||
# define COMPILER_ID "SDCC"
|
||||
# if defined(__SDCC_VERSION_MAJOR)
|
||||
# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
|
||||
# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
|
||||
# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
|
||||
# else
|
||||
/* SDCC = VRP */
|
||||
# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
|
||||
# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
|
||||
# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
|
||||
# endif
|
||||
|
||||
|
||||
/* These compilers are either not known or too old to define an
|
||||
identification macro. Try to identify the platform and guess that
|
||||
it is the native compiler. */
|
||||
#elif defined(__hpux) || defined(__hpua)
|
||||
# define COMPILER_ID "HP"
|
||||
|
||||
#else /* unknown compiler */
|
||||
# define COMPILER_ID ""
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
|
||||
#ifdef SIMULATE_ID
|
||||
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
|
||||
#endif
|
||||
|
||||
#ifdef __QNXNTO__
|
||||
char const* qnxnto = "INFO" ":" "qnxnto[]";
|
||||
#endif
|
||||
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
|
||||
#endif
|
||||
|
||||
#define STRINGIFY_HELPER(X) #X
|
||||
#define STRINGIFY(X) STRINGIFY_HELPER(X)
|
||||
|
||||
/* Identify known platforms by name. */
|
||||
#if defined(__linux) || defined(__linux__) || defined(linux)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
#elif defined(__MSYS__)
|
||||
# define PLATFORM_ID "MSYS"
|
||||
|
||||
#elif defined(__CYGWIN__)
|
||||
# define PLATFORM_ID "Cygwin"
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define PLATFORM_ID "MinGW"
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
# define PLATFORM_ID "Darwin"
|
||||
|
||||
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||
# define PLATFORM_ID "Windows"
|
||||
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD)
|
||||
# define PLATFORM_ID "FreeBSD"
|
||||
|
||||
#elif defined(__NetBSD__) || defined(__NetBSD)
|
||||
# define PLATFORM_ID "NetBSD"
|
||||
|
||||
#elif defined(__OpenBSD__) || defined(__OPENBSD)
|
||||
# define PLATFORM_ID "OpenBSD"
|
||||
|
||||
#elif defined(__sun) || defined(sun)
|
||||
# define PLATFORM_ID "SunOS"
|
||||
|
||||
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
|
||||
# define PLATFORM_ID "AIX"
|
||||
|
||||
#elif defined(__hpux) || defined(__hpux__)
|
||||
# define PLATFORM_ID "HP-UX"
|
||||
|
||||
#elif defined(__HAIKU__)
|
||||
# define PLATFORM_ID "Haiku"
|
||||
|
||||
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
|
||||
# define PLATFORM_ID "BeOS"
|
||||
|
||||
#elif defined(__QNX__) || defined(__QNXNTO__)
|
||||
# define PLATFORM_ID "QNX"
|
||||
|
||||
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
|
||||
# define PLATFORM_ID "Tru64"
|
||||
|
||||
#elif defined(__riscos) || defined(__riscos__)
|
||||
# define PLATFORM_ID "RISCos"
|
||||
|
||||
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
|
||||
# define PLATFORM_ID "SINIX"
|
||||
|
||||
#elif defined(__UNIX_SV__)
|
||||
# define PLATFORM_ID "UNIX_SV"
|
||||
|
||||
#elif defined(__bsdos__)
|
||||
# define PLATFORM_ID "BSDOS"
|
||||
|
||||
#elif defined(_MPRAS) || defined(MPRAS)
|
||||
# define PLATFORM_ID "MP-RAS"
|
||||
|
||||
#elif defined(__osf) || defined(__osf__)
|
||||
# define PLATFORM_ID "OSF1"
|
||||
|
||||
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
|
||||
# define PLATFORM_ID "SCO_SV"
|
||||
|
||||
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
|
||||
# define PLATFORM_ID "ULTRIX"
|
||||
|
||||
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
|
||||
# define PLATFORM_ID "Xenix"
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(__LINUX__)
|
||||
# define PLATFORM_ID "Linux"
|
||||
|
||||
# elif defined(__DOS__)
|
||||
# define PLATFORM_ID "DOS"
|
||||
|
||||
# elif defined(__OS2__)
|
||||
# define PLATFORM_ID "OS2"
|
||||
|
||||
# elif defined(__WINDOWS__)
|
||||
# define PLATFORM_ID "Windows3x"
|
||||
|
||||
# elif defined(__VXWORKS__)
|
||||
# define PLATFORM_ID "VxWorks"
|
||||
|
||||
# else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
# endif
|
||||
|
||||
#elif defined(__INTEGRITY)
|
||||
# if defined(INT_178B)
|
||||
# define PLATFORM_ID "Integrity178"
|
||||
|
||||
# else /* regular Integrity */
|
||||
# define PLATFORM_ID "Integrity"
|
||||
# endif
|
||||
|
||||
# elif defined(_ADI_COMPILER)
|
||||
# define PLATFORM_ID "ADSP"
|
||||
|
||||
#else /* unknown platform */
|
||||
# define PLATFORM_ID
|
||||
|
||||
#endif
|
||||
|
||||
/* For windows compilers MSVC and Intel we can determine
|
||||
the architecture of the compiler being used. This is because
|
||||
the compilers do not have flags that can change the architecture,
|
||||
but rather depend on which compiler is being used
|
||||
*/
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
# if defined(_M_IA64)
|
||||
# define ARCHITECTURE_ID "IA64"
|
||||
|
||||
# elif defined(_M_ARM64EC)
|
||||
# define ARCHITECTURE_ID "ARM64EC"
|
||||
|
||||
# elif defined(_M_X64) || defined(_M_AMD64)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# elif defined(_M_ARM64)
|
||||
# define ARCHITECTURE_ID "ARM64"
|
||||
|
||||
# elif defined(_M_ARM)
|
||||
# if _M_ARM == 4
|
||||
# define ARCHITECTURE_ID "ARMV4I"
|
||||
# elif _M_ARM == 5
|
||||
# define ARCHITECTURE_ID "ARMV5I"
|
||||
# else
|
||||
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
|
||||
# endif
|
||||
|
||||
# elif defined(_M_MIPS)
|
||||
# define ARCHITECTURE_ID "MIPS"
|
||||
|
||||
# elif defined(_M_SH)
|
||||
# define ARCHITECTURE_ID "SHx"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
# if defined(_M_I86)
|
||||
# define ARCHITECTURE_ID "I86"
|
||||
|
||||
# elif defined(_M_IX86)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
|
||||
# if defined(__ICCARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__ICCRX__)
|
||||
# define ARCHITECTURE_ID "RX"
|
||||
|
||||
# elif defined(__ICCRH850__)
|
||||
# define ARCHITECTURE_ID "RH850"
|
||||
|
||||
# elif defined(__ICCRL78__)
|
||||
# define ARCHITECTURE_ID "RL78"
|
||||
|
||||
# elif defined(__ICCRISCV__)
|
||||
# define ARCHITECTURE_ID "RISCV"
|
||||
|
||||
# elif defined(__ICCAVR__)
|
||||
# define ARCHITECTURE_ID "AVR"
|
||||
|
||||
# elif defined(__ICC430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__ICCV850__)
|
||||
# define ARCHITECTURE_ID "V850"
|
||||
|
||||
# elif defined(__ICC8051__)
|
||||
# define ARCHITECTURE_ID "8051"
|
||||
|
||||
# elif defined(__ICCSTM8__)
|
||||
# define ARCHITECTURE_ID "STM8"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__ghs__)
|
||||
# if defined(__PPC64__)
|
||||
# define ARCHITECTURE_ID "PPC64"
|
||||
|
||||
# elif defined(__ppc__)
|
||||
# define ARCHITECTURE_ID "PPC"
|
||||
|
||||
# elif defined(__ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__x86_64__)
|
||||
# define ARCHITECTURE_ID "x64"
|
||||
|
||||
# elif defined(__i386__)
|
||||
# define ARCHITECTURE_ID "X86"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
# if defined(__TI_ARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__MSP430__)
|
||||
# define ARCHITECTURE_ID "MSP430"
|
||||
|
||||
# elif defined(__TMS320C28XX__)
|
||||
# define ARCHITECTURE_ID "TMS320C28x"
|
||||
|
||||
# elif defined(__TMS320C6X__) || defined(_TMS320C6X)
|
||||
# define ARCHITECTURE_ID "TMS320C6x"
|
||||
|
||||
# else /* unknown architecture */
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
# elif defined(__ADSPSHARC__)
|
||||
# define ARCHITECTURE_ID "SHARC"
|
||||
|
||||
# elif defined(__ADSPBLACKFIN__)
|
||||
# define ARCHITECTURE_ID "Blackfin"
|
||||
|
||||
#elif defined(__TASKING__)
|
||||
|
||||
# if defined(__CTC__) || defined(__CPTC__)
|
||||
# define ARCHITECTURE_ID "TriCore"
|
||||
|
||||
# elif defined(__CMCS__)
|
||||
# define ARCHITECTURE_ID "MCS"
|
||||
|
||||
# elif defined(__CARM__)
|
||||
# define ARCHITECTURE_ID "ARM"
|
||||
|
||||
# elif defined(__CARC__)
|
||||
# define ARCHITECTURE_ID "ARC"
|
||||
|
||||
# elif defined(__C51__)
|
||||
# define ARCHITECTURE_ID "8051"
|
||||
|
||||
# elif defined(__CPCP__)
|
||||
# define ARCHITECTURE_ID "PCP"
|
||||
|
||||
# else
|
||||
# define ARCHITECTURE_ID ""
|
||||
# endif
|
||||
|
||||
#else
|
||||
# define ARCHITECTURE_ID
|
||||
#endif
|
||||
|
||||
/* Convert integer to decimal digit literals. */
|
||||
#define DEC(n) \
|
||||
('0' + (((n) / 10000000)%10)), \
|
||||
('0' + (((n) / 1000000)%10)), \
|
||||
('0' + (((n) / 100000)%10)), \
|
||||
('0' + (((n) / 10000)%10)), \
|
||||
('0' + (((n) / 1000)%10)), \
|
||||
('0' + (((n) / 100)%10)), \
|
||||
('0' + (((n) / 10)%10)), \
|
||||
('0' + ((n) % 10))
|
||||
|
||||
/* Convert integer to hex digit literals. */
|
||||
#define HEX(n) \
|
||||
('0' + ((n)>>28 & 0xF)), \
|
||||
('0' + ((n)>>24 & 0xF)), \
|
||||
('0' + ((n)>>20 & 0xF)), \
|
||||
('0' + ((n)>>16 & 0xF)), \
|
||||
('0' + ((n)>>12 & 0xF)), \
|
||||
('0' + ((n)>>8 & 0xF)), \
|
||||
('0' + ((n)>>4 & 0xF)), \
|
||||
('0' + ((n) & 0xF))
|
||||
|
||||
/* Construct a string literal encoding the version number. */
|
||||
#ifdef COMPILER_VERSION
|
||||
char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#elif defined(COMPILER_VERSION_MAJOR)
|
||||
char const info_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
|
||||
COMPILER_VERSION_MAJOR,
|
||||
# ifdef COMPILER_VERSION_MINOR
|
||||
'.', COMPILER_VERSION_MINOR,
|
||||
# ifdef COMPILER_VERSION_PATCH
|
||||
'.', COMPILER_VERSION_PATCH,
|
||||
# ifdef COMPILER_VERSION_TWEAK
|
||||
'.', COMPILER_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the internal version number. */
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
char const info_version_internal[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
|
||||
'i','n','t','e','r','n','a','l','[',
|
||||
COMPILER_VERSION_INTERNAL,']','\0'};
|
||||
#elif defined(COMPILER_VERSION_INTERNAL_STR)
|
||||
char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
|
||||
#endif
|
||||
|
||||
/* Construct a string literal encoding the version number components. */
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
char const info_simulate_version[] = {
|
||||
'I', 'N', 'F', 'O', ':',
|
||||
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
|
||||
SIMULATE_VERSION_MAJOR,
|
||||
# ifdef SIMULATE_VERSION_MINOR
|
||||
'.', SIMULATE_VERSION_MINOR,
|
||||
# ifdef SIMULATE_VERSION_PATCH
|
||||
'.', SIMULATE_VERSION_PATCH,
|
||||
# ifdef SIMULATE_VERSION_TWEAK
|
||||
'.', SIMULATE_VERSION_TWEAK,
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
']','\0'};
|
||||
#endif
|
||||
|
||||
/* Construct the string literal in pieces to prevent the source from
|
||||
getting matched. Store it in a pointer rather than an array
|
||||
because some compilers will just produce instructions to fill the
|
||||
array rather than assigning a pointer to a static array. */
|
||||
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
|
||||
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
|
||||
|
||||
|
||||
|
||||
#if !defined(__STDC__) && !defined(__clang__)
|
||||
# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
|
||||
# define C_VERSION "90"
|
||||
# else
|
||||
# define C_VERSION
|
||||
# endif
|
||||
#elif __STDC_VERSION__ > 201710L
|
||||
# define C_VERSION "23"
|
||||
#elif __STDC_VERSION__ >= 201710L
|
||||
# define C_VERSION "17"
|
||||
#elif __STDC_VERSION__ >= 201000L
|
||||
# define C_VERSION "11"
|
||||
#elif __STDC_VERSION__ >= 199901L
|
||||
# define C_VERSION "99"
|
||||
#else
|
||||
# define C_VERSION "90"
|
||||
#endif
|
||||
const char* info_language_standard_default =
|
||||
"INFO" ":" "standard_default[" C_VERSION "]";
|
||||
|
||||
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
|
||||
#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
|
||||
defined(__TI_COMPILER_VERSION__)) && \
|
||||
!defined(__STRICT_ANSI__)
|
||||
"ON"
|
||||
#else
|
||||
"OFF"
|
||||
#endif
|
||||
"]";
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef ID_VOID_MAIN
|
||||
void main() {}
|
||||
#else
|
||||
# if defined(__CLASSIC_C__)
|
||||
int main(argc, argv) int argc; char *argv[];
|
||||
# else
|
||||
int main(int argc, char* argv[])
|
||||
# endif
|
||||
{
|
||||
int require = 0;
|
||||
require += info_compiler[argc];
|
||||
require += info_platform[argc];
|
||||
require += info_arch[argc];
|
||||
#ifdef COMPILER_VERSION_MAJOR
|
||||
require += info_version[argc];
|
||||
#endif
|
||||
#ifdef COMPILER_VERSION_INTERNAL
|
||||
require += info_version_internal[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_ID
|
||||
require += info_simulate[argc];
|
||||
#endif
|
||||
#ifdef SIMULATE_VERSION_MAJOR
|
||||
require += info_simulate_version[argc];
|
||||
#endif
|
||||
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
|
||||
require += info_cray[argc];
|
||||
#endif
|
||||
require += info_language_standard_default[argc];
|
||||
require += info_language_extensions_default[argc];
|
||||
(void)argv;
|
||||
return require;
|
||||
}
|
||||
#endif
|
||||
BIN
Deer/build/CMakeFiles/3.25.1/CompilerIdC/a.out
Executable file
BIN
Deer/build/CMakeFiles/3.25.1/CompilerIdC/a.out
Executable file
Binary file not shown.
232
Deer/build/CMakeFiles/CMakeOutput.log
Normal file
232
Deer/build/CMakeFiles/CMakeOutput.log
Normal file
@ -0,0 +1,232 @@
|
||||
The system is: Linux - 6.1.0-37-amd64 - x86_64
|
||||
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
|
||||
Compiler: /usr/bin/clang
|
||||
Build flags:
|
||||
Id flags:
|
||||
|
||||
The output was:
|
||||
0
|
||||
|
||||
|
||||
Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"
|
||||
|
||||
The C compiler identification is Clang, found in "/home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/3.25.1/CompilerIdC/a.out"
|
||||
|
||||
Detecting C compiler ABI info compiled with the following output:
|
||||
Change Dir: /home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-alLOVr
|
||||
|
||||
Run Build Command(s):/usr/bin/ninja cmTC_0c967 && [1/2] Building C object CMakeFiles/cmTC_0c967.dir/CMakeCCompilerABI.c.o
|
||||
Debian clang version 14.0.6
|
||||
Target: x86_64-pc-linux-gnu
|
||||
Thread model: posix
|
||||
InstalledDir: /usr/bin
|
||||
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
|
||||
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
|
||||
Candidate multilib: .;@m64
|
||||
Selected multilib: .;@m64
|
||||
(in-process)
|
||||
"/usr/lib/llvm-14/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-alLOVr -resource-dir /usr/lib/llvm-14/lib/clang/14.0.6 -dependency-file CMakeFiles/cmTC_0c967.dir/CMakeCCompilerABI.c.o.d -MT CMakeFiles/cmTC_0c967.dir/CMakeCCompilerABI.c.o -sys-header-deps -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-alLOVr -ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_0c967.dir/CMakeCCompilerABI.c.o -x c /usr/share/cmake-3.25/Modules/CMakeCCompilerABI.c
|
||||
clang -cc1 version 14.0.6 based upon LLVM 14.0.6 default target x86_64-pc-linux-gnu
|
||||
ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
|
||||
ignoring nonexistent directory "/include"
|
||||
#include "..." search starts here:
|
||||
#include <...> search starts here:
|
||||
/usr/lib/llvm-14/lib/clang/14.0.6/include
|
||||
/usr/local/include
|
||||
/usr/include/x86_64-linux-gnu
|
||||
/usr/include
|
||||
End of search list.
|
||||
[2/2] Linking C executable cmTC_0c967
|
||||
Debian clang version 14.0.6
|
||||
Target: x86_64-pc-linux-gnu
|
||||
Thread model: posix
|
||||
InstalledDir: /usr/bin
|
||||
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
|
||||
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
|
||||
Candidate multilib: .;@m64
|
||||
Selected multilib: .;@m64
|
||||
"/usr/bin/ld" -pie --hash-style=both --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_0c967 /lib/x86_64-linux-gnu/Scrt1.o /lib/x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtbeginS.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib -L/usr/lib CMakeFiles/cmTC_0c967.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtendS.o /lib/x86_64-linux-gnu/crtn.o
|
||||
|
||||
|
||||
|
||||
Parsed C implicit include dir info from above output: rv=done
|
||||
found start of include info
|
||||
found start of implicit include info
|
||||
add: [/usr/lib/llvm-14/lib/clang/14.0.6/include]
|
||||
add: [/usr/local/include]
|
||||
add: [/usr/include/x86_64-linux-gnu]
|
||||
add: [/usr/include]
|
||||
end of search list found
|
||||
collapse include dir [/usr/lib/llvm-14/lib/clang/14.0.6/include] ==> [/usr/lib/llvm-14/lib/clang/14.0.6/include]
|
||||
collapse include dir [/usr/local/include] ==> [/usr/local/include]
|
||||
collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu]
|
||||
collapse include dir [/usr/include] ==> [/usr/include]
|
||||
implicit include dirs: [/usr/lib/llvm-14/lib/clang/14.0.6/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include]
|
||||
|
||||
|
||||
Parsed C implicit link information from above output:
|
||||
link line regex: [^( *|.*[/\])(ld\.lld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
|
||||
ignore line: [Change Dir: /home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-alLOVr]
|
||||
ignore line: []
|
||||
ignore line: [Run Build Command(s):/usr/bin/ninja cmTC_0c967 && [1/2] Building C object CMakeFiles/cmTC_0c967.dir/CMakeCCompilerABI.c.o]
|
||||
ignore line: [Debian clang version 14.0.6]
|
||||
ignore line: [Target: x86_64-pc-linux-gnu]
|
||||
ignore line: [Thread model: posix]
|
||||
ignore line: [InstalledDir: /usr/bin]
|
||||
ignore line: [Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12]
|
||||
ignore line: [Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12]
|
||||
ignore line: [Candidate multilib: .]
|
||||
ignore line: [@m64]
|
||||
ignore line: [Selected multilib: .]
|
||||
ignore line: [@m64]
|
||||
ignore line: [ (in-process)]
|
||||
ignore line: [ "/usr/lib/llvm-14/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -v -fcoverage-compilation-dir=/home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-alLOVr -resource-dir /usr/lib/llvm-14/lib/clang/14.0.6 -dependency-file CMakeFiles/cmTC_0c967.dir/CMakeCCompilerABI.c.o.d -MT CMakeFiles/cmTC_0c967.dir/CMakeCCompilerABI.c.o -sys-header-deps -internal-isystem /usr/lib/llvm-14/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-alLOVr -ferror-limit 19 -fgnuc-version=4.2.1 -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o CMakeFiles/cmTC_0c967.dir/CMakeCCompilerABI.c.o -x c /usr/share/cmake-3.25/Modules/CMakeCCompilerABI.c]
|
||||
ignore line: [clang -cc1 version 14.0.6 based upon LLVM 14.0.6 default target x86_64-pc-linux-gnu]
|
||||
ignore line: [ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"]
|
||||
ignore line: [ignoring nonexistent directory "/include"]
|
||||
ignore line: [#include "..." search starts here:]
|
||||
ignore line: [#include <...> search starts here:]
|
||||
ignore line: [ /usr/lib/llvm-14/lib/clang/14.0.6/include]
|
||||
ignore line: [ /usr/local/include]
|
||||
ignore line: [ /usr/include/x86_64-linux-gnu]
|
||||
ignore line: [ /usr/include]
|
||||
ignore line: [End of search list.]
|
||||
ignore line: [[2/2] Linking C executable cmTC_0c967]
|
||||
ignore line: [Debian clang version 14.0.6]
|
||||
ignore line: [Target: x86_64-pc-linux-gnu]
|
||||
ignore line: [Thread model: posix]
|
||||
ignore line: [InstalledDir: /usr/bin]
|
||||
ignore line: [Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12]
|
||||
ignore line: [Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12]
|
||||
ignore line: [Candidate multilib: .]
|
||||
ignore line: [@m64]
|
||||
ignore line: [Selected multilib: .]
|
||||
ignore line: [@m64]
|
||||
link line: [ "/usr/bin/ld" -pie --hash-style=both --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTC_0c967 /lib/x86_64-linux-gnu/Scrt1.o /lib/x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtbeginS.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib -L/usr/lib CMakeFiles/cmTC_0c967.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtendS.o /lib/x86_64-linux-gnu/crtn.o]
|
||||
arg [/usr/bin/ld] ==> ignore
|
||||
arg [-pie] ==> ignore
|
||||
arg [--hash-style=both] ==> ignore
|
||||
arg [--build-id] ==> ignore
|
||||
arg [--eh-frame-hdr] ==> ignore
|
||||
arg [-m] ==> ignore
|
||||
arg [elf_x86_64] ==> ignore
|
||||
arg [-dynamic-linker] ==> ignore
|
||||
arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
|
||||
arg [-o] ==> ignore
|
||||
arg [cmTC_0c967] ==> ignore
|
||||
arg [/lib/x86_64-linux-gnu/Scrt1.o] ==> obj [/lib/x86_64-linux-gnu/Scrt1.o]
|
||||
arg [/lib/x86_64-linux-gnu/crti.o] ==> obj [/lib/x86_64-linux-gnu/crti.o]
|
||||
arg [/usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtbeginS.o] ==> obj [/usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtbeginS.o]
|
||||
arg [-L/usr/bin/../lib/gcc/x86_64-linux-gnu/12] ==> dir [/usr/bin/../lib/gcc/x86_64-linux-gnu/12]
|
||||
arg [-L/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../lib64] ==> dir [/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../lib64]
|
||||
arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu]
|
||||
arg [-L/lib/../lib64] ==> dir [/lib/../lib64]
|
||||
arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu]
|
||||
arg [-L/usr/lib/../lib64] ==> dir [/usr/lib/../lib64]
|
||||
arg [-L/lib] ==> dir [/lib]
|
||||
arg [-L/usr/lib] ==> dir [/usr/lib]
|
||||
arg [CMakeFiles/cmTC_0c967.dir/CMakeCCompilerABI.c.o] ==> ignore
|
||||
arg [-lgcc] ==> lib [gcc]
|
||||
arg [--as-needed] ==> ignore
|
||||
arg [-lgcc_s] ==> lib [gcc_s]
|
||||
arg [--no-as-needed] ==> ignore
|
||||
arg [-lc] ==> lib [c]
|
||||
arg [-lgcc] ==> lib [gcc]
|
||||
arg [--as-needed] ==> ignore
|
||||
arg [-lgcc_s] ==> lib [gcc_s]
|
||||
arg [--no-as-needed] ==> ignore
|
||||
arg [/usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtendS.o] ==> obj [/usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtendS.o]
|
||||
arg [/lib/x86_64-linux-gnu/crtn.o] ==> obj [/lib/x86_64-linux-gnu/crtn.o]
|
||||
collapse obj [/usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtbeginS.o] ==> [/usr/lib/gcc/x86_64-linux-gnu/12/crtbeginS.o]
|
||||
collapse obj [/usr/bin/../lib/gcc/x86_64-linux-gnu/12/crtendS.o] ==> [/usr/lib/gcc/x86_64-linux-gnu/12/crtendS.o]
|
||||
collapse library dir [/usr/bin/../lib/gcc/x86_64-linux-gnu/12] ==> [/usr/lib/gcc/x86_64-linux-gnu/12]
|
||||
collapse library dir [/usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../lib64] ==> [/usr/lib64]
|
||||
collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu]
|
||||
collapse library dir [/lib/../lib64] ==> [/lib64]
|
||||
collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
|
||||
collapse library dir [/usr/lib/../lib64] ==> [/usr/lib64]
|
||||
collapse library dir [/lib] ==> [/lib]
|
||||
collapse library dir [/usr/lib] ==> [/usr/lib]
|
||||
implicit libs: [gcc;gcc_s;c;gcc;gcc_s]
|
||||
implicit objs: [/lib/x86_64-linux-gnu/Scrt1.o;/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/12/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/12/crtendS.o;/lib/x86_64-linux-gnu/crtn.o]
|
||||
implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/12;/usr/lib64;/lib/x86_64-linux-gnu;/lib64;/usr/lib/x86_64-linux-gnu;/lib;/usr/lib]
|
||||
implicit fwks: []
|
||||
|
||||
|
||||
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD succeeded with the following output:
|
||||
Change Dir: /home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-1SarPp
|
||||
|
||||
Run Build Command(s):/usr/bin/ninja cmTC_d0870 && [1/2] Building C object CMakeFiles/cmTC_d0870.dir/src.c.o
|
||||
[2/2] Linking C executable cmTC_d0870
|
||||
|
||||
|
||||
Source file was:
|
||||
#include <pthread.h>
|
||||
|
||||
static void* test_func(void* data)
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
pthread_t thread;
|
||||
pthread_create(&thread, NULL, test_func, NULL);
|
||||
pthread_detach(thread);
|
||||
pthread_cancel(thread);
|
||||
pthread_join(thread, NULL);
|
||||
pthread_atfork(NULL, NULL, NULL);
|
||||
pthread_exit(NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Determining if the function XOpenDisplay exists in the /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so passed with the following output:
|
||||
Change Dir: /home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-lCKoVs
|
||||
|
||||
Run Build Command(s):/usr/bin/ninja cmTC_0919a && [1/2] Building C object CMakeFiles/cmTC_0919a.dir/CheckFunctionExists.c.o
|
||||
[2/2] Linking C executable cmTC_0919a
|
||||
|
||||
|
||||
|
||||
Determining if the function gethostbyname exists passed with the following output:
|
||||
Change Dir: /home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-ZaF5ZV
|
||||
|
||||
Run Build Command(s):/usr/bin/ninja cmTC_b3be6 && [1/2] Building C object CMakeFiles/cmTC_b3be6.dir/CheckFunctionExists.c.o
|
||||
[2/2] Linking C executable cmTC_b3be6
|
||||
|
||||
|
||||
|
||||
Determining if the function connect exists passed with the following output:
|
||||
Change Dir: /home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-PIEPp7
|
||||
|
||||
Run Build Command(s):/usr/bin/ninja cmTC_3f581 && [1/2] Building C object CMakeFiles/cmTC_3f581.dir/CheckFunctionExists.c.o
|
||||
[2/2] Linking C executable cmTC_3f581
|
||||
|
||||
|
||||
|
||||
Determining if the function remove exists passed with the following output:
|
||||
Change Dir: /home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-3DZngG
|
||||
|
||||
Run Build Command(s):/usr/bin/ninja cmTC_bb3df && [1/2] Building C object CMakeFiles/cmTC_bb3df.dir/CheckFunctionExists.c.o
|
||||
[2/2] Linking C executable cmTC_bb3df
|
||||
|
||||
|
||||
|
||||
Determining if the function shmat exists passed with the following output:
|
||||
Change Dir: /home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-esupUH
|
||||
|
||||
Run Build Command(s):/usr/bin/ninja cmTC_7934b && [1/2] Building C object CMakeFiles/cmTC_7934b.dir/CheckFunctionExists.c.o
|
||||
[2/2] Linking C executable cmTC_7934b
|
||||
|
||||
|
||||
|
||||
Determining if the function IceConnectionNumber exists in the ICE passed with the following output:
|
||||
Change Dir: /home/chewico/Dev/DeerEngine/Deer/build/CMakeFiles/CMakeScratch/TryCompile-yVjPRx
|
||||
|
||||
Run Build Command(s):/usr/bin/ninja cmTC_8fc97 && [1/2] Building C object CMakeFiles/cmTC_8fc97.dir/CheckFunctionExists.c.o
|
||||
[2/2] Linking C executable cmTC_8fc97
|
||||
|
||||
|
||||
|
||||
1
Deer/build/CMakeFiles/cmake.check_cache
Normal file
1
Deer/build/CMakeFiles/cmake.check_cache
Normal file
@ -0,0 +1 @@
|
||||
# This file is generated by cmake for dependency checking of the CMakeCache.txt file
|
||||
70
Deer/build/src/glfw3ConfigVersion.cmake
Normal file
70
Deer/build/src/glfw3ConfigVersion.cmake
Normal file
@ -0,0 +1,70 @@
|
||||
# This is a basic version file for the Config-mode of find_package().
|
||||
# It is used by write_basic_package_version_file() as input file for configure_file()
|
||||
# to create a version-file which can be installed along a config.cmake file.
|
||||
#
|
||||
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
||||
# the requested version string are exactly the same and it sets
|
||||
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
||||
# but only if the requested major version is the same as the current one.
|
||||
# The variable CVF_VERSION must be set before calling configure_file().
|
||||
|
||||
|
||||
set(PACKAGE_VERSION "3.4.0")
|
||||
|
||||
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
|
||||
if("3.4.0" MATCHES "^([0-9]+)\\.")
|
||||
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
|
||||
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
|
||||
endif()
|
||||
else()
|
||||
set(CVF_VERSION_MAJOR "3.4.0")
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION_RANGE)
|
||||
# both endpoints of the range must have the expected major version
|
||||
math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
|
||||
if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
||||
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
|
||||
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
else()
|
||||
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
endif()
|
||||
|
||||
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# if the installed project requested no architecture check, don't perform the check
|
||||
if("FALSE")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
|
||||
return()
|
||||
endif()
|
||||
|
||||
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
||||
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
||||
math(EXPR installedBits "8 * 8")
|
||||
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
endif()
|
||||
61
Deer/src/Deer/Core/Application.cpp
Normal file
61
Deer/src/Deer/Core/Application.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
#include "Deer/Application.h"
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
|
||||
namespace Deer {
|
||||
namespace Application {
|
||||
// Implemented in DeerRender/Application
|
||||
void runRender(float deltaTime);
|
||||
void resolveEvents();
|
||||
|
||||
Function tickCallback;
|
||||
bool running;
|
||||
|
||||
const double targetUpdateTime = 1.0 / 60.0; // Fixed 60 FPS update
|
||||
double targetRenderTime = 1.0 / 160.0; // User-defined render FPS
|
||||
|
||||
void setTickCallback(Function _tick) {
|
||||
tickCallback = _tick;
|
||||
}
|
||||
|
||||
void run() {
|
||||
running = true;
|
||||
|
||||
auto previousTime = std::chrono::high_resolution_clock::now();
|
||||
double accumulatedUpdateTime = 0.0;
|
||||
double accumulatedRenderTime = 0.0;
|
||||
|
||||
while (running) {
|
||||
// Time handling
|
||||
auto currentTime = std::chrono::high_resolution_clock::now();
|
||||
std::chrono::duration<double> deltaTime = currentTime - previousTime;
|
||||
previousTime = currentTime;
|
||||
|
||||
accumulatedUpdateTime += deltaTime.count();
|
||||
accumulatedRenderTime += deltaTime.count();
|
||||
|
||||
// Fixed Update loop (60 FPS)
|
||||
while (accumulatedUpdateTime >= targetUpdateTime) {
|
||||
Timestep timestep = (float)targetUpdateTime;
|
||||
accumulatedUpdateTime -= targetUpdateTime;
|
||||
|
||||
if (tickCallback)
|
||||
tickCallback();
|
||||
|
||||
}
|
||||
#ifdef DEER_RENDER
|
||||
if (accumulatedRenderTime >= targetRenderTime) {
|
||||
runRender((float)targetRenderTime);
|
||||
accumulatedRenderTime -= targetRenderTime;
|
||||
}
|
||||
resolveEvents();
|
||||
#endif
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
}
|
||||
|
||||
void shutdown() {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Deer/src/Deer/Core/Log.cpp
Executable file
37
Deer/src/Deer/Core/Log.cpp
Executable file
@ -0,0 +1,37 @@
|
||||
#include "Deer/Log.h"
|
||||
|
||||
namespace Deer {
|
||||
std::shared_ptr<spdlog::logger> Log::coreLogger;
|
||||
std::shared_ptr<spdlog::logger> Log::clientLogger;
|
||||
std::shared_ptr<spdlog::logger> Log::scriptLogger;
|
||||
std::shared_ptr<spdlog::logger> Log::EditorEngineLogger;
|
||||
|
||||
void Log::init()
|
||||
{
|
||||
spdlog::set_pattern("%^[%T] %n: %v%$");
|
||||
|
||||
coreLogger = spdlog::stdout_color_mt("Core");
|
||||
clientLogger = spdlog::stdout_color_mt("Client");
|
||||
scriptLogger = spdlog::stdout_color_mt("Script");
|
||||
EditorEngineLogger = spdlog::stdout_color_mt("UI Engine");
|
||||
|
||||
coreLogger->set_level(spdlog::level::level_enum::trace);
|
||||
clientLogger->set_level(spdlog::level::level_enum::trace);
|
||||
scriptLogger->set_level(spdlog::level::level_enum::trace);
|
||||
EditorEngineLogger->set_level(spdlog::level::level_enum::trace);
|
||||
}
|
||||
|
||||
void Log::shutdown() {
|
||||
coreLogger.reset();
|
||||
clientLogger.reset();
|
||||
scriptLogger.reset();
|
||||
EditorEngineLogger.reset();
|
||||
|
||||
spdlog::drop_all();
|
||||
}
|
||||
|
||||
void Log::coreTrace(const char* msg)
|
||||
{
|
||||
//coreLogger->trace(msg);
|
||||
}
|
||||
}
|
||||
210
Deer/src/Deer/DataStore/DataStore.cpp
Executable file
210
Deer/src/Deer/DataStore/DataStore.cpp
Executable file
@ -0,0 +1,210 @@
|
||||
#include "Deer/DataStore.h"
|
||||
#include "Deer/Log.h"
|
||||
#include "Deer/Tools/Path.h"
|
||||
|
||||
#include "cereal/archives/portable_binary.hpp"
|
||||
#include "cereal/cereal.hpp"
|
||||
#include "cereal/types/unordered_map.hpp"
|
||||
|
||||
#include "Deer/DataStore/DataStructure.h"
|
||||
#include "Deer/DataStore/DataStructureSerialization.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <streambuf>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace Deer {
|
||||
namespace DataStore {
|
||||
Path rootPath = "./";
|
||||
std::unordered_map<std::string, DirectoryData> dirData_cache;
|
||||
} // namespace DataStore
|
||||
|
||||
const DirectoryData& DataStore::getDirData(const Path& id,
|
||||
const Path& subDir,
|
||||
const char* extension) {
|
||||
std::string dirId = std::string(id) + "&" + std::string(subDir) + "&" +
|
||||
std::string(extension);
|
||||
if (dirData_cache.contains(dirId)) {
|
||||
return dirData_cache[dirId];
|
||||
}
|
||||
|
||||
Path idPath = rootPath / id;
|
||||
|
||||
Path searchPath = idPath / subDir;
|
||||
|
||||
DirectoryData& dirData = dirData_cache[dirId];
|
||||
for (const auto& entry :
|
||||
std::filesystem::directory_iterator(searchPath)) {
|
||||
if (entry.is_directory())
|
||||
dirData.dirs.push_back(entry.path().lexically_relative(idPath));
|
||||
else if (entry.path().extension() == extension) {
|
||||
Path ent = entry.path().lexically_relative(idPath);
|
||||
dirData.elements.push_back(ent.parent_path() / ent.stem());
|
||||
}
|
||||
}
|
||||
|
||||
return dirData;
|
||||
}
|
||||
|
||||
bool DataStore::loadFileData(const Path& id, const Path& name,
|
||||
uint8_t** data, uint32_t* size) {
|
||||
Path filePath = rootPath / id / name;
|
||||
std::ifstream file(filePath, std::ios::in | std::ios::binary);
|
||||
|
||||
if (!file) {
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
file.seekg(0, std::ios::end);
|
||||
*size = (size_t)file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
|
||||
*data = new uint8_t[*size];
|
||||
|
||||
if (!file.read(reinterpret_cast<char*>(*data), *size)) {
|
||||
DEER_CORE_ERROR("Failed to read file: {0}",
|
||||
filePath.generic_string().c_str());
|
||||
delete[] *data;
|
||||
return false;
|
||||
}
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DataStore::loadGlobalFileData(const Path& id, const Path& name,
|
||||
uint8_t** data, uint32_t* size) {
|
||||
Path filePath = rootPath / id;
|
||||
for (auto& f :
|
||||
std::filesystem::recursive_directory_iterator(filePath)) {
|
||||
if (f.path().stem() == name) {
|
||||
std::ifstream file(f.path(), std::ios::in | std::ios::binary);
|
||||
|
||||
if (!file) {
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
|
||||
file.seekg(0, std::ios::end);
|
||||
*size = (size_t)file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
|
||||
*data = new uint8_t[*size];
|
||||
|
||||
if (!file.read(reinterpret_cast<char*>(*data), *size)) {
|
||||
DEER_CORE_ERROR("Failed to read file: {0}",
|
||||
filePath.generic_string().c_str());
|
||||
delete[] *data;
|
||||
return false;
|
||||
}
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
DEER_CORE_ERROR("File {0} not found", filePath.string().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
void DataStore::freeFileData(uint8_t* data) { delete[] data; }
|
||||
|
||||
void DataStore::deleteFile(const Path& path) {
|
||||
Path filePath = rootPath / toLowerCasePath(path);
|
||||
std::filesystem::remove(filePath);
|
||||
}
|
||||
|
||||
uint8_t* DataStore::readFile(const Path& path, uint32_t* size) {
|
||||
Path filePath = rootPath / path;
|
||||
std::ifstream file(filePath, std::ios::in | std::ios::binary);
|
||||
|
||||
if (!file) {
|
||||
file.close();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
file.seekg(0, std::ios::end);
|
||||
*size = (size_t)file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
|
||||
uint8_t* buffer = new uint8_t[*size];
|
||||
|
||||
if (!file.read(reinterpret_cast<char*>(buffer), *size)) {
|
||||
DEER_CORE_ERROR("Failed to read file: {0}",
|
||||
filePath.generic_string().c_str());
|
||||
delete[] buffer;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
file.close();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void DataStore::saveFile(const Path& path, uint8_t* data, uint32_t size) {
|
||||
Path filePath = rootPath / toLowerCasePath(path);
|
||||
std::filesystem::create_directories(filePath.parent_path());
|
||||
|
||||
std::ofstream file(filePath, std::ios::out | std::ios::binary);
|
||||
|
||||
DEER_CORE_ASSERT(file, "Error when writing file {0}",
|
||||
filePath.generic_string().c_str());
|
||||
|
||||
file.write(reinterpret_cast<const char*>(data), size);
|
||||
}
|
||||
|
||||
void DataStore::compressFiles(std::vector<Path> files, const Path& path) {
|
||||
std::unordered_map<Path, DataStructure> dataStructure;
|
||||
std::vector<uint8_t> combinedData;
|
||||
|
||||
for (const Path& inputPath : files) {
|
||||
uint32_t fileSize = 0;
|
||||
uint8_t* fileData = readFile(inputPath, &fileSize);
|
||||
|
||||
uint32_t start = combinedData.size();
|
||||
|
||||
combinedData.insert(combinedData.end(), fileData,
|
||||
fileData + fileSize);
|
||||
dataStructure[inputPath] = DataStructure{.dataPath = inputPath,
|
||||
.dataStart = start,
|
||||
.dataSize = fileSize};
|
||||
|
||||
delete[] fileData;
|
||||
}
|
||||
|
||||
Path compressedPath = path;
|
||||
compressedPath += ".deer";
|
||||
Path metaPath = path;
|
||||
metaPath += ".deer.meta";
|
||||
|
||||
std::stringstream buffer;
|
||||
{
|
||||
cereal::PortableBinaryOutputArchive archive(buffer);
|
||||
archive(dataStructure);
|
||||
}
|
||||
|
||||
saveFile(compressedPath, combinedData.data(), combinedData.size());
|
||||
saveFile(metaPath, (uint8_t*)buffer.str().c_str(), buffer.str().size());
|
||||
}
|
||||
|
||||
std::vector<Path> DataStore::getFiles(const Path& path, const std::string& extension) {
|
||||
std::vector<Path> files;
|
||||
Path lookPath = rootPath / path;
|
||||
|
||||
for (const auto& entry :
|
||||
std::filesystem::recursive_directory_iterator(lookPath)) {
|
||||
if (std::filesystem::is_regular_file(entry) &&
|
||||
entry.path().extension() == extension) {
|
||||
files.push_back(entry.path().lexically_relative(rootPath));
|
||||
}
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
void DataStore::createFolder(const Path& path) {
|
||||
std::filesystem::create_directories(path);
|
||||
}
|
||||
} // namespace Deer
|
||||
11
Deer/src/Deer/DataStore/DataStructure.h
Executable file
11
Deer/src/Deer/DataStore/DataStructure.h
Executable file
@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Deer/Tools/Path.h"
|
||||
|
||||
namespace Deer {
|
||||
struct DataStructure {
|
||||
Path dataPath;
|
||||
uint32_t dataStart;
|
||||
uint32_t dataSize;
|
||||
};
|
||||
}
|
||||
33
Deer/src/Deer/DataStore/DataStructureSerialization.h
Executable file
33
Deer/src/Deer/DataStore/DataStructureSerialization.h
Executable file
@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
#include "Deer/DataStore/DataStructure.h"
|
||||
#include "Deer/Tools/Path.h"
|
||||
|
||||
#include "cereal/cereal.hpp"
|
||||
#include "cereal/types/string.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace cereal {
|
||||
template <class Archive>
|
||||
void save(Archive& archive,
|
||||
std::filesystem::path const& path) {
|
||||
archive(path.generic_string());
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void load(Archive& archive,
|
||||
std::filesystem::path& path) {
|
||||
std::string _path;
|
||||
archive(_path);
|
||||
path = std::filesystem::path(_path);
|
||||
}
|
||||
} // namespace cereal
|
||||
|
||||
namespace Deer {
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive& archive,
|
||||
DataStructure& ds) {
|
||||
archive(ds.dataPath, ds.dataStart, ds.dataSize);
|
||||
}
|
||||
} // namespace Deer
|
||||
9
Deer/src/Deer/DataStore/Path.cpp
Normal file
9
Deer/src/Deer/DataStore/Path.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include "Deer/Tools/Path.h"
|
||||
#include <algorithm>
|
||||
|
||||
Deer::Path Deer::toLowerCasePath(const Path& inputPath) {
|
||||
std::string pathStr = inputPath.generic_string();
|
||||
std::transform(pathStr.begin(), pathStr.end(), pathStr.begin(),
|
||||
[](unsigned char c) { return std::tolower(c); });
|
||||
return Path(pathStr);
|
||||
}
|
||||
14
Deer/src/Deer/Scene/Components.cpp
Executable file
14
Deer/src/Deer/Scene/Components.cpp
Executable file
@ -0,0 +1,14 @@
|
||||
#include "Deer/Components.h"
|
||||
#include "glm/gtc/matrix_transform.hpp"
|
||||
#include "Deer/Log.h"
|
||||
|
||||
namespace Deer {
|
||||
glm::mat4 TransformComponent::getMatrix() const{
|
||||
glm::mat4 scaleMat = glm::scale(glm::mat4(1.0f), scale);
|
||||
glm::mat4 roatationMat = glm::mat4(rotation);
|
||||
glm::mat4 positionMat = glm::translate(glm::mat4(1.0f), position);
|
||||
|
||||
return positionMat * roatationMat * scaleMat;
|
||||
}
|
||||
|
||||
}
|
||||
128
Deer/src/Deer/Scene/Entity.cpp
Executable file
128
Deer/src/Deer/Scene/Entity.cpp
Executable file
@ -0,0 +1,128 @@
|
||||
#include "Deer/Components.h"
|
||||
#include "Deer/Enviroment.h"
|
||||
#include "Deer/Log.h"
|
||||
|
||||
namespace Deer {
|
||||
Entity::Entity(entt::entity handle, Environment* scene, uint16_t entityID)
|
||||
: entHandle(handle),
|
||||
environment(scene),
|
||||
entId(entityID) {}
|
||||
|
||||
Entity::Entity(Entity&& ent) noexcept {
|
||||
environment = ent.environment;
|
||||
entHandle = ent.entHandle;
|
||||
parentId = ent.parentId;
|
||||
entId = ent.entId;
|
||||
|
||||
ent.environment = nullptr;
|
||||
ent.entHandle = entt::null;
|
||||
ent.parentId = 0;
|
||||
ent.entId = 0;
|
||||
}
|
||||
|
||||
Entity& Entity::operator=(Entity&& ent) noexcept {
|
||||
environment = ent.environment;
|
||||
entHandle = ent.entHandle;
|
||||
parentId = ent.parentId;
|
||||
entId = ent.entId;
|
||||
|
||||
ent.environment = nullptr;
|
||||
ent.entHandle = entt::null;
|
||||
ent.parentId = 0;
|
||||
ent.entId = 0;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool Entity::isValid() const {
|
||||
return environment != nullptr;
|
||||
}
|
||||
|
||||
void Entity::setParent(Entity& parent) {
|
||||
DEER_CORE_ASSERT(isValid(), "Entity is not valid");
|
||||
DEER_CORE_ASSERT(parent.environment == environment,
|
||||
"Cannot set parent from different environments");
|
||||
DEER_CORE_ASSERT(parent.isValid(), "Parent is not valid");
|
||||
if (parent.getId() == getId())
|
||||
return;
|
||||
|
||||
Entity& current_parent = getParent();
|
||||
|
||||
if (parent.isDescendantOf(*this)) {
|
||||
DEER_CORE_WARN("Cannot set parent: would create cycle");
|
||||
return;
|
||||
}
|
||||
|
||||
if (current_parent.isValid() && current_parent.getId() != parent.getId()) {
|
||||
current_parent.getComponent<RelationshipComponent>().removeChild(getId());
|
||||
}
|
||||
|
||||
parent.getComponent<RelationshipComponent>().addChildId(getId());
|
||||
|
||||
getComponent<RelationshipComponent>().parent_id = parent.getId();
|
||||
parentId = parent.getId();
|
||||
}
|
||||
|
||||
bool Entity::isDescendantOf(Entity& parent) const {
|
||||
DEER_CORE_ASSERT(isValid(), "Entity is not valid");
|
||||
if (getId() == parent.getId())
|
||||
return true;
|
||||
if (isRoot())
|
||||
return false;
|
||||
|
||||
return getParent().isDescendantOf(parent);
|
||||
}
|
||||
|
||||
Entity& Entity::duplicate() {
|
||||
DEER_CORE_ASSERT(isValid(), "Entity is not valid");
|
||||
Entity& creation = environment->createEntity(
|
||||
getComponent<TagComponent>().tag + "(d)");
|
||||
|
||||
creation.setParent(getParent());
|
||||
|
||||
creation.getComponent<TransformComponent>() =
|
||||
getComponent<TransformComponent>();
|
||||
|
||||
/*
|
||||
#ifdef DEER_RENDER
|
||||
if (environment->m_registry->any_of<MeshComponent>(entHandle))
|
||||
creation.addComponent<MeshComponent>(
|
||||
getComponent<MeshComponent>());
|
||||
|
||||
if (environment->m_registry->any_of<CameraComponent>(entHandle))
|
||||
creation.addComponent<CameraComponent>(
|
||||
getComponent<CameraComponent>());
|
||||
#endif
|
||||
*/
|
||||
return creation;
|
||||
}
|
||||
|
||||
void Entity::destroy() {
|
||||
DEER_CORE_ASSERT(isValid(), "Entity is not valid");
|
||||
DEER_CORE_ASSERT(!isRoot(), "Can not destroy the root");
|
||||
environment->destroyEntity(getId());
|
||||
}
|
||||
|
||||
Entity& Entity::getParent() const {
|
||||
DEER_CORE_ASSERT(isValid(), "Entity is not valid");
|
||||
return environment->getEntity(parentId);
|
||||
}
|
||||
|
||||
glm::mat4 Entity::getWorldMatrix() const {
|
||||
if (isRoot())
|
||||
return glm::mat4(1.0f);
|
||||
|
||||
return getParent().getWorldMatrix() * getRelativeMatrix();
|
||||
}
|
||||
|
||||
void Entity::clear() {
|
||||
environment = nullptr;
|
||||
entHandle = entt::null;
|
||||
parentId = 0;
|
||||
entId = 0;
|
||||
}
|
||||
|
||||
glm::mat4 Entity::getRelativeMatrix() const {
|
||||
return getComponent<TransformComponent>().getMatrix();
|
||||
}
|
||||
} // namespace Deer
|
||||
153
Deer/src/Deer/Scene/Enviroment.cpp
Executable file
153
Deer/src/Deer/Scene/Enviroment.cpp
Executable file
@ -0,0 +1,153 @@
|
||||
#include "Deer/Enviroment.h"
|
||||
|
||||
#include "Deer/Application.h"
|
||||
#include "Deer/Components.h"
|
||||
#include "Deer/Log.h"
|
||||
#include "DeerRender/Render/Render.h"
|
||||
#include "DeerRender/Render/RenderUtils.h"
|
||||
#include "DeerRender/Render/Texture.h"
|
||||
|
||||
namespace Deer {
|
||||
Environment::Environment() {
|
||||
m_registry = MakeScope<entt::registry>();
|
||||
createEntityWithId(0, "root");
|
||||
}
|
||||
|
||||
Environment::~Environment() {}
|
||||
|
||||
void Environment::clear() {
|
||||
// Clear all existing entities and map
|
||||
m_registry->clear();
|
||||
|
||||
while (!unused_entities_spaces.empty()) {
|
||||
unused_entities_spaces.pop();
|
||||
}
|
||||
entities.clear();
|
||||
|
||||
createEntityWithId(0, "root");
|
||||
}
|
||||
|
||||
uint16_t Environment::getEntityCount() const {
|
||||
return entities.size() - unused_entities_spaces.size();
|
||||
}
|
||||
|
||||
Entity& Environment::getEntity(uint16_t id) {
|
||||
DEER_CORE_ASSERT(entityExists(id), "Entity id {0} does not exist", id);
|
||||
return entities[id];
|
||||
}
|
||||
|
||||
bool Environment::entityExists(uint16_t id) const {
|
||||
if (id >= entities.size())
|
||||
return false;
|
||||
const Entity& refEntity = entities[id];
|
||||
return refEntity.isValid();
|
||||
}
|
||||
|
||||
Entity& Environment::createEntity(const std::string& name) {
|
||||
uint16_t id;
|
||||
|
||||
entt::entity entityID = m_registry->create();
|
||||
if (unused_entities_spaces.empty()) {
|
||||
id = entities.size();
|
||||
entities.push_back({});
|
||||
} else {
|
||||
id = unused_entities_spaces.top();
|
||||
unused_entities_spaces.pop();
|
||||
}
|
||||
|
||||
Entity& entity = entities[id];
|
||||
entity = {entityID, this, id};
|
||||
|
||||
entity.addComponent<TagComponent>(name, id);
|
||||
entity.addComponent<RelationshipComponent>();
|
||||
entity.addComponent<TransformComponent>();
|
||||
|
||||
entity.parentId = 0;
|
||||
getRoot().getComponent<RelationshipComponent>().addChildId(id);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
Entity& Environment::createEntityWithId(uint16_t id, const std::string& name) {
|
||||
entt::entity entityID = m_registry->create();
|
||||
|
||||
// We allocate all the memory until that id
|
||||
if (id >= entities.size()) {
|
||||
if (entities.capacity() <= id)
|
||||
entities.reserve(id + 1);
|
||||
|
||||
for (int i = entities.size(); i < id; i++) {
|
||||
entities.push_back({});
|
||||
unused_entities_spaces.push(i);
|
||||
}
|
||||
|
||||
entities.push_back({});
|
||||
} else {
|
||||
static std::stack<uint16_t> unused_entities_spaces_cache;
|
||||
|
||||
// This code its to remove a specific element from a stack
|
||||
// We pop the stack until we find the id or we empty it to
|
||||
// completly remove the target id and then we fill it again with the cache
|
||||
while (!unused_entities_spaces.empty()) {
|
||||
uint16_t topId = unused_entities_spaces.top();
|
||||
unused_entities_spaces.pop();
|
||||
|
||||
if (topId == id)
|
||||
break;
|
||||
unused_entities_spaces_cache.push(topId);
|
||||
}
|
||||
|
||||
while (!unused_entities_spaces_cache.empty()) {
|
||||
uint16_t refillId = unused_entities_spaces_cache.top();
|
||||
unused_entities_spaces_cache.pop();
|
||||
|
||||
unused_entities_spaces.push(refillId);
|
||||
}
|
||||
}
|
||||
|
||||
Entity& entity = entities[id];
|
||||
entt::entity _entityId = m_registry->create();
|
||||
entity = {_entityId, this, id};
|
||||
|
||||
entity.addComponent<TagComponent>(name, id);
|
||||
entity.addComponent<RelationshipComponent>();
|
||||
entity.addComponent<TransformComponent>();
|
||||
|
||||
if (id != 0) {
|
||||
getRoot().getComponent<RelationshipComponent>().addChildId(id);
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
void Environment::destroyEntity(uint16_t entityID) {
|
||||
DEER_CORE_ASSERT(entityExists(entityID), "Entity id {0} does not exist", entityID);
|
||||
DEER_CORE_ASSERT(entityID != 0, "Cannot destroy root");
|
||||
|
||||
Entity& entity = entities[entityID];
|
||||
entity.getParent().getComponent<RelationshipComponent>().removeChild(entityID);
|
||||
|
||||
RelationshipComponent& relationship = entity.getComponent<RelationshipComponent>();
|
||||
// We want to delete all childrens
|
||||
for (int i = 0; i < relationship.getChildCount(); i++) {
|
||||
uint16_t childID = relationship.getChildId(i);
|
||||
destroyEntity(childID);
|
||||
}
|
||||
|
||||
if (m_mainCamera == entityID)
|
||||
m_mainCamera = 0;
|
||||
|
||||
m_registry->destroy(entity.entHandle);
|
||||
entity.clear();
|
||||
|
||||
unused_entities_spaces.push(entityID);
|
||||
}
|
||||
|
||||
uint16_t Environment::tryGetMainCamera() const { return m_mainCamera; }
|
||||
|
||||
void Environment::setMainCamera(Entity& entity) {
|
||||
if (!entity.isValid())
|
||||
m_mainCamera = 0;
|
||||
|
||||
m_mainCamera = entity.getId();
|
||||
}
|
||||
} // namespace Deer
|
||||
51
Deer/src/Deer/Scene/Scene.cpp
Executable file
51
Deer/src/Deer/Scene/Scene.cpp
Executable file
@ -0,0 +1,51 @@
|
||||
#include "Deer/Scene.h"
|
||||
|
||||
#include "Deer/Components.h"
|
||||
#include "Deer/Enviroment.h"
|
||||
#include "Deer/Log.h"
|
||||
#include "Deer/Tools/Memory.h"
|
||||
#include "Deer/VoxelWorld.h"
|
||||
#include "Deer/Voxels/Chunk.h"
|
||||
#include "Deer/Voxels/Layer.h"
|
||||
#include "Deer/Voxels/VoxelWorldData.h"
|
||||
|
||||
#include "Deer/Enviroment.h"
|
||||
#include "Deer/Scene/SceneData.h"
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
#include "DeerRender/FrameBuffer.h"
|
||||
#include "DeerRender/Mesh.h"
|
||||
#include "DeerRender/Shader.h"
|
||||
#include "DeerRender/Voxels/VoxelWorldRenderData.h"
|
||||
#endif
|
||||
|
||||
namespace Deer {
|
||||
void Scene::clear() {
|
||||
environment.clear();
|
||||
VoxelWorld::clear();
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
ResourceManager<Shader>::unloadResources();
|
||||
ResourceManager<GPUMesh>::unloadResources();
|
||||
FrameBufferManager::unloadAllFrameBuffer();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Scene::getExecutingState() {
|
||||
return isExecuting;
|
||||
}
|
||||
|
||||
void Scene::initExecution() {
|
||||
DEER_CORE_ASSERT(!isExecuting, "Deer scene is already executing");
|
||||
isExecuting = true;
|
||||
}
|
||||
|
||||
void Scene::tickExecution() {
|
||||
}
|
||||
|
||||
void Scene::endExecution() {
|
||||
DEER_CORE_ASSERT(isExecuting, "Deer scene is not executing");
|
||||
isExecuting = false;
|
||||
}
|
||||
|
||||
} // namespace Deer
|
||||
18
Deer/src/Deer/Scene/SceneData.cpp
Normal file
18
Deer/src/Deer/Scene/SceneData.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "Deer/Enviroment.h"
|
||||
#include "Deer/Tools/Memory.h"
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
#include "DeerRender/GizmoRenderer.h"
|
||||
#endif
|
||||
|
||||
namespace Deer {
|
||||
namespace Scene {
|
||||
Environment environment;
|
||||
bool isExecuting = false;
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
GizmoRenderer gizmoRenderer;
|
||||
#endif
|
||||
} // namespace Scene
|
||||
|
||||
} // namespace Deer
|
||||
20
Deer/src/Deer/Scene/SceneData.h
Normal file
20
Deer/src/Deer/Scene/SceneData.h
Normal file
@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Memory.h"
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
#include "DeerRender/GizmoRenderer.h"
|
||||
#endif
|
||||
|
||||
namespace Deer {
|
||||
class Environment;
|
||||
|
||||
namespace Scene {
|
||||
extern Environment environment;
|
||||
extern bool isExecuting;
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
extern GizmoRenderer gizmoRenderer;
|
||||
#endif
|
||||
} // namespace Scene
|
||||
|
||||
} // namespace Deer
|
||||
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include "Deer/Components.h"
|
||||
|
||||
namespace Deer {
|
||||
// RELATIONSHIP COMPONENT
|
||||
template <class Archive>
|
||||
void serialize(Archive& archive, RelationshipComponent& relationship) {
|
||||
archive(cereal::make_nvp("parentId", relationship.parent_id));
|
||||
|
||||
archive(cereal::make_size_tag(
|
||||
static_cast<cereal::size_type>(relationship.getChildCount())));
|
||||
for (int i = 0; i < relationship.getChildCount(); i++)
|
||||
archive(relationship.getChildId(i));
|
||||
}
|
||||
} // namespace Deer
|
||||
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "Deer/Components.h"
|
||||
|
||||
namespace Deer {
|
||||
|
||||
// TRANSFORM COMPONENT
|
||||
template<class Archive>
|
||||
void serialize(Archive& archive,
|
||||
TransformComponent& transform) {
|
||||
|
||||
archive(cereal::make_nvp("position", transform.position));
|
||||
archive(cereal::make_nvp("scale", transform.scale));
|
||||
archive(cereal::make_nvp("rotation", transform.rotation));
|
||||
}
|
||||
|
||||
}
|
||||
72
Deer/src/Deer/Scene/Serialization/EntitySerialization.h
Executable file
72
Deer/src/Deer/Scene/Serialization/EntitySerialization.h
Executable file
@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#include "Deer/Components.h"
|
||||
#include "Deer/Enviroment.h"
|
||||
#include "Deer/Scene/Serialization/SerializationGlobalVars.h"
|
||||
#include "EntitySerializationStruct.h"
|
||||
|
||||
namespace Deer {
|
||||
template <class Archive, typename T>
|
||||
void saveComponent(Archive& archive, const std::string& componentName, Entity const& m_entity) {
|
||||
bool hasComponent = m_entity.hasComponent<T>();
|
||||
archive(cereal::make_nvp(("has_" + componentName).c_str(), hasComponent));
|
||||
if (hasComponent) {
|
||||
const T& component = m_entity.getComponent<T>();
|
||||
archive(cereal::make_nvp(componentName.c_str(), component));
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, typename T>
|
||||
void loadComponent(Archive& archive, const std::string& componentName, Entity const& m_entity) {
|
||||
bool hasComponent;
|
||||
archive(cereal::make_nvp(("has_" + componentName).c_str(), hasComponent));
|
||||
if (hasComponent) {
|
||||
T& component = m_entity.addComponent<T>();
|
||||
archive(cereal::make_nvp(componentName.c_str(), component));
|
||||
}
|
||||
}
|
||||
// ENTITY
|
||||
template <class Archive>
|
||||
void save(Archive& archive, EntitySerializationStruct const& m_entity) {
|
||||
const Entity& entity = m_entity.env->getEntity(m_entity.entityID);
|
||||
|
||||
const TagComponent& name = entity.getComponent<TagComponent>();
|
||||
archive(cereal::make_nvp("id", m_entity.entityID));
|
||||
archive(cereal::make_nvp("name", name.tag));
|
||||
|
||||
const TransformComponent& transform = entity.getComponent<TransformComponent>();
|
||||
archive(cereal::make_nvp("transform", transform));
|
||||
|
||||
const RelationshipComponent& relation = entity.getComponent<RelationshipComponent>();
|
||||
archive(cereal::make_nvp("relationship", relation));
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
if (!is_server_serialization) {
|
||||
saveComponent<Archive, MeshComponent>(archive, "meshRenderComponent", entity);
|
||||
saveComponent<Archive, CameraComponent>(archive, "cameraComponent", entity);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void load(Archive& archive, EntitySerializationStruct& m_entity) {
|
||||
uint16_t id;
|
||||
std::string name;
|
||||
archive(cereal::make_nvp("id", id));
|
||||
archive(cereal::make_nvp("name", name));
|
||||
|
||||
Entity& entity = m_entity.env->createEntityWithId(id);
|
||||
archive(cereal::make_nvp("transform", entity.getComponent<TransformComponent>()));
|
||||
|
||||
RelationshipComponent& rc = entity.getComponent<RelationshipComponent>();
|
||||
archive(cereal::make_nvp("relationship", rc));
|
||||
entity.setParent(m_entity.env->getEntity(rc.parent_id));
|
||||
#ifdef DEER_RENDER
|
||||
if (!is_server_serialization) {
|
||||
loadComponent<Archive, MeshComponent>(archive, "meshRenderComponent", entity);
|
||||
loadComponent<Archive, CameraComponent>(archive, "cameraComponent", entity);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace Deer
|
||||
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
namespace Deer {
|
||||
class Environment;
|
||||
struct EntitySerializationStruct {
|
||||
uint16_t entityID;
|
||||
Environment* env;
|
||||
};
|
||||
} // namespace Deer
|
||||
57
Deer/src/Deer/Scene/Serialization/EnvironmentSerialization.h
Executable file
57
Deer/src/Deer/Scene/Serialization/EnvironmentSerialization.h
Executable file
@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "Deer/Enviroment.h"
|
||||
#include "EntitySerializationStruct.h"
|
||||
|
||||
namespace Deer {
|
||||
struct EnvironmentEntity {
|
||||
Environment& environment;
|
||||
EnvironmentEntity(Environment& env) : environment(env) {}
|
||||
};
|
||||
|
||||
template <class Archive>
|
||||
void save(Archive& archive, const Deer::Environment& environment) {
|
||||
EnvironmentEntity envEnt(const_cast<Deer::Environment&>(environment));
|
||||
archive(cereal::make_nvp("entities", envEnt));
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void load(Archive& archive, Deer::Environment& environment) {
|
||||
EnvironmentEntity envEnt(environment);
|
||||
archive(cereal::make_nvp("entities", envEnt));
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void save(Archive& archive, EnvironmentEntity const& m_entities) {
|
||||
archive(cereal::make_size_tag(static_cast<cereal::size_type>(
|
||||
m_entities.environment.getEntityCount())));
|
||||
|
||||
for (uint16_t i = 0; i < m_entities.environment.getEntityCount(); i++) {
|
||||
while (!m_entities.environment.entityExists(i)) {
|
||||
i++;
|
||||
}
|
||||
|
||||
EntitySerializationStruct serializationStruct;
|
||||
serializationStruct.env =
|
||||
const_cast<Environment*>(&m_entities.environment);
|
||||
serializationStruct.entityID = i;
|
||||
|
||||
archive(serializationStruct);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
void load(Archive& archive, EnvironmentEntity& m_entities) {
|
||||
cereal::size_type size;
|
||||
archive(cereal::make_size_tag(size));
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
EntitySerializationStruct serializationStruct;
|
||||
serializationStruct.env = &m_entities.environment;
|
||||
|
||||
archive(serializationStruct);
|
||||
}
|
||||
}
|
||||
} // namespace Deer
|
||||
16
Deer/src/Deer/Scene/Serialization/QuatSerialization.h
Executable file
16
Deer/src/Deer/Scene/Serialization/QuatSerialization.h
Executable file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include "glm/gtc/quaternion.hpp"
|
||||
|
||||
namespace cereal {
|
||||
|
||||
template<class Archive>
|
||||
void serialize(Archive& archive,
|
||||
glm::quat& rot) {
|
||||
|
||||
archive(cereal::make_nvp("x", rot.x));
|
||||
archive(cereal::make_nvp("y", rot.y));
|
||||
archive(cereal::make_nvp("z", rot.z));
|
||||
archive(cereal::make_nvp("w", rot.w));
|
||||
}
|
||||
}
|
||||
4
Deer/src/Deer/Scene/Serialization/Serialization.cpp
Executable file
4
Deer/src/Deer/Scene/Serialization/Serialization.cpp
Executable file
@ -0,0 +1,4 @@
|
||||
|
||||
namespace Deer {
|
||||
bool is_server_serialization = false;
|
||||
}
|
||||
27
Deer/src/Deer/Scene/Serialization/Serialization.h
Executable file
27
Deer/src/Deer/Scene/Serialization/Serialization.h
Executable file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include "cereal/cereal.hpp"
|
||||
#include "cereal/types/string.hpp"
|
||||
#include "cereal/types/vector.hpp"
|
||||
|
||||
// Serialization Vars
|
||||
#include "Deer/Scene/Serialization/SerializationGlobalVars.h"
|
||||
|
||||
// GENERICS
|
||||
#include "Deer/Scene/Serialization/QuatSerialization.h"
|
||||
#include "Deer/Scene/Serialization/Vec3Serialization.h"
|
||||
|
||||
// SCENE SPECIFIC
|
||||
#include "Deer/Scene/Serialization/EntitySerialization.h"
|
||||
#include "Deer/Scene/Serialization/EnvironmentSerialization.h"
|
||||
|
||||
// COMPONENTS SPECIFIC
|
||||
#include "Deer/Scene/Serialization/Components/RelationshipComponentSerialization.h"
|
||||
#include "Deer/Scene/Serialization/Components/TransformComponentSerialization.h"
|
||||
|
||||
// RENDER SPECIFIC
|
||||
#ifdef DEER_RENDER
|
||||
#include "DeerRender/Scene/Serialization/Components/CameraSerializationComponent.h"
|
||||
#include "DeerRender/Scene/Serialization/Components/MeshRenderComponentSerialization.h"
|
||||
#include "DeerRender/Scene/Serialization/Components/TextureBindingSerializationComponent.h"
|
||||
#endif
|
||||
7
Deer/src/Deer/Scene/Serialization/SerializationGlobalVars.cpp
Executable file
7
Deer/src/Deer/Scene/Serialization/SerializationGlobalVars.cpp
Executable file
@ -0,0 +1,7 @@
|
||||
#include "SerializationGlobalVars.h"
|
||||
|
||||
namespace Deer {
|
||||
|
||||
bool is_server_serialization = false;
|
||||
|
||||
}
|
||||
5
Deer/src/Deer/Scene/Serialization/SerializationGlobalVars.h
Executable file
5
Deer/src/Deer/Scene/Serialization/SerializationGlobalVars.h
Executable file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
namespace Deer {
|
||||
extern bool is_server_serialization;
|
||||
}
|
||||
14
Deer/src/Deer/Scene/Serialization/Vec3Serialization.h
Executable file
14
Deer/src/Deer/Scene/Serialization/Vec3Serialization.h
Executable file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "glm/glm.hpp"
|
||||
|
||||
namespace cereal {
|
||||
template<class Archive>
|
||||
void serialize(Archive& archive,
|
||||
glm::vec3& vec3) {
|
||||
|
||||
archive(
|
||||
cereal::make_nvp("x", vec3.x),
|
||||
cereal::make_nvp("y", vec3.y),
|
||||
cereal::make_nvp("z", vec3.z));
|
||||
}
|
||||
}
|
||||
21
Deer/src/Deer/Voxels/Chunk.cpp
Executable file
21
Deer/src/Deer/Voxels/Chunk.cpp
Executable file
@ -0,0 +1,21 @@
|
||||
#include "Chunk.h"
|
||||
|
||||
namespace Deer {
|
||||
Chunk::~Chunk() {
|
||||
if (m_voxels) {
|
||||
delete[] m_voxels;
|
||||
#ifdef DEER_RENDER
|
||||
delete[] m_lightInfo;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void Chunk::loadVoxels() {
|
||||
if (!m_voxels) {
|
||||
m_voxels = new Voxel[CHUNK_VOXELS]();
|
||||
#ifdef DEER_RENDER
|
||||
m_lightInfo = new VoxelLight[CHUNK_VOXELS]();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
143
Deer/src/Deer/Voxels/Chunk.h
Executable file
143
Deer/src/Deer/Voxels/Chunk.h
Executable file
@ -0,0 +1,143 @@
|
||||
#pragma once
|
||||
#include "Deer/Voxel.h"
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
#include <vector>
|
||||
|
||||
#include "DeerRender/Voxel.h"
|
||||
#include "DeerRender/VoxelAspect.h"
|
||||
#endif
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace Deer {
|
||||
class Chunk {
|
||||
public:
|
||||
Chunk() = default;
|
||||
~Chunk();
|
||||
|
||||
inline Voxel readVoxel(ChunkVoxelID id) {
|
||||
if (m_voxels)
|
||||
return m_voxels[VOXEL_POSITION(id)];
|
||||
return emptyVoxel;
|
||||
}
|
||||
|
||||
inline Voxel& modVoxel(ChunkVoxelID id) {
|
||||
if (!m_voxels)
|
||||
loadVoxels();
|
||||
return m_voxels[VOXEL_POSITION(id)];
|
||||
}
|
||||
|
||||
inline void fillVoxels(ChunkVoxelID min, ChunkVoxelID max, Voxel info) {
|
||||
if (!m_voxels)
|
||||
loadVoxels();
|
||||
|
||||
ChunkVoxelID voxelID;
|
||||
for (voxelID.x = min.x; voxelID.x <= max.x; voxelID.x++) {
|
||||
for (voxelID.y = min.y; voxelID.y <= max.y; voxelID.y++) {
|
||||
for (voxelID.z = min.z; voxelID.z <= max.x; voxelID.z++) {
|
||||
m_voxels[VOXEL_POSITION(voxelID)] = info;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void remplaceVoxels(ChunkVoxelID min, ChunkVoxelID max,
|
||||
Voxel ref, Voxel value) {
|
||||
if (!m_voxels)
|
||||
loadVoxels();
|
||||
|
||||
ChunkVoxelID voxelID;
|
||||
for (voxelID.x = min.x; voxelID.x <= max.x; voxelID.x++) {
|
||||
for (voxelID.y = min.y; voxelID.y <= max.y; voxelID.y++) {
|
||||
for (voxelID.z = min.z; voxelID.z <= max.z; voxelID.z++) {
|
||||
Voxel& currentVoxel = m_voxels[VOXEL_POSITION(voxelID)];
|
||||
|
||||
if (currentVoxel.id == ref.id)
|
||||
currentVoxel = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline uint8_t calculateLayerVoxelHeight(LayerVoxelID layerVoxelID) {
|
||||
if (!m_voxels)
|
||||
return 0;
|
||||
|
||||
ChunkVoxelID voxelID(layerVoxelID.x, CHUNK_SIZE_Y - 1,
|
||||
layerVoxelID.z);
|
||||
for (int y = CHUNK_SIZE_Y - 1; y >= 0; y--) {
|
||||
voxelID.y = y;
|
||||
|
||||
if (m_voxels[VOXEL_POSITION(voxelID)].id != 0)
|
||||
return voxelID.y + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
Voxel* m_voxels = nullptr;
|
||||
|
||||
void loadVoxels();
|
||||
#ifdef DEER_RENDER
|
||||
public:
|
||||
inline VoxelLight readLight(ChunkVoxelID id) {
|
||||
if (m_voxels)
|
||||
return m_lightInfo[VOXEL_POSITION(id)];
|
||||
return VoxelLight();
|
||||
}
|
||||
|
||||
inline VoxelLight& modLight(ChunkVoxelID id) {
|
||||
if (!m_voxels)
|
||||
loadVoxels();
|
||||
return m_lightInfo[VOXEL_POSITION(id)];
|
||||
}
|
||||
|
||||
inline void clearVoxelLight(ChunkVoxelID min, ChunkVoxelID max) {
|
||||
ChunkVoxelID voxelID;
|
||||
for (voxelID.x = min.x; voxelID.x <= max.x; voxelID.x++) {
|
||||
for (voxelID.y = min.y; voxelID.y <= max.y; voxelID.y++) {
|
||||
for (voxelID.z = min.z; voxelID.z <= max.z; voxelID.z++) {
|
||||
m_lightInfo[VOXEL_POSITION(voxelID)].b_light = 0;
|
||||
m_lightInfo[VOXEL_POSITION(voxelID)].r_light = 0;
|
||||
m_lightInfo[VOXEL_POSITION(voxelID)].g_light = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This function is the same as clear Voxel Light but it also checks if
|
||||
// there is a source of light
|
||||
inline void clearVoxelLightAndSaveSources(
|
||||
ChunkVoxelID min, ChunkVoxelID max, ChunkID chunkID,
|
||||
std::vector<VoxelCordinates>& sources) {
|
||||
if (!m_voxels)
|
||||
return;
|
||||
|
||||
ChunkVoxelID voxelID;
|
||||
for (voxelID.x = min.x; voxelID.x <= max.x; voxelID.x++) {
|
||||
for (voxelID.y = min.y; voxelID.y <= max.y; voxelID.y++) {
|
||||
for (voxelID.z = min.z; voxelID.z <= max.z; voxelID.z++) {
|
||||
Voxel voxel = m_voxels[VOXEL_POSITION(voxelID)];
|
||||
VoxelAspect& voxelAspect =
|
||||
DataStore::voxelsAspect[voxel.id];
|
||||
if (voxelAspect.isLightSource()) {
|
||||
sources.push_back(VoxelCordinates(
|
||||
voxelID.x + chunkID.x * CHUNK_SIZE_X,
|
||||
voxelID.y + chunkID.y * CHUNK_SIZE_Y,
|
||||
voxelID.z + chunkID.z * CHUNK_SIZE_Z));
|
||||
}
|
||||
|
||||
m_lightInfo[VOXEL_POSITION(voxelID)].b_light = 0;
|
||||
m_lightInfo[VOXEL_POSITION(voxelID)].r_light = 0;
|
||||
m_lightInfo[VOXEL_POSITION(voxelID)].g_light = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
VoxelLight* m_lightInfo = nullptr;
|
||||
#endif
|
||||
};
|
||||
} // namespace Deer
|
||||
12
Deer/src/Deer/Voxels/Layer.cpp
Executable file
12
Deer/src/Deer/Voxels/Layer.cpp
Executable file
@ -0,0 +1,12 @@
|
||||
#include "Layer.h"
|
||||
|
||||
namespace Deer {
|
||||
Layer::~Layer() {
|
||||
if (m_layerInfo)
|
||||
delete[] m_layerInfo;
|
||||
}
|
||||
|
||||
void Layer::loadData() {
|
||||
m_layerInfo = new LayerVoxel[LAYER_VOXELS]();
|
||||
}
|
||||
}
|
||||
40
Deer/src/Deer/Voxels/Layer.h
Executable file
40
Deer/src/Deer/Voxels/Layer.h
Executable file
@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
#include "Deer/Voxel.h"
|
||||
|
||||
namespace Deer {
|
||||
class Layer {
|
||||
public:
|
||||
Layer() = default;
|
||||
~Layer();
|
||||
|
||||
inline LayerVoxel readLayerVoxel(LayerVoxelID id) {
|
||||
if (!m_layerInfo)
|
||||
return LayerVoxel();
|
||||
return m_layerInfo[LAYER_VOXEL_POSITION(id)];
|
||||
}
|
||||
|
||||
inline LayerVoxel& modLayerVoxel(LayerVoxelID id) {
|
||||
if (!m_layerInfo)
|
||||
loadData();
|
||||
return m_layerInfo[LAYER_VOXEL_POSITION(id)];
|
||||
}
|
||||
|
||||
inline void fillVoxelLayerMaxHeight(LayerVoxelID min, LayerVoxelID max, uint8_t maxHeight) {
|
||||
if (!m_layerInfo)
|
||||
loadData();
|
||||
|
||||
LayerVoxelID layerVoxelID;
|
||||
for (layerVoxelID.x = min.x; layerVoxelID.x <= max.x; layerVoxelID.x++) {
|
||||
for (layerVoxelID.z = min.x; layerVoxelID.z <= max.z; layerVoxelID.z++) {
|
||||
int id = LAYER_VOXEL_POSITION(layerVoxelID);
|
||||
if (m_layerInfo[id].height <= maxHeight)
|
||||
m_layerInfo[id].height = maxHeight + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
private:
|
||||
void loadData();
|
||||
|
||||
LayerVoxel* m_layerInfo = nullptr;
|
||||
};
|
||||
}
|
||||
56
Deer/src/Deer/Voxels/Serialization/VoxelInfoSerialization.h
Normal file
56
Deer/src/Deer/Voxels/Serialization/VoxelInfoSerialization.h
Normal file
@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
#include "Deer/Voxel.h"
|
||||
#include "Deer/Log.h"
|
||||
|
||||
#include "cereal/cereal.hpp"
|
||||
#include "cereal/types/string.hpp"
|
||||
|
||||
namespace Deer{
|
||||
template<class Archive>
|
||||
void save(Archive & archive, VoxelInfo const & block) {
|
||||
archive(cereal::make_nvp("name", block.name));
|
||||
|
||||
// To avoid breaking things we set it up to Air
|
||||
const char* blockTypeChar = VOXEL_INFO_TYPE_AIR;
|
||||
switch (block.type)
|
||||
{
|
||||
case VoxelInfoType::Air :
|
||||
blockTypeChar = VOXEL_INFO_TYPE_AIR;
|
||||
break;
|
||||
case VoxelInfoType::Voxel :
|
||||
blockTypeChar = VOXEL_INFO_TYPE_VOXEL;
|
||||
break;
|
||||
case VoxelInfoType::TransparentVoxel :
|
||||
blockTypeChar = VOXEL_INFO_TYPE_TRANSPARENT_VOXEL;
|
||||
break;
|
||||
case VoxelInfoType::Custom :
|
||||
blockTypeChar = VOXEL_INFO_TYPE_CUSTOM;
|
||||
break;
|
||||
}
|
||||
|
||||
std::string blockTypeString(blockTypeChar);
|
||||
archive(cereal::make_nvp("type", blockTypeString));
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void load(Archive & archive, VoxelInfo & block) {archive(cereal::make_nvp("name", block.name));
|
||||
std::string blockTypeString;
|
||||
|
||||
archive(cereal::make_nvp("name", block.name));
|
||||
archive(cereal::make_nvp("type", blockTypeString));
|
||||
|
||||
if (blockTypeString == VOXEL_INFO_TYPE_AIR)
|
||||
block.type = VoxelInfoType::Air;
|
||||
else if (blockTypeString == VOXEL_INFO_TYPE_VOXEL)
|
||||
block.type = VoxelInfoType::Voxel;
|
||||
else if (blockTypeString == VOXEL_INFO_TYPE_TRANSPARENT_VOXEL)
|
||||
block.type = VoxelInfoType::TransparentVoxel;
|
||||
else if (blockTypeString == VOXEL_INFO_TYPE_CUSTOM)
|
||||
block.type = VoxelInfoType::Custom;
|
||||
else {
|
||||
block.type = VoxelInfoType::Air;
|
||||
DEER_CORE_ERROR("Failed to resolve voxel type for {0}, unknown type : {1}",
|
||||
block.name.c_str(), blockTypeString.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Deer/src/Deer/Voxels/Voxel.cpp
Executable file
19
Deer/src/Deer/Voxels/Voxel.cpp
Executable file
@ -0,0 +1,19 @@
|
||||
#include "Deer/Voxel.h"
|
||||
|
||||
namespace Deer {
|
||||
// This means the voxel is null
|
||||
Voxel nullVoxel(65535);
|
||||
Voxel emptyVoxel;
|
||||
|
||||
LayerVoxel nullLayerVoxel(65535);
|
||||
|
||||
int normalDirs[3 * 6] = {
|
||||
-1, 0, 0,
|
||||
1, 0, 0,
|
||||
0, -1, 0,
|
||||
0, 1, 0,
|
||||
0, 0, -1,
|
||||
0, 0, 1
|
||||
};
|
||||
|
||||
}
|
||||
89
Deer/src/Deer/Voxels/VoxelData.cpp
Normal file
89
Deer/src/Deer/Voxels/VoxelData.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "Deer/DataStore.h"
|
||||
#include "Deer/Log.h"
|
||||
#include "Deer/Voxel.h"
|
||||
#include "Deer/Voxels/Serialization/VoxelInfoSerialization.h"
|
||||
#include "cereal/archives/json.hpp"
|
||||
|
||||
namespace Deer {
|
||||
namespace DataStore {
|
||||
std::vector<VoxelInfo> voxelsInfo;
|
||||
std::unordered_map<std::string, uint32_t> blockIDMap;
|
||||
} // namespace DataStore
|
||||
|
||||
int32_t DataStore::getVoxelID(const std::string& name) {
|
||||
if (blockIDMap.contains(name))
|
||||
return blockIDMap[name];
|
||||
DEER_CORE_WARN("Voxel Info {0} Not Found!", name.c_str());
|
||||
return -1;
|
||||
}
|
||||
|
||||
void DataStore::loadVoxelsData() {
|
||||
voxelsInfo.clear();
|
||||
blockIDMap.clear();
|
||||
|
||||
VoxelInfo airVoxelInfo;
|
||||
airVoxelInfo.name = VOXEL_INFO_TYPE_AIR;
|
||||
|
||||
voxelsInfo.push_back(airVoxelInfo);
|
||||
blockIDMap[VOXEL_INFO_TYPE_AIR] = 0;
|
||||
|
||||
std::vector<Path> voxelsData;
|
||||
voxelsData = DataStore::getFiles(DEER_VOXEL_DATA_PATH, ".voxel");
|
||||
|
||||
DEER_CORE_TRACE("Loading voxels");
|
||||
for (Path& voxel : voxelsData) {
|
||||
VoxelInfo voxelData;
|
||||
|
||||
uint32_t dataSize;
|
||||
uint8_t* data = DataStore::readFile(voxel, &dataSize);
|
||||
|
||||
std::string dataString((char*)data, dataSize);
|
||||
std::istringstream dataInputStream(dataString);
|
||||
{
|
||||
cereal::JSONInputArchive archive(dataInputStream);
|
||||
archive(cereal::make_nvp("voxel", voxelData));
|
||||
}
|
||||
|
||||
if (voxelData.name.empty()) {
|
||||
DEER_CORE_ERROR("{0} has an empty name",
|
||||
voxel.generic_string().c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (blockIDMap.contains(voxelData.name)) {
|
||||
DEER_CORE_ERROR("{0} with name {1} has dupplicated name id",
|
||||
voxel.generic_string().c_str(),
|
||||
voxelData.name.c_str());
|
||||
continue;
|
||||
}
|
||||
// DEER_CORE_TRACE(" {0} - {1}",
|
||||
// voxel.filename().generic_string().c_str(),
|
||||
// voxelData.name);
|
||||
|
||||
uint32_t id = voxelsInfo.size();
|
||||
|
||||
voxelsInfo.push_back(voxelData);
|
||||
blockIDMap[voxelData.name] = id;
|
||||
|
||||
delete data;
|
||||
}
|
||||
}
|
||||
|
||||
void DataStore::createExampleVoxelData() {
|
||||
VoxelInfo block;
|
||||
|
||||
std::stringstream data;
|
||||
{
|
||||
cereal::JSONOutputArchive archive(data);
|
||||
archive(cereal::make_nvp("voxel", block));
|
||||
}
|
||||
|
||||
DataStore::saveFile(Path(DEER_VOXEL_PATH) / "voxel.example",
|
||||
(uint8_t*)(data.str().c_str()), data.str().size());
|
||||
}
|
||||
} // namespace Deer
|
||||
68
Deer/src/Deer/Voxels/VoxelWorld.cpp
Executable file
68
Deer/src/Deer/Voxels/VoxelWorld.cpp
Executable file
@ -0,0 +1,68 @@
|
||||
#include "Deer/VoxelWorld.h"
|
||||
#include "Deer/Voxels/VoxelWorldData.h"
|
||||
|
||||
#include "Deer/Log.h"
|
||||
#include "Deer/Voxels/Chunk.h"
|
||||
#include "Deer/Voxels/Layer.h"
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
#include "DeerRender/Voxels/VoxelWorldRenderData.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
namespace Deer {
|
||||
void VoxelWorld::initialize(const VoxelWorldProps& props) {
|
||||
clear();
|
||||
|
||||
worldProps = props;
|
||||
|
||||
chunks = MakeScope<Chunk[]>(worldProps.getChunkCount());
|
||||
layers = MakeScope<Layer[]>(worldProps.getLayerCount());
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
initializeRenderVars(props);
|
||||
#endif
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void VoxelWorld::clear() {
|
||||
chunks.reset();
|
||||
layers.reset();
|
||||
|
||||
initialized = false;
|
||||
#ifdef DEER_RENDER
|
||||
clearRenderVars();
|
||||
#endif
|
||||
}
|
||||
|
||||
const VoxelWorldProps& VoxelWorld::getWorldProps() {
|
||||
return worldProps;
|
||||
}
|
||||
|
||||
uint16_t VoxelWorld::calculateLayerVoxelHeight(int x, int z) {
|
||||
DEER_CORE_ASSERT(initialized, "Voxel World is not initialized");
|
||||
LayerVoxelID layerVoxelID;
|
||||
LayerID layerID;
|
||||
|
||||
extractLayerCordinates(x, z, layerID, layerVoxelID);
|
||||
ChunkID chunkID(layerID.x, 0, layerID.z);
|
||||
|
||||
for (int y = worldProps.chunkSizeY - 1; y >= 0; y--) {
|
||||
chunkID.y = y;
|
||||
|
||||
Chunk& chunk = chunks[worldProps.getWorldChunkID(chunkID)];
|
||||
uint8_t chunkVoxelHeight =
|
||||
chunk.calculateLayerVoxelHeight(layerVoxelID);
|
||||
|
||||
if (chunkVoxelHeight != 0) {
|
||||
return chunkVoxelHeight + chunkID.y * CHUNK_SIZE_Y;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
} // namespace Deer
|
||||
18
Deer/src/Deer/Voxels/VoxelWorldData.cpp
Normal file
18
Deer/src/Deer/Voxels/VoxelWorldData.cpp
Normal file
@ -0,0 +1,18 @@
|
||||
#include "Deer/Voxels/VoxelWorldData.h"
|
||||
#include "Deer/Voxels/Chunk.h"
|
||||
#include "Deer/Voxels/Layer.h"
|
||||
|
||||
namespace Deer {
|
||||
namespace VoxelWorld {
|
||||
VoxelWorldProps worldProps;
|
||||
|
||||
Scope<Chunk[]> chunks;
|
||||
Scope<Layer[]> layers;
|
||||
|
||||
bool initialized;
|
||||
}
|
||||
|
||||
bool VoxelWorld::isInitialized() {
|
||||
return initialized;
|
||||
}
|
||||
}
|
||||
13
Deer/src/Deer/Voxels/VoxelWorldData.h
Normal file
13
Deer/src/Deer/Voxels/VoxelWorldData.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "Deer/Tools/Memory.h"
|
||||
#include "Deer/VoxelWorld.h"
|
||||
|
||||
namespace Deer {
|
||||
namespace VoxelWorld {
|
||||
extern VoxelWorldProps worldProps;
|
||||
|
||||
extern Scope<Chunk[]> chunks;
|
||||
extern Scope<Layer[]> layers;
|
||||
extern bool initialized;
|
||||
} // namespace VoxelWorld
|
||||
} // namespace Deer
|
||||
159
Deer/src/Deer/Voxels/VoxelWorld_Raycast.cpp
Normal file
159
Deer/src/Deer/Voxels/VoxelWorld_Raycast.cpp
Normal file
@ -0,0 +1,159 @@
|
||||
#include "Deer/VoxelWorld.h"
|
||||
#include "Deer/Log.h"
|
||||
#include "Deer/Voxels/Chunk.h"
|
||||
#include "Deer/Voxels/Layer.h"
|
||||
#include "Deer/Voxels/VoxelWorldData.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
namespace Deer {
|
||||
VoxelRayResult VoxelWorld::rayCast(glm::vec3 position, glm::vec3 dir, float maxDistance) {
|
||||
DEER_CORE_ASSERT(initialized, "Voxel World is not initialized");
|
||||
|
||||
VoxelRayResult result;
|
||||
|
||||
result.hitPos.x = (int32_t)std::floor(position.x);
|
||||
result.hitPos.y = (int32_t)std::floor(position.y);
|
||||
result.hitPos.z = (int32_t)std::floor(position.z);
|
||||
|
||||
result.distance = 0;
|
||||
|
||||
if (dir.x == 0 && dir.y == 0 && dir.z == 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
dir = glm::normalize(dir);
|
||||
|
||||
glm::vec3 stepAxis = glm::vec3(maxDistance, maxDistance, maxDistance);
|
||||
glm::vec3 distanceAxis = glm::vec3(maxDistance, maxDistance, maxDistance);
|
||||
|
||||
int8_t directionAxis[3] = { 1, 1, 1 };
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (dir[i] < 0) {
|
||||
stepAxis[i] = -1.0f / dir[i];
|
||||
directionAxis[i] = -1;
|
||||
distanceAxis[i] = stepAxis[i] * ((float)position[i] - (float)(&result.hitPos.x)[i]);
|
||||
}
|
||||
else if (dir[i] > 0) {
|
||||
stepAxis[i] = 1.0f / dir[i];
|
||||
distanceAxis[i] = stepAxis[i] * (1 - (float)position[i] + (float)(&result.hitPos.x)[i]);
|
||||
}
|
||||
}
|
||||
|
||||
while (result.distance < maxDistance) {
|
||||
float minDistance = distanceAxis[0];
|
||||
for (int i = 1; i < 3; i++) {
|
||||
if (distanceAxis[i] < minDistance)
|
||||
minDistance = distanceAxis[i];
|
||||
}
|
||||
|
||||
result.distance = minDistance;
|
||||
if (result.distance > maxDistance)
|
||||
break;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (minDistance == distanceAxis[i]) {
|
||||
result.hitPos[i] += directionAxis[i];
|
||||
distanceAxis[i] = minDistance + stepAxis[i];
|
||||
|
||||
Voxel hitVoxel = readVoxel(result.hitPos);
|
||||
|
||||
if (hitVoxel == nullVoxel)
|
||||
continue;
|
||||
|
||||
if (hitVoxel != 0) {
|
||||
result.face = i * 2;
|
||||
|
||||
if (directionAxis[i] == -1)
|
||||
result.face++;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.distance = maxDistance;
|
||||
return result;
|
||||
}
|
||||
|
||||
VoxelRayResult VoxelWorld::rayCast_editor(glm::vec3 position, glm::vec3 dir, float maxDistance) {
|
||||
DEER_CORE_ASSERT(initialized, "Voxel World is not initialized");
|
||||
|
||||
VoxelRayResult result;
|
||||
|
||||
result.hitPos.x = (int32_t)std::floor(position.x);
|
||||
result.hitPos.y = (int32_t)std::floor(position.y);
|
||||
result.hitPos.z = (int32_t)std::floor(position.z);
|
||||
|
||||
result.distance = 0;
|
||||
|
||||
if (dir.x == 0 && dir.y == 0 && dir.z == 0) {
|
||||
return result;
|
||||
}
|
||||
|
||||
dir = glm::normalize(dir);
|
||||
|
||||
glm::vec3 stepAxis = glm::vec3(maxDistance, maxDistance, maxDistance);
|
||||
glm::vec3 distanceAxis = glm::vec3(maxDistance, maxDistance, maxDistance);
|
||||
|
||||
int8_t directionAxis[3] = { 1, 1, 1 };
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (dir[i] < 0) {
|
||||
stepAxis[i] = -1.0f / dir[i];
|
||||
directionAxis[i] = -1;
|
||||
distanceAxis[i] = stepAxis[i] * ((float)position[i] - (float)result.hitPos[i]);
|
||||
}
|
||||
else if (dir[i] > 0) {
|
||||
stepAxis[i] = 1.0f / dir[i];
|
||||
distanceAxis[i] = stepAxis[i] * (1 - (float)position[i] + (float)result.hitPos[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Voxel hitVoxel = readVoxel(result.hitPos);
|
||||
bool has_exit_inner_walls = hitVoxel.id == 0;
|
||||
while (result.distance < maxDistance) {
|
||||
float minDistance = distanceAxis[0];
|
||||
for (int i = 1; i < 3; i++) {
|
||||
if (distanceAxis[i] < minDistance)
|
||||
minDistance = distanceAxis[i];
|
||||
}
|
||||
|
||||
result.distance = minDistance;
|
||||
if (result.distance > maxDistance)
|
||||
break;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (minDistance == distanceAxis[i]) {
|
||||
result.hitPos[i] += directionAxis[i];
|
||||
distanceAxis[i] = minDistance + stepAxis[i];
|
||||
|
||||
Voxel hitVoxel = readVoxel(result.hitPos);
|
||||
|
||||
if (hitVoxel.id == 0) {
|
||||
if (has_exit_inner_walls && result.hitPos.y == -1 && directionAxis[1] == -1 && i == 1) {
|
||||
result.face = NORMAL_UP;
|
||||
return result;
|
||||
}
|
||||
|
||||
has_exit_inner_walls = true;
|
||||
} else if (hitVoxel.id != 0 && has_exit_inner_walls) {
|
||||
result.face = i * 2;
|
||||
|
||||
if (directionAxis[i] == -1)
|
||||
result.face++;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.distance = maxDistance;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
255
Deer/src/Deer/Voxels/VoxelWorld_VoxelManipultation.cpp
Normal file
255
Deer/src/Deer/Voxels/VoxelWorld_VoxelManipultation.cpp
Normal file
@ -0,0 +1,255 @@
|
||||
#include "Deer/Log.h"
|
||||
#include "Deer/VoxelWorld.h"
|
||||
#include "Deer/Voxels/Chunk.h"
|
||||
#include "Deer/Voxels/Layer.h"
|
||||
|
||||
#include "Deer/Voxels/VoxelWorldData.h"
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
#include "DeerRender/Voxels/VoxelWorldRenderData.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
namespace Deer {
|
||||
Voxel VoxelWorld::readVoxel(VoxelCordinates coords) {
|
||||
DEER_CORE_ASSERT(initialized, "Voxel World is not initialized");
|
||||
|
||||
ChunkID chunkID;
|
||||
ChunkVoxelID chunkVoxelID;
|
||||
|
||||
extractChunkCordinates(coords, chunkID, chunkVoxelID);
|
||||
if (!worldProps.isValid(chunkID)) return emptyVoxel;
|
||||
|
||||
Chunk& chunk = chunks[worldProps.getWorldChunkID(chunkID)];
|
||||
return chunk.readVoxel(chunkVoxelID);
|
||||
}
|
||||
|
||||
void VoxelWorld::setVoxel(VoxelCordinates coords, Voxel info) {
|
||||
DEER_CORE_ASSERT(initialized, "Voxel World is not initialized");
|
||||
|
||||
ChunkID chunkID;
|
||||
ChunkVoxelID chunkVoxelID;
|
||||
|
||||
extractChunkCordinates(coords, chunkID, chunkVoxelID);
|
||||
if (!worldProps.isValid(chunkID)) return;
|
||||
|
||||
Chunk& chunk = chunks[worldProps.getWorldChunkID(chunkID)];
|
||||
chunk.modVoxel(chunkVoxelID) = info;
|
||||
|
||||
LayerID layerID;
|
||||
LayerVoxelID layerVoxelID;
|
||||
|
||||
extractLayerCordinates(coords.x, coords.z, layerID, layerVoxelID);
|
||||
|
||||
Layer& layer = layers[worldProps.getWorldLayerID(layerID)];
|
||||
LayerVoxel& layerVoxel = layer.modLayerVoxel(layerVoxelID);
|
||||
|
||||
if (!info.isVoxelType())
|
||||
layerVoxel.height = calculateLayerVoxelHeight(coords.x, coords.z);
|
||||
else if (coords.y >= layerVoxel.height)
|
||||
layerVoxel.height = coords.y + 1;
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
chunkQueue.addChunk(chunkID);
|
||||
// For every axis, X & Y & Z
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (chunkVoxelID[i] == 0 && chunkID[i] != 0) {
|
||||
ChunkID nextChunk = chunkID;
|
||||
nextChunk[i]--;
|
||||
chunkQueue.addChunk(nextChunk);
|
||||
}
|
||||
|
||||
if (chunkVoxelID[i] == CHUNK_SIZE(i) &&
|
||||
chunkID[i] != worldProps[i] - 1) {
|
||||
ChunkID nextChunk = chunkID;
|
||||
nextChunk[i]++;
|
||||
chunkQueue.addChunk(nextChunk);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we should update the lighting
|
||||
bakeAmbientLightFromPoint(coords.x, coords.z);
|
||||
bakeVoxelLightFromPoint(coords);
|
||||
#endif
|
||||
}
|
||||
|
||||
void VoxelWorld::fillVoxels(VoxelCordinates min, VoxelCordinates max, Voxel info) {
|
||||
DEER_CORE_ASSERT(initialized, "Voxel World is not initialized");
|
||||
|
||||
ChunkID minChunkID;
|
||||
ChunkID maxChunkID;
|
||||
ChunkVoxelID minChunkVoxelID;
|
||||
ChunkVoxelID maxChunkVoxelID;
|
||||
|
||||
worldProps.clampAndSetMinMax(min, max);
|
||||
|
||||
extractChunkCordinates(min, minChunkID, minChunkVoxelID);
|
||||
extractChunkCordinates(max, maxChunkID, maxChunkVoxelID);
|
||||
for (int chunkX = minChunkID.x; chunkX <= maxChunkID.x; chunkX++) {
|
||||
for (int chunkY = minChunkID.y; chunkY <= maxChunkID.y; chunkY++) {
|
||||
for (int chunkZ = minChunkID.z; chunkZ <= maxChunkID.z;
|
||||
chunkZ++) {
|
||||
ChunkID workingChunkID(chunkX, chunkY, chunkZ);
|
||||
LayerID workingLayerID(chunkX, chunkZ);
|
||||
Chunk& workingChunk =
|
||||
chunks[worldProps.getWorldChunkID(workingChunkID)];
|
||||
Layer& workingLayer =
|
||||
layers[worldProps.getWorldLayerID(workingLayerID)];
|
||||
|
||||
ChunkVoxelID workingMin(0, 0, 0);
|
||||
ChunkVoxelID workingMax(CHUNK_SIZE_X - 1, CHUNK_SIZE_Y - 1,
|
||||
CHUNK_SIZE_Z - 1);
|
||||
|
||||
if (chunkX == minChunkID.x)
|
||||
workingMin.x = minChunkVoxelID.x;
|
||||
if (chunkY == minChunkID.y)
|
||||
workingMin.y = minChunkVoxelID.y;
|
||||
if (chunkZ == minChunkID.z)
|
||||
workingMin.z = minChunkVoxelID.z;
|
||||
|
||||
if (chunkX == maxChunkID.x)
|
||||
workingMax.x = maxChunkVoxelID.x;
|
||||
if (chunkY == maxChunkID.y)
|
||||
workingMax.y = maxChunkVoxelID.y;
|
||||
if (chunkZ == maxChunkID.z)
|
||||
workingMax.z = maxChunkVoxelID.z;
|
||||
|
||||
LayerVoxelID workingMinLayer(workingMin.x, workingMin.z);
|
||||
LayerVoxelID workingMaxLayer(workingMax.x, workingMax.z);
|
||||
|
||||
workingChunk.fillVoxels(workingMin, workingMax, info);
|
||||
workingLayer.fillVoxelLayerMaxHeight(
|
||||
workingMinLayer, workingMaxLayer, max.y);
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
chunkQueue.addChunk(workingChunkID);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
VoxelCordinates minLightModification = min;
|
||||
VoxelCordinates maxLightModification = max;
|
||||
// We want to add a 16 layer border
|
||||
for (int i = 0; i < 3; i++) {
|
||||
minLightModification[i] -= 16;
|
||||
maxLightModification[i] += 16;
|
||||
}
|
||||
|
||||
worldProps.clampCordinates(minLightModification);
|
||||
worldProps.clampCordinates(maxLightModification);
|
||||
|
||||
bakeAmbientLight(minLightModification.x, maxLightModification.x,
|
||||
minLightModification.z, maxLightModification.z);
|
||||
bakeVoxelLight(minLightModification, maxLightModification);
|
||||
#endif
|
||||
}
|
||||
|
||||
void VoxelWorld::remplaceVoxels(VoxelCordinates min, VoxelCordinates max,
|
||||
Voxel ref, Voxel value) {
|
||||
DEER_CORE_ASSERT(initialized, "Voxel World is not initialized");
|
||||
|
||||
ChunkID minChunkID;
|
||||
ChunkID maxChunkID;
|
||||
ChunkVoxelID minChunkVoxelID;
|
||||
ChunkVoxelID maxChunkVoxelID;
|
||||
|
||||
worldProps.clampAndSetMinMax(min, max);
|
||||
|
||||
extractChunkCordinates(min, minChunkID, minChunkVoxelID);
|
||||
extractChunkCordinates(max, maxChunkID, maxChunkVoxelID);
|
||||
for (int chunkX = minChunkID.x; chunkX <= maxChunkID.x; chunkX++) {
|
||||
for (int chunkY = minChunkID.y; chunkY <= maxChunkID.y; chunkY++) {
|
||||
for (int chunkZ = minChunkID.z; chunkZ <= maxChunkID.z;
|
||||
chunkZ++) {
|
||||
ChunkID workingChunkID(chunkX, chunkY, chunkZ);
|
||||
Chunk& workingChunk =
|
||||
chunks[worldProps.getWorldChunkID(workingChunkID)];
|
||||
|
||||
ChunkVoxelID workingMin(0, 0, 0);
|
||||
ChunkVoxelID workingMax(CHUNK_SIZE_X - 1, CHUNK_SIZE_Y - 1,
|
||||
CHUNK_SIZE_Z - 1);
|
||||
|
||||
if (chunkX == minChunkID.x)
|
||||
workingMin.x = minChunkVoxelID.x;
|
||||
if (chunkY == minChunkID.y)
|
||||
workingMin.y = minChunkVoxelID.y;
|
||||
if (chunkZ == minChunkID.z)
|
||||
workingMin.z = minChunkVoxelID.z;
|
||||
|
||||
if (chunkX == maxChunkID.x)
|
||||
workingMax.x = maxChunkVoxelID.x;
|
||||
if (chunkY == maxChunkID.y)
|
||||
workingMax.y = maxChunkVoxelID.y;
|
||||
if (chunkZ == maxChunkID.z)
|
||||
workingMax.z = maxChunkVoxelID.z;
|
||||
|
||||
workingChunk.remplaceVoxels(workingMin, workingMax, ref,
|
||||
value);
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
chunkQueue.addChunk(workingChunkID);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int xPos = min.x; xPos <= max.x; xPos++) {
|
||||
for (int zPos = min.z; zPos <= max.z; zPos++) {
|
||||
LayerID layerID;
|
||||
LayerVoxelID layerVoxelID;
|
||||
|
||||
extractLayerCordinates(xPos, zPos, layerID, layerVoxelID);
|
||||
int worldLayerID = worldProps.getWorldLayerID(layerID);
|
||||
|
||||
layers[worldLayerID].modLayerVoxel(layerVoxelID).height =
|
||||
calculateLayerVoxelHeight(xPos, zPos);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEER_RENDER
|
||||
VoxelCordinates minLightModification = min;
|
||||
VoxelCordinates maxLightModification = max;
|
||||
// We want to add a 16 layer border
|
||||
for (int i = 0; i < 3; i++) {
|
||||
minLightModification[i] -= 16;
|
||||
maxLightModification[i] += 16;
|
||||
}
|
||||
|
||||
worldProps.clampCordinates(minLightModification);
|
||||
worldProps.clampCordinates(maxLightModification);
|
||||
|
||||
bakeAmbientLight(minLightModification.x, maxLightModification.x,
|
||||
minLightModification.z, maxLightModification.z);
|
||||
bakeVoxelLight(minLightModification, maxLightModification);
|
||||
#endif
|
||||
}
|
||||
|
||||
LayerVoxel VoxelWorld::readLayerVoxel(int x, int z) {
|
||||
LayerID layerID;
|
||||
LayerVoxelID layerVoxelID;
|
||||
|
||||
extractLayerCordinates(x, z, layerID, layerVoxelID);
|
||||
if (!worldProps.isValid(layerID)) return LayerVoxel();
|
||||
|
||||
Layer& layer = layers[worldProps.getWorldLayerID(layerID)];
|
||||
return layer.readLayerVoxel(layerVoxelID);
|
||||
}
|
||||
|
||||
LayerVoxel& VoxelWorld::modLayerVoxel(int x, int z) {
|
||||
LayerID layerID;
|
||||
LayerVoxelID layerVoxelID;
|
||||
|
||||
extractLayerCordinates(x, z, layerID, layerVoxelID);
|
||||
if (!worldProps.isValid(layerID)) return nullLayerVoxel;
|
||||
|
||||
Layer& layer = layers[worldProps.getWorldLayerID(layerID)];
|
||||
return layer.modLayerVoxel(layerVoxelID);
|
||||
}
|
||||
|
||||
} // namespace Deer
|
||||
82
Deer/src/DeerRender/Core/Application.cpp
Normal file
82
Deer/src/DeerRender/Core/Application.cpp
Normal file
@ -0,0 +1,82 @@
|
||||
#include "DeerRender/Application.h"
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
|
||||
#include "DeerRender/Render/Render.h"
|
||||
#include "DeerRender/Render/RenderCommand.h"
|
||||
#include "DeerRender/Render/RenderUtils.h"
|
||||
|
||||
#include "DeerRender/Log.h"
|
||||
|
||||
#include "DeerRender/ImGui/ImGuiLayer.h"
|
||||
#include "imgui.h"
|
||||
|
||||
namespace Deer {
|
||||
namespace Application {
|
||||
Function renderCallback;
|
||||
EventFunction eventCallback;
|
||||
Scope<Window> window;
|
||||
Scope<ImGuiLayer> imGuiLayer;
|
||||
|
||||
void setRenderCallback(Function _render) {
|
||||
renderCallback = _render;
|
||||
}
|
||||
|
||||
void setEventCallback(EventFunction _event) {
|
||||
eventCallback = _event;
|
||||
}
|
||||
|
||||
Window& getWindow() {
|
||||
return *window;
|
||||
}
|
||||
|
||||
void internalEventCallback(Event& e) {
|
||||
if (eventCallback)
|
||||
eventCallback(e);
|
||||
|
||||
imGuiLayer->onEvent(e);
|
||||
}
|
||||
|
||||
void initWindow() {
|
||||
window = Scope<Window>(Window::create());
|
||||
|
||||
window->setEventCallback(Deer::Application::internalEventCallback);
|
||||
window->initWindow();
|
||||
|
||||
imGuiLayer = MakeScope<ImGuiLayer>();
|
||||
imGuiLayer->onAttach();
|
||||
|
||||
RenderUtils::initializeRenderUtils();
|
||||
RenderCommand::init();
|
||||
}
|
||||
|
||||
void resolveEvents() {
|
||||
window->resolveEvents();
|
||||
}
|
||||
|
||||
void shutdownWindow() {
|
||||
imGuiLayer->onDetach();
|
||||
|
||||
imGuiLayer.reset();
|
||||
window.reset();
|
||||
}
|
||||
|
||||
void runRender(float deltaTime) {
|
||||
if (!renderCallback)
|
||||
return;
|
||||
|
||||
RenderCommand::setClearColor({0.2f, 0.2f, 0.3f, 1.0f});
|
||||
RenderCommand::clear();
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.DeltaTime = (float)deltaTime;
|
||||
imGuiLayer->begin();
|
||||
|
||||
renderCallback();
|
||||
|
||||
imGuiLayer->end();
|
||||
window->onRender();
|
||||
}
|
||||
|
||||
} // namespace Application
|
||||
} // namespace Deer
|
||||
30
Deer/src/DeerRender/Core/Input/Input.cpp
Executable file
30
Deer/src/DeerRender/Core/Input/Input.cpp
Executable file
@ -0,0 +1,30 @@
|
||||
#include "DeerRender/Input.h"
|
||||
#include "DeerRender/Application.h"
|
||||
|
||||
namespace Deer {
|
||||
#ifdef DEER_RENDER
|
||||
bool Input::isKeyPressed(unsigned int key) {
|
||||
return Application::getWindow().getKeyPressed(key);
|
||||
}
|
||||
|
||||
bool Input::isMouseButtonPressed(int button) {
|
||||
return Application::getWindow().getMouseButton(button);
|
||||
}
|
||||
|
||||
void Input::getMousePos(float& x, float& y) {
|
||||
return Application::getWindow().getMousePos(x, y);
|
||||
}
|
||||
#else
|
||||
bool Input::isKeyPressed(unsigned int key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Input::isMouseButtonPressed(int button) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void Input::getMousePos(float& x, float& y) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
83
Deer/src/DeerRender/FrameBuffer/FrameBufferManager.cpp
Normal file
83
Deer/src/DeerRender/FrameBuffer/FrameBufferManager.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
#include "DeerRender/FrameBuffer.h"
|
||||
#include <unordered_map>
|
||||
|
||||
#define FRAME_BUFFER_MAX_COUNT 256
|
||||
|
||||
namespace Deer {
|
||||
namespace FrameBufferManager {
|
||||
struct FrameBufferContainer {
|
||||
FrameBuffer* frameBuffer_data = nullptr;
|
||||
std::string frameBuffer_name;
|
||||
};
|
||||
|
||||
uint16_t maxFrameBufferId = 1;
|
||||
FrameBufferContainer frameBuffers[FRAME_BUFFER_MAX_COUNT]{};
|
||||
std::unordered_map<std::string, uint16_t> frameBuffers_name_id_map;
|
||||
}
|
||||
|
||||
uint16_t FrameBufferManager::createRGBA8FrameBuffer(std::string& name, int x, int y) {
|
||||
FrameBufferSpecification specs(
|
||||
x, y,
|
||||
{TextureBufferType::RGBA8}, 4,
|
||||
false);
|
||||
|
||||
FrameBuffer* frameBuffer = FrameBuffer::create(specs);
|
||||
|
||||
uint16_t frameBufferId = maxFrameBufferId;
|
||||
maxFrameBufferId++;
|
||||
|
||||
frameBuffers[frameBufferId].frameBuffer_data = frameBuffer;
|
||||
frameBuffers[frameBufferId].frameBuffer_name = name;
|
||||
|
||||
frameBuffers_name_id_map[name] = frameBufferId;
|
||||
return frameBufferId;
|
||||
}
|
||||
|
||||
void FrameBufferManager::resizeFrameBuffer(uint16_t frameBufferId, int x, int y) {
|
||||
FrameBuffer* frameBuffer = frameBuffers[frameBufferId].frameBuffer_data;
|
||||
|
||||
frameBuffer->resize(x, y);
|
||||
}
|
||||
|
||||
int FrameBufferManager::getFrameBufferWidth(uint16_t frameBufferId) {
|
||||
FrameBuffer* frameBuffer = frameBuffers[frameBufferId].frameBuffer_data;
|
||||
|
||||
return frameBuffer->getSpecification().width;
|
||||
}
|
||||
|
||||
int FrameBufferManager::getFrameBufferHeight(uint16_t frameBufferId) {
|
||||
FrameBuffer* frameBuffer = frameBuffers[frameBufferId].frameBuffer_data;
|
||||
|
||||
return frameBuffer->getSpecification().height;
|
||||
}
|
||||
|
||||
const std::string& FrameBufferManager::getFrameBufferName(uint16_t id) {
|
||||
DEER_CORE_ASSERT(id >= 0 && id < maxFrameBufferId, "Invalid frame buffer id {0}", id);
|
||||
|
||||
return frameBuffers[id].frameBuffer_name;
|
||||
}
|
||||
|
||||
FrameBuffer& FrameBufferManager::getFrameBuffer(uint16_t id) {
|
||||
DEER_CORE_ASSERT(id > 0 && id < maxFrameBufferId, "Invalid frame buffer id {0}", id);
|
||||
|
||||
return *frameBuffers[id].frameBuffer_data;
|
||||
}
|
||||
|
||||
uint16_t FrameBufferManager::getFrameBufferId(std::string& name) {
|
||||
return frameBuffers_name_id_map[name];
|
||||
}
|
||||
|
||||
void FrameBufferManager::unloadAllFrameBuffer() {
|
||||
for (int x = 1; x < maxFrameBufferId; x++) {
|
||||
delete frameBuffers[x].frameBuffer_data;
|
||||
frameBuffers[x].frameBuffer_data = nullptr;
|
||||
}
|
||||
|
||||
frameBuffers_name_id_map.clear();
|
||||
|
||||
maxFrameBufferId = 1;
|
||||
frameBuffers[0].frameBuffer_data = nullptr;
|
||||
frameBuffers[0].frameBuffer_name = "NULL";
|
||||
frameBuffers_name_id_map["NULL"] = 0;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user