Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2d05032
[WIP] custom thread pool, upgraded dxc and agility sdk version
rtarun9 Jan 13, 2025
72ee83c
Fixed custom thread pool implementation, minor changes to timer class…
rtarun9 Jan 14, 2025
36cfb58
Modified constant buffer abstraction to include data member variable
rtarun9 Jan 14, 2025
180835a
Moved gpu api related components to the rhi namespace
rtarun9 Jan 14, 2025
d55a0da
Added descriptor handle abstraction to descriptor heap struct
rtarun9 Jan 14, 2025
c03e8ce
Fixed issue with camera not moving when key is down
rtarun9 Jan 15, 2025
ea96caa
Modified voxel.hpp to match the current voxel rendering idea
rtarun9 Jan 15, 2025
55a445a
Minor code cleanup in voxel related files
rtarun9 Jan 15, 2025
1dccb62
Fixed code to render a single chunk properly :)
rtarun9 Jan 16, 2025
dc9f41b
[BUG] input doesn't work in release mode
rtarun9 Jan 18, 2025
8cb95c6
Temporarily removed imgui, fixed bug where functions wrapped around A…
rtarun9 Jan 18, 2025
f2cdf58
Switched to stdlib's assert function
rtarun9 Jan 19, 2025
ab3623b
Fixed issue where cpu / gpu indirect command had different alignment …
rtarun9 Jan 19, 2025
661e4dd
Re-added ImGui integration and reverse Z depth buffer (with infinite …
rtarun9 Jan 19, 2025
2398e3e
Use single index / color buffer that is created by chunk manager, and…
rtarun9 Jan 19, 2025
86e51aa
Use single index / color buffer that is created by chunk manager, and…
rtarun9 Jan 19, 2025
89c3c72
[WIP] using a shared large index buffer for all chunks
rtarun9 Jan 19, 2025
8bc2df2
Fixed issue where nothing was being rendered to on the screen
rtarun9 Jan 20, 2025
f0a2fc4
Tracy profiler integration
rtarun9 Jan 21, 2025
b526f7b
Optimized the code by copying index / color data only when chunk gets…
rtarun9 Jan 21, 2025
0c5eeae
[WIP] prevent creation of new voxel memory when new chunks are being…
rtarun9 Jan 22, 2025
9602cfe
Fixed logic for re-using chunk data when out of range chunks are unlo…
rtarun9 Jan 22, 2025
0a89e76
Made all CPU side memory allocations static
rtarun9 Feb 3, 2025
ab5aaca
[WIP] using future's to prevent using mutexes when loading chunks asy…
rtarun9 Feb 8, 2025
9e8f93c
Fixed issue where unloaded chunk queue was growing to infinity
rtarun9 Feb 8, 2025
f9886a8
Merge branch 'refactor' into static_buffer_allocation
rtarun9 Feb 8, 2025
359271b
Merge pull request #4 from rtarun9/static_buffer_allocation
rtarun9 Feb 8, 2025
19e14f6
Re-added asyc copies (rather than relying only on upload buffer for s…
rtarun9 Mar 13, 2025
91c1faa
Added premake.lua file (as a replacement for cmake)
rtarun9 Mar 15, 2025
37fcafe
Added vcpkg.json manifest file that uses imgui / tracy
rtarun9 Mar 15, 2025
ba0786c
Used the 'UserData' param in ImGui_ImplDX12_InitInfo to prevent globa…
rtarun9 Mar 15, 2025
a469b85
Removed all Cmake files, added github action script that uses vcpkg a…
rtarun9 Mar 15, 2025
5a1efc6
Merge pull request #5 from rtarun9/premake_vcpkg
rtarun9 Mar 15, 2025
1cae7bb
Readded cmake, since too many third party libs simply use it unfortun…
rtarun9 Mar 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
run: cmake --build ${{github.workspace}}/build --config debug

- name: Build-Release
run: cmake --build ${{github.workspace}}/build --config release
run: cmake --build ${{github.workspace}}/build --config release
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
external/DirectXAgilitySDK
external/DirectXShaderCompiler
external/agility-sdk
external/dxc
agility.zip
dxc.zip
build/
.vs/
*.sln
*.vcxproj
*.filters
*.user
vcpkg_installed
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.24)
set(CMAKE_CXX_STANDARD 20)

project(voxel-engine
VERSION 0.1
VERSION 0.2
DESCRIPTION "A voxel engine made for learning purposes"
LANGUAGES CXX)

Expand All @@ -13,10 +13,13 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/debug/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/debug/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/debug/bin)


