Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
46b9672
W.I.P.
OriginalDCAM Nov 26, 2025
ad2c12b
W.I.P. Shadowmapping
OriginalDCAM Nov 27, 2025
909df76
- Added a rendering settings panel on the editor project
OriginalDCAM Nov 27, 2025
8592230
- Enabled Compile warnings as errors for cmake configuration
OriginalDCAM Dec 2, 2025
dceb1e8
W.I.P. Component Serialization
OriginalDCAM Dec 2, 2025
f35aa6e
- Fixed a warning where the method wouldn't return if window is a nul…
OriginalDCAM Dec 2, 2025
2e05b8b
- added a comment for more context in phong shading shadow calculations
OriginalDCAM Dec 2, 2025
e506488
- const correctness fix
OriginalDCAM Dec 2, 2025
3905ecb
- Updated the license txt to include the name of the project and year
OriginalDCAM Dec 4, 2025
9cdb407
- Removed the registering of the scenemanager service from the applic…
OriginalDCAM Dec 8, 2025
a36d3f1
- Updated time with get_current_time() helper method
OriginalDCAM Dec 8, 2025
b01ea75
- Added RAII wrappers around ImGui for automatic resource cleanup
OriginalDCAM Dec 8, 2025
b84b091
- Implemented a method for selecting folders in the filedialog utility.
OriginalDCAM Dec 8, 2025
9f77c15
- Changed the editor application to a statemachine, states are essent…
OriginalDCAM Dec 8, 2025
da4014d
- Removed testing stuff with registering assets
OriginalDCAM Dec 8, 2025
5232eee
- Updated the project class to work better with threads
OriginalDCAM Dec 8, 2025
52868c8
- Still W.I.P. projects saving/opening
OriginalDCAM Dec 8, 2025
cc0964a
- Added testing for transform serializer
OriginalDCAM Dec 8, 2025
7423463
- changed folder names to lowercase
OriginalDCAM Dec 8, 2025
1619d16
- W.I.P. Asset system for asset browser
OriginalDCAM Dec 8, 2025
6d38a6f
- Const correctness fix
OriginalDCAM Dec 9, 2025
41e0cbb
- Meshes can now be saved in the json file of the scene and are seria…
OriginalDCAM Dec 9, 2025
c9bade6
- Lights can now also be saved.
OriginalDCAM Dec 9, 2025
c0214e0
- W.I.P. integrating test engine into project.
OriginalDCAM Dec 10, 2025
671d2da
- W.I.P. for home
OriginalDCAM Dec 10, 2025
decd528
- Project cleanup
OriginalDCAM Dec 10, 2025
7b1a4fd
- Fixed layouts
OriginalDCAM Dec 11, 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
13 changes: 1 addition & 12 deletions .github/workflows/cmake-single-platform.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: CMake on a single platform
name: Build Project

on:
push:
Expand All @@ -9,31 +7,22 @@ on:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ project(Hellfire VERSION 1.1)
# Specify the C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)

# Maximize compiler warnings
#if(MSVC)
# add_compile_options(/W4 /WX)
#else()
# add_compile_options(-Wall -Wextra -Wpedantic -Werror)
#endif()

# Build the documentation only option
option(BUILD_DOCS_ONLY "Only build documentation" OFF)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) [year] [fullname]
Copyright (c) 2025 Hellfire

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Hellfire Game Engine README
# Hellfire Game Engine

A lightweight, experimental 3D game engine built with modern C++ and OpenGL, featuring an integrated editor and entity-component architecture.

Expand Down
17 changes: 17 additions & 0 deletions cmake/AssetSymlink.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function(setup_asset_symlink TARGET_NAME ASSETS_SOURCE_DIR)
if (WIN32)
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove -f "$<TARGET_FILE_DIR:${TARGET_NAME}>/assets"
COMMAND cmd /c "mklink /J \"$<TARGET_FILE_DIR:${TARGET_NAME}>\\assets\" \"${ASSETS_SOURCE_DIR}\""
COMMENT "Creating directory junction to assets directory for ${TARGET_NAME}"
)
else ()
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove -f "$<TARGET_FILE_DIR:${TARGET_NAME}>/assets"
COMMAND ${CMAKE_COMMAND} -E create_symlink
"${ASSETS_SOURCE_DIR}"
"$<TARGET_FILE_DIR:${TARGET_NAME}>/assets"
COMMENT "Creating symlink to assets directory for ${TARGET_NAME}"
)
endif ()
endfunction()
74 changes: 26 additions & 48 deletions editor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,83 +1,61 @@
set(APP_NAME HellfireEditor)
set(LIB_NAME HellfireEditorLib)

add_compile_definitions(HELLFIRE_EDITOR_ENABLED)

file(GLOB_RECURSE APP_SOURCES "src/*.cpp")
file(GLOB_RECURSE APP_HEADERS "src/*.h" "src/*.hpp")
add_executable(${APP_NAME} ${APP_SOURCES} ${APP_HEADERS})


