-
Notifications
You must be signed in to change notification settings - Fork 28
Simple game engine #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gpx1000
wants to merge
101
commits into
KhronosGroup:main
Choose a base branch
from
gpx1000:Simple-Game-Engine
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+69,460
−14
Open
Simple game engine #119
Changes from 96 commits
Commits
Show all changes
101 commits
Select commit
Hold shift + click to select a range
12f357f
First commit of the new "simple engine" tutorial. This is a VERY ear…
gpx1000 7e419d5
Refactor GPU optimization sections to generalize vendor-specific reco…
gpx1000 4644950
Refactor mobile GPU optimization sections and enhance Vulkan extensio…
gpx1000 2edbd75
Add detailed section on rendergraphs and synchronization in Vulkan
gpx1000 b476bd1
Add architectural pattern diagrams and refine related sections
gpx1000 f1d10cf
Add explanatory note on windowing libraries in input handling tutorial
gpx1000 2a350b2
closer to getting engine working.
gpx1000 2d46280
address feedback
gpx1000 3b3dc05
address feedback
gpx1000 6cf03fc
address feedback
gpx1000 50d78a7
add the flowchart to the rendering pipeline.
gpx1000 9b2c781
describe Rendergraphs and Dynamic Rendering
gpx1000 ddd1177
address comments.
gpx1000 5ec2035
add the requested appendix.adoc
gpx1000 31ded49
add the requested appendix.adoc
gpx1000 659ecb1
address the requested items
gpx1000 bd98b2d
address the requested items
gpx1000 8b83ead
address the requested items
gpx1000 9b2343a
address the requested items
gpx1000 7734f21
Engine now builds and runs. IMGUI having issues.
gpx1000 b8a9b39
Engine now renders. Bunch of validation errors and it looks like img…
gpx1000 e773353
address comments.
gpx1000 6256f77
address comments.
gpx1000 e6b8583
It runs now, IMGUI is happier.
gpx1000 e3f6fc6
everything runs and can close without validation warnings other than …
gpx1000 4a3b450
everything runs and can close without validation warnings other than …
gpx1000 0833166
audio HRTF works well and debug switch to turn on CPU only mode vs GP…
gpx1000 9513597
audio fully works, GPU HRTF works as well as CPU HRTF.
gpx1000 86c396a
The bistro scene now loads. Still have some issues with PBR but I th…
gpx1000 a62e4a9
make the hrtf listener sync with the camera location and rotation.
gpx1000 14fc6b1
Lighting working for non PBR code, and PBR code seems to be relativel…
gpx1000 b998a13
fix for formating the list.
gpx1000 8be59f4
PBR is working. KTX2 with BasisU is working.
gpx1000 be45542
Update 04_rendering_approaches.adoc
gpx1000 8bdf3d1
Update 04_rendering_approaches.adoc
gpx1000 e80fd23
address comments
gpx1000 20a9ade
Merge remote-tracking branch 'origin/Simple-Game-Engine' into Simple-…
gpx1000 d834c39
address comments
gpx1000 ea39e65
address comments
gpx1000 858b792
address comments
gpx1000 815aa79
Need to investigate a few things, (physics isn't colliding against th…
gpx1000 bdc1845
add in the dependences install scripts.
gpx1000 04c8b38
Merge branch 'refs/heads/upstream-main' into Simple-Game-Engine
gpx1000 cdb01db
attempt to fancy fix the windows install script.
gpx1000 16019ca
CMake: use PLATFORM_* defines via ANDROID, fix glfw condition, make s…
gpx1000 4b8198d
Fix the pathing for install_dependencies_windows.bat also fix CMakeLi…
gpx1000 14dcb35
Add instancing support, remove unused STB dependency, and fetch Bistr…
gpx1000 dd9713a
Refactor Vulkan memory handling, physics GPU initialization, and coll…
gpx1000 27715c0
address several comments (more still need to be addressed). And fix …
gpx1000 067ea74
Move Renderdoc out of the debug_system.h and into a "real world" rend…
gpx1000 a5edf28
the lighting in the PBR scene *looks* better. There's still a bit th…
gpx1000 adf461e
Remove shadows for now. We'll concentrate on them in the samples ver…
gpx1000 e57bc3d
Fix the string lights.
gpx1000 e1d7059
committing requested changes in stages.
gpx1000 1f17074
committing requested changes in stages.
gpx1000 acfbd6e
committing requested changes in stages.
gpx1000 5e38540
committing requested changes in stages.
gpx1000 a58b884
committing requested changes in stages.
gpx1000 4b4a243
committing requested changes in stages.
gpx1000 6ec7321
committing requested changes in stages.
gpx1000 8ecae4e
committing requested changes in stages.
gpx1000 345b137
committing requested changes in stages.
gpx1000 11e9a65
committing requested changes in stages.
gpx1000 5e6209c
committing requested changes in stages.
gpx1000 25e66d5
committing requested changes in stages.
gpx1000 5849fa5
switch from link to xref.
gpx1000 f1df3d2
addressing more comments.
gpx1000 7eaa47e
addressing more comments.
gpx1000 92c7f7d
addressing more comments.
gpx1000 625eb71
addressing more comments.
gpx1000 60ee95d
addressing more comments.
gpx1000 23952bc
addressing more comments.
gpx1000 65e5db3
addressing more comments.
gpx1000 e564b29
addressing more comments.
gpx1000 7b3e016
addressing more comments.
gpx1000 7bf9dab
addressing more comments.
gpx1000 47a6baa
addressing more comments.
gpx1000 44e7f38
addressing more comments.
gpx1000 dd51a38
addressing more comments.
gpx1000 f713e9c
addressing more comments.
gpx1000 9705b60
addressing more comments.
gpx1000 921eed4
addressing more comments.
gpx1000 2a22079
addressing more comments.
gpx1000 41e336e
addressing more comments.
gpx1000 b78f8b2
addressing more comments.
gpx1000 5c7a132
addressing more comments.
gpx1000 560b9f3
addressing more comments.
gpx1000 6db6b9d
addressing more comments.
gpx1000 02baf4d
addressing more comments.
gpx1000 0b0dddb
addressing more comments.
gpx1000 ccb5c15
addressing more comments.
gpx1000 aa321c0
addressing more comments.
gpx1000 5c4ec27
addressing more comments.
gpx1000 b4d6226
addressing more comments.
gpx1000 a8d11c6
addressing more comments.
gpx1000 b167c70
addressing more comments.
gpx1000 276d1cb
addressing more comments.
gpx1000 6e8adb4
implementing Spec-Gloss workflow and transmission materials.
gpx1000 e1ac508
updating nlohmann_json to v3.12.0.
gpx1000 bbbae41
update the default screenshot.
gpx1000 03d05cf
implementing support for asynchronous texture loading and improved Vu…
gpx1000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
cmake_minimum_required(VERSION 3.29) | ||
|
||
# Enable C++ module dependency scanning | ||
set(CMAKE_CXX_SCAN_FOR_MODULES ON) | ||
|
||
project(SimpleEngine VERSION 1.0.0 LANGUAGES CXX C) | ||
|
||
# Add CMake module path for custom find modules | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../CMake") | ||
|
||
# Find required packages | ||
find_package (glfw3 REQUIRED) | ||
find_package (glm REQUIRED) | ||
find_package (Vulkan REQUIRED) | ||
find_package (tinygltf REQUIRED) | ||
find_package (KTX REQUIRED) | ||
find_package (OpenAL REQUIRED) | ||
|
||
# set up Vulkan C++ module | ||
add_library(VulkanCppModule) | ||
add_library(Vulkan::cppm ALIAS VulkanCppModule) | ||
|
||
target_compile_definitions(VulkanCppModule | ||
PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1 VULKAN_HPP_NO_STRUCT_CONSTRUCTORS=1 | ||
) | ||
target_include_directories(VulkanCppModule | ||
PRIVATE | ||
"${Vulkan_INCLUDE_DIR}" | ||
) | ||
target_link_libraries(VulkanCppModule | ||
PUBLIC | ||
Vulkan::Vulkan | ||
) | ||
|
||
set_target_properties(VulkanCppModule PROPERTIES CXX_STANDARD 20) | ||
|
||
target_sources(VulkanCppModule | ||
PUBLIC | ||
FILE_SET cxx_modules TYPE CXX_MODULES | ||
BASE_DIRS | ||
"${Vulkan_INCLUDE_DIR}" | ||
FILES | ||
"${Vulkan_INCLUDE_DIR}/vulkan/vulkan.cppm" | ||
) | ||
|
||
|
||
# Add the vulkan.cppm file directly as a source file | ||
target_sources(VulkanCppModule | ||
PRIVATE | ||
"${Vulkan_INCLUDE_DIR}/vulkan/vulkan.cppm" | ||
) | ||
|
||
# Platform-specific settings | ||
if(ANDROID) | ||
# Android-specific settings | ||
add_definitions(-DPLATFORM_ANDROID) | ||
else() | ||
# Desktop-specific settings | ||
add_definitions(-DPLATFORM_DESKTOP) | ||
endif() | ||
|
||
# Shader compilation | ||
# Find Slang shaders | ||
file(GLOB SLANG_SHADER_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/shaders/*.slang) | ||
|
||
# Find slangc executable (optional) | ||
find_program(SLANGC_EXECUTABLE slangc HINTS $ENV{VULKAN_SDK}/bin) | ||
|
||
if(SLANGC_EXECUTABLE) | ||
# Ensure the output directory for compiled shaders exists | ||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/shaders) | ||
|
||
# Compile Slang shaders using slangc | ||
foreach(SHADER ${SLANG_SHADER_SOURCES}) | ||
get_filename_component(SHADER_NAME ${SHADER} NAME) | ||
get_filename_component(SHADER_NAME_WE ${SHADER_NAME} NAME_WE) | ||
string(REGEX REPLACE "\.slang$" "" OUTPUT_NAME ${SHADER_NAME}) | ||
add_custom_command( | ||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/shaders/${OUTPUT_NAME}.spv | ||
COMMAND ${SLANGC_EXECUTABLE} ${SHADER} -target spirv -profile spirv_1_4 -emit-spirv-directly -o ${CMAKE_CURRENT_BINARY_DIR}/shaders/${OUTPUT_NAME}.spv | ||
DEPENDS ${SHADER} | ||
COMMENT "Compiling Slang shader ${SHADER_NAME} with slangc" | ||
) | ||
list(APPEND SHADER_SPVS ${CMAKE_CURRENT_BINARY_DIR}/shaders/${OUTPUT_NAME}.spv) | ||
endforeach() | ||
|
||
add_custom_target(shaders DEPENDS ${SHADER_SPVS}) | ||
else() | ||
message(STATUS "slangc not found. Skipping shader compilation step.") | ||
add_custom_target(shaders) | ||
endif() | ||
|
||
# Source files | ||
set(SOURCES | ||
main.cpp | ||
engine.cpp | ||
scene_loading.cpp | ||
platform.cpp | ||
renderer_core.cpp | ||
renderer_rendering.cpp | ||
renderer_pipelines.cpp | ||
renderer_compute.cpp | ||
renderer_utils.cpp | ||
renderer_resources.cpp | ||
memory_pool.cpp | ||
resource_manager.cpp | ||
entity.cpp | ||
component.cpp | ||
transform_component.cpp | ||
mesh_component.cpp | ||
camera_component.cpp | ||
model_loader.cpp | ||
audio_system.cpp | ||
physics_system.cpp | ||
imgui_system.cpp | ||
imgui/imgui.cpp | ||
imgui/imgui_draw.cpp | ||
vulkan_device.cpp | ||
pipeline.cpp | ||
descriptor_manager.cpp | ||
renderdoc_debug_system.cpp | ||
) | ||
|
||
# Create executable | ||
add_executable(SimpleEngine ${SOURCES}) | ||
add_dependencies(SimpleEngine shaders) | ||
set_target_properties (SimpleEngine PROPERTIES CXX_STANDARD 20) | ||
|
||
# Link libraries | ||
target_link_libraries(SimpleEngine PRIVATE | ||
Vulkan::cppm | ||
glm::glm | ||
tinygltf::tinygltf | ||
KTX::ktx | ||
OpenAL::OpenAL | ||
) | ||
|
||
if(NOT ANDROID) | ||
target_link_libraries(SimpleEngine PRIVATE glfw) | ||
endif() | ||
|
||
# Copy model and texture files if they exist | ||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/models) | ||
add_custom_command(TARGET SimpleEngine POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/models ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/models | ||
COMMENT "Copying models to output directory" | ||
) | ||
endif() | ||
|
||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/textures) | ||
add_custom_command(TARGET SimpleEngine POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/textures ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/textures | ||
COMMENT "Copying textures to output directory" | ||
) | ||
endif() | ||
|
||
# Add packaging configuration | ||
include(CPack) | ||
|
||
# Set package properties | ||
set(CPACK_PACKAGE_NAME "SimpleEngine") | ||
set(CPACK_PACKAGE_VENDOR "SimpleEngine Team") | ||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A simple game engine built with Vulkan") | ||
set(CPACK_PACKAGE_VERSION "1.0.0") | ||
set(CPACK_PACKAGE_VERSION_MAJOR "1") | ||
set(CPACK_PACKAGE_VERSION_MINOR "0") | ||
set(CPACK_PACKAGE_VERSION_PATCH "0") | ||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "SimpleEngine") | ||
|
||
# Set platform-specific package generators | ||
if(WIN32) | ||
set(CPACK_GENERATOR "ZIP;NSIS") | ||
set(CPACK_NSIS_PACKAGE_NAME "SimpleEngine") | ||
set(CPACK_NSIS_DISPLAY_NAME "SimpleEngine") | ||
set(CPACK_NSIS_HELP_LINK "https://github.com/yourusername/SimpleEngine") | ||
set(CPACK_NSIS_URL_INFO_ABOUT "https://github.com/yourusername/SimpleEngine") | ||
set(CPACK_NSIS_CONTACT "your.email@example.com") | ||
set(CPACK_NSIS_MODIFY_PATH ON) | ||
elseif(APPLE) | ||
set(CPACK_GENERATOR "ZIP;DragNDrop") | ||
set(CPACK_DMG_VOLUME_NAME "SimpleEngine") | ||
set(CPACK_DMG_FORMAT "UDBZ") | ||
else() | ||
set(CPACK_GENERATOR "ZIP;DEB") | ||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Your Name <your.email@example.com>") | ||
set(CPACK_DEBIAN_PACKAGE_SECTION "games") | ||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libvulkan1, libglfw3, libglm-dev, libktx-dev") | ||
endif() | ||
|
||
# Include binary and resource directories in the package | ||
install(TARGETS SimpleEngine DESTINATION bin) | ||
if(SLANGC_EXECUTABLE) | ||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/shaders DESTINATION share/SimpleEngine) | ||
endif() | ||
|
||
# Install models and textures if they exist | ||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/models) | ||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/models DESTINATION share/SimpleEngine) | ||
endif() | ||
|
||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/textures) | ||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/textures DESTINATION share/SimpleEngine) | ||
endif() | ||
|
||
# Install README if it exists | ||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/README.md) | ||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.md DESTINATION share/SimpleEngine) | ||
endif() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.