set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/release/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/release/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/release/bin)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/release/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/release/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/release/bin)

add_subdirectory(external)
add_subdirectory(src)
add_subdirectory(src)
50 changes: 25 additions & 25 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"configurations": [
{
"name": "debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\build",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "release",
"generator": "Ninja",
"configurationType": "Release",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\build",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
}
]
{
"configurations": [
{
"name": "debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\build",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\build",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
}
]
}
35 changes: 26 additions & 9 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,35 @@ include(FetchContent)
FetchContent_Declare(
imgui
GIT_REPOSITORY https://github.com/ocornut/imgui
GIT_TAG v1.90.9
GIT_TAG v1.91.9
GIT_PROGRESS TRUE
GIT_SHALLOW TRUE
)

# Thank you deccer for https://github.com/deccer/CMake-Glfw-OpenGL-Template/blob/main/lib/CMakeLists.txt!!
FetchContent_Declare(
thread-pool
GIT_REPOSITORY https://github.com/bshoshany/thread-pool
GIT_PROGRESS TRUE
tracy
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
GIT_TAG v0.11.1
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
)

FetchContent_MakeAvailable(imgui thread-pool)
FetchContent_Declare(
fastnoise2
GIT_REPOSITORY https://github.com/Auburn/FastNoise2
GIT_TAG v0.10.0-alpha
GIT_SHALLOW FALSE
GIT_PROGRESS TRUE
)

set(TRACY_ENABLE ON CACHE BOOL "Enable profiling")
set(TRACY_ONLY_IPV4 ON CACHE BOOL "IPv4 only")
option(TRACY_ENABLE "Enable profiling" ON)
option(TRACY_ONLY_IPV4 "IPv4 only" ON)
set(FASTNOISE2_NOISETOOL OFF CACHE BOOL "Build Noise Tool" FORCE)

FetchContent_MakeAvailable(imgui tracy fastnoise2)