# Add the imguizmo library
set(IMGUIZMO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vendor/imguizmo)
add_library(imguizmo STATIC
${IMGUIZMO_DIR}/ImGuizmo.h
${IMGUIZMO_DIR}/ImGuizmo.cpp
)

target_link_libraries(imguizmo
PRIVATE imgui
)

target_link_libraries(imguizmo PRIVATE imgui)
target_include_directories(imguizmo
PUBLIC ${IMGUIZMO_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vendor/imgui
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/vendor/imgui
)

target_include_directories(${APP_NAME}
PRIVATE
file(GLOB_RECURSE LIB_SOURCES "src/*.cpp")
file(GLOB_RECURSE LIB_HEADERS "src/*.h" "src/*.hpp")

# Exclude main.cpp from library sources
list(FILTER LIB_SOURCES EXCLUDE REGEX ".*main\\.cpp$")
add_library(${LIB_NAME} STATIC ${LIB_SOURCES} ${LIB_HEADERS})

target_include_directories(${LIB_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
)

target_link_libraries(${APP_NAME}
PRIVATE
target_link_libraries(${LIB_NAME}
PUBLIC
HellfireEngine
imgui
imguizmo
glfw
)

if (WIN32)
# Create a directory junction for assets
add_custom_command(TARGET ${APP_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove -f "$<TARGET_FILE_DIR:${APP_NAME}>/assets"
COMMAND cmd /c "mklink /J \"$<TARGET_FILE_DIR:${APP_NAME}>\\assets\" \"${CMAKE_CURRENT_SOURCE_DIR}\\assets\""
COMMENT "Creating directory junction to assets directory"
)
else ()
# Unix symlink for assets
add_custom_command(TARGET ${APP_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove -f "$<TARGET_FILE_DIR:${APP_NAME}>/assets"
COMMAND ${CMAKE_COMMAND} -E create_symlink
"${CMAKE_CURRENT_SOURCE_DIR}/assets"
"$<TARGET_FILE_DIR:${APP_NAME}>/assets"
COMMENT "Creating symlink to assets directory"
)
endif ()
target_compile_definitions(${LIB_NAME} PUBLIC HELLFIRE_EDITOR_ENABLED)

target_compile_definitions(${APP_NAME} PRIVATE HELLFIRE_EDITOR_ENABLED)
add_executable(${APP_NAME} src/main.cpp)
target_link_libraries(${APP_NAME} PRIVATE ${LIB_NAME})

# Set working directory for debugging in various IDEs
# Asset symlinks
include(${CMAKE_SOURCE_DIR}/cmake/AssetSymlink.cmake)
setup_asset_symlink(${APP_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/assets")

# IDE Settings
set_target_properties(${APP_NAME} PROPERTIES
# Visual Studio
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"

# Xcode
XCODE_SCHEME_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"

# For other IDEs that support it
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
)

if (MSVC)
# Try additional VS properties for working directory
set_target_properties(${APP_NAME} PROPERTIES
VS_DEBUGGER_COMMAND_ARGUMENTS ""
VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%"
)

# Add source grouping
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src" PREFIX "Source Files" FILES ${APP_SOURCES})
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src" PREFIX "Header Files" FILES ${APP_HEADERS})
endif ()


# Source grouping for library
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src" PREFIX "Source Files" FILES ${LIB_SOURCES})
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src" PREFIX "Header Files" FILES ${LIB_HEADERS})
endif ()
5 changes: 0 additions & 5 deletions editor/Tested.hfscene

This file was deleted.

5 changes: 0 additions & 5 deletions editor/Untitled.hfscene

This file was deleted.

5 changes: 0 additions & 5 deletions editor/Untitsssasled.hfscene

This file was deleted.

80 changes: 80 additions & 0 deletions editor/assets/layouts/default.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0

[Window][Hellfire - Project Hub]
Pos=-190,-190
Size=1280,720
Collapsed=0

[Window][DockSpace]
Pos=0,0
Size=2560,1369
Collapsed=0

[Window][Creating Project]
Pos=-242,-242
Size=1280,720
Collapsed=0

[Window][Scene Hierarchy Panel]
Pos=0,22
Size=432,1347
Collapsed=0
DockId=0x00000001,0

[Window][Renderer Settings]
Pos=1971,22
Size=589,1347
Collapsed=0
DockId=0x00000006,0

[Window][Asset Browser]
Pos=434,731
Size=1535,638
Collapsed=0
DockId=0x0000000A,0

[Window][Viewport]
Pos=434,22
Size=1535,701
Collapsed=0
DockId=0x00000003,0

[Window][Inspector]
Pos=1971,22
Size=589,1347
Collapsed=0
DockId=0x00000006,1

[Window][ Test_Scene.hfscene]
Pos=434,22
Size=255,664
Collapsed=0
DockId=0x00000007,0

[Window][Scene Viewport]
Pos=434,22
Size=1535,707
Collapsed=0
DockId=0x00000009,0

[Table][0x67B58617,2]
RefScale=16
Column 0 Width=150
Column 1 Weight=1.0000

[Docking][Data]
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,45 Size=2560,1347 Split=X
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=1969,1347 Split=X
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=432,1347 Selected=0x2E557BF6
DockNode ID=0x00000002 Parent=0x00000005 SizeRef=1535,1347 Split=Y
DockNode ID=0x00000003 Parent=0x00000002 SizeRef=2126,701 Selected=0xC450F867
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=2126,644 Split=Y Selected=0x36AF052B
DockNode ID=0x00000007 Parent=0x00000004 SizeRef=1535,692 Selected=0x7025CC7F
DockNode ID=0x00000008 Parent=0x00000004 SizeRef=1535,653 Split=Y Selected=0x36AF052B
DockNode ID=0x00000009 Parent=0x00000008 SizeRef=255,707 Selected=0x00B71885
DockNode ID=0x0000000A Parent=0x00000008 SizeRef=255,638 CentralNode=1 Selected=0x36AF052B
DockNode ID=0x00000006 Parent=0xCCBD8CF7 SizeRef=589,1347 Selected=0x47251AAB

2 changes: 2 additions & 0 deletions editor/assets/shaders/common/light_uniforms.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ uniform int numDirectionalLights;
uniform int numPointLights;
uniform DirectionalLight directionalLights[MAX_DIRECTIONAL_LIGHTS];
uniform PointLight pointLights[MAX_POINT_LIGHTS];
uniform sampler2D uShadowMap[MAX_DIRECTIONAL_LIGHTS];
uniform mat4 uLightSpaceMatrix[MAX_DIRECTIONAL_LIGHTS];

3 changes: 1 addition & 2 deletions editor/assets/shaders/lighting/blinn_phong.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ vec3 calcPointLight(PointLight light, vec3 normal, vec3 fragPos, vec3 diffuse, v
}

vec3 calculateBlinnPhongLighting(vec3 normal, vec3 baseColor, vec3 fragPos) {
vec3 result = uAmbientLight * baseColor;

vec3 result = vec3(0.0);
vec3 materialDiffuse = uDiffuseColor * baseColor;
// Add directional lights
for (int i = 0; i < min(numDirectionalLights, MAX_DIRECTIONAL_LIGHTS); i++) {
Expand Down
41 changes: 36 additions & 5 deletions editor/assets/shaders/phong.frag
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,47 @@ layout(location=0) out vec4 fragColor;
layout(location=1) out uint objectID;

uniform uint uObjectID;
uniform float uShadowBias;

float calculate_shadow(int light_index, vec3 frag_pos, vec3 normal, vec3 light_dir) {
vec4 frag_pos_light_space = uLightSpaceMatrix[light_index] * vec4(frag_pos, 1.0);
vec3 proj_coords = frag_pos_light_space.xyz / frag_pos_light_space.w;
// project coords into a [0, 1] space
proj_coords = proj_coords * 0.5 + 0.5;

if (proj_coords.z > 1.0) return 0.0;

float current_depth = proj_coords.z;

// PCF: sample a 3x3 area
float shadow = 0.0;
vec2 texel_size = 1.0 / textureSize(uShadowMap[light_index], 0);

for (int x = -1; x <= 1; ++x) {
for (int y = -1; y <= 1; ++y) {
float pcf_depth = texture(uShadowMap[light_index], proj_coords.xy + vec2(x, y) * texel_size).r;
shadow += current_depth - uShadowBias > pcf_depth ? 1.0 : 0.0;
}
}

return shadow / 9.0;
}

void main() {
// Sample base textures
vec4 diffuseValue = sampleDiffuseTexture(fs_in.TexCoords);
vec4 baseColor = applyVertexColors(diffuseValue, fs_in.Color);

// Calculate surface normal
vec3 normal = calculateSurfaceNormal(fs_in.TexCoords, fs_in.Normal, fs_in.TBN);
// Calculate lighting
vec3 result = calculateBlinnPhongLighting(normal, baseColor.rgb, fs_in.FragPos);
vec3 ambient = uAmbientLight * baseColor.rgb;

// Calculate direct lighting (diffuse + specular)
vec3 direct = calculateBlinnPhongLighting(normal, baseColor.rgb, fs_in.FragPos);

float shadow_factor = 0.0;
if (numDirectionalLights > 0) {
shadow_factor = calculate_shadow(0, fs_in.FragPos, normal, -directionalLights[0].direction);
}

vec3 result = ambient + direct * (1.0 - shadow_factor);

fragColor = vec4(result, uOpacity);
objectID = uObjectID;
Expand Down
5 changes: 5 additions & 0 deletions editor/assets/shaders/shadow.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#version 430 core

void main() {
gl_FragDepth = gl_FragCoord.z;
}
9 changes: 9 additions & 0 deletions editor/assets/shaders/shadow.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#version 430 core
layout (location = 0) in vec3 aPos;

uniform mat4 uLightViewProjMatrix;
uniform mat4 uModelMatrix;

void main() {
gl_Position = uLightViewProjMatrix * uModelMatrix * vec4(aPos, 1.0);
}
Loading
Loading