add_library(libimgui
${imgui_SOURCE_DIR}/imgui.cpp
Expand All @@ -26,12 +44,11 @@ add_library(libimgui
)

target_include_directories(libimgui PUBLIC
${imgui_SOURCE_DIR}
${imgui_SOURCE_DIR}/backends
${imgui_SOURCE_DIR}
${imgui_SOURCE_DIR}/backends
)

target_link_libraries(libimgui PUBLIC d3d12 dxguid dxgi)

add_library(external INTERFACE)
target_link_libraries(external INTERFACE libimgui)
target_include_directories(external INTERFACE ${thread-pool_SOURCE_DIR})
target_link_libraries(external INTERFACE libimgui TracyClient FastNoise)
14 changes: 11 additions & 3 deletions imgui.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ Pos=60,60
Size=400,400

[Window][Debug Controller]
Pos=964,203
Pos=1411,129
Size=409,265

[Window][Dear ImGui Metrics/Debugger]
Pos=1063,473
Size=339,341
Pos=76,63
Size=418,710

[Window][Dear ImGui Demo]
Pos=650,20
Size=550,680

[Window][About Dear ImGui]
Pos=484,185
Size=570,160

14 changes: 7 additions & 7 deletions include/voxel-engine/camera.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

class Camera
class camera_t
{
public:
DirectX::XMMATRIX update_and_get_view_matrix(const float delta_time);
DirectX::XMMATRIX update_and_get_view_matrix(const u8 *const keyboard_state, const f32 delta_time);

public:
DirectX::XMFLOAT4 m_position{0.0f, 0.0f, -5.0f, 1.0f};
Expand All @@ -12,13 +12,13 @@ class Camera
DirectX::XMFLOAT4 m_right{1.0f, 0.0f, 0.0f, 0.0f};
DirectX::XMFLOAT4 m_front{0.0f, 0.0f, 1.0f, 0.0f};

float m_movement_speed{500.0f};
float m_rotation_speed{1.0f};
f32 m_movement_speed{150.0f};
f32 m_rotation_speed{1.0f};

// Used to determine how 'smooth' the camera behaves.
// For now, both rotation and movement use the same friction value, purely for simplicity.
float m_friction{0.30f};
f32 m_friction{0.30f};

float m_pitch{};
float m_yaw{};
f32 m_pitch{};
f32 m_yaw{};
};
13 changes: 7 additions & 6 deletions include/voxel-engine/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#include "types.hpp"

// Helper function to print to console in debug mode if the passed Hresult has failed.
static inline void throw_if_failed(const HRESULT hr,
const std::source_location src_loc = std::source_location::current())
inline void throw_if_failed(const HRESULT hr, const std::source_location src_loc = std::source_location::current())
{
if constexpr (VX_DEBUG_MODE)
{
Expand All @@ -17,12 +16,12 @@ static inline void throw_if_failed(const HRESULT hr,
}

// Helper functions to go from 1d to 3d and vice versa.
static inline size_t convert_to_1d(const DirectX::XMUINT3 index_3d, const size_t N)
inline size_t convert_to_1d(const DirectX::XMUINT3 index_3d, const size_t N)
{
return index_3d.x + N * (index_3d.y + (index_3d.z * N));
}

static inline DirectX::XMUINT3 convert_to_3d(const size_t index, const size_t N)
inline DirectX::XMUINT3 convert_to_3d(const size_t index, const size_t N)
{
// For reference, index = x + y * N + z * N * N.
const u32 z = static_cast<u32>(index / (N * N));
Expand All @@ -33,16 +32,18 @@ static inline DirectX::XMUINT3 convert_to_3d(const size_t index, const size_t N)
return {x, y, z};
}

static inline void name_d3d12_object(ID3D12Object *const object, const std::wstring_view name)
inline void name_d3d12_object(ID3D12Object *const object, const std::wstring_view name)
{
if constexpr (VX_DEBUG_MODE)
{
object->SetName(std::wstring(name).c_str());
}
}

static inline size_t round_up_to_multiple(size_t a, size_t multiple)
inline size_t round_up_to_multiple(const size_t a, const size_t multiple)
{
assert(multiple != 0);

if (a % multiple == 0)
{
return a;
Expand Down
8 changes: 4 additions & 4 deletions include/voxel-engine/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// A simple class that can get the relative path of a file / folder with respect to the executable.
// NOTE : Makes the assumption that between the executable and the project root directory, there is NO OTHER folder with
// the name "voxel-engine".
class FileSystem
class file_system_t
{
public:
static FileSystem &instance()
static file_system_t &instance()
{
static FileSystem fs{};
static file_system_t fs{};
return fs;
}

Expand All @@ -28,7 +28,7 @@ class FileSystem
}

private:
explicit FileSystem();
explicit file_system_t();

private:
std::string m_root_directory{};
Expand Down
11 changes: 10 additions & 1 deletion include/voxel-engine/pch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ constexpr bool VX_DEBUG_MODE = true;
constexpr bool VX_DEBUG_MODE = false;
#endif

// Basically, when no profiler is attached tracy will start going crazy with memory.
// If TRACY_ON_DEMAND is defined, this memory issue will not occur.
#define TRACY_ON_DEMAND

// Windows includes.
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>

// Dx12 / Com headers.
Expand Down Expand Up @@ -44,4 +49,8 @@ constexpr bool VX_DEBUG_MODE = false;

// Custom includes.
#include "common.hpp"
#include "types.hpp"
#include "types.hpp"

// Leak symbols from wrl/client.h to global namespace (so that I don't have to keep doing Microsoft::WRL::ComPtr<T> each
// time).
using namespace Microsoft::WRL;
Loading
Loading