Skip to content
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

Scenes & Model Loading & PIX Markers & DPI-awareness #107

Merged
merged 46 commits into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
91dd38a
Asset loader with queues, loading unique models from the queue
vilbeyli Aug 19, 2020
04c171f
Add assimp as a submodule, configure GenerateProjectFiles.bat to incl…
vilbeyli Aug 20, 2020
7d0fb68
WIP: Model loading without material textures assignment even though t…
vilbeyli Aug 21, 2020
909cf2f
Asset Loader: sync texture loads and assign material textures properly
vilbeyli Aug 21, 2020
96ab951
Fix thread race issue (update vs render)
vilbeyli Aug 21, 2020
e2d8337
WIP: Asset Loading: fix std::future issues when get() is called multi…
vilbeyli Aug 21, 2020
10cbe8d
Model Loader: upload vertex/index buffers (with hardcoded format for …
vilbeyli Aug 21, 2020
2e2f897
Initialzie scene builtin meshes through loading function
vilbeyli Aug 24, 2020
67673ac
Async model loading
vilbeyli Aug 25, 2020
8e03ad5
WIP PBR material skeleton: objects rendered w/ diffuse map colors
vilbeyli Aug 26, 2020
b73e20f
Material deserialization for gameobjects
vilbeyli Aug 27, 2020
a38a9e3
Fix flickering gamma
vilbeyli Aug 27, 2020
2eea07b
Fix build script
vilbeyli Aug 27, 2020
c54b6ae
Fix build script: fail early when debug build fails
vilbeyli Aug 27, 2020
656d47b
Fix math library name collision
vilbeyli Aug 27, 2020
959d8cd
Fix packaging script building Release when -DebugOnly is specified
vilbeyli Aug 28, 2020
b14569e
Add GPU markers using PIX event runtime
vilbeyli Sep 3, 2020
51edd16
Fix mising binaries for WinPixEventRuntime
vilbeyli Sep 3, 2020
4c0b324
Fix GPU marker error
vilbeyli Sep 3, 2020
2fb6520
Update vqutils submodule to fix the empty queue issue with the thread…
vilbeyli Sep 4, 2020
6eba165
Fix threading issues on app exit when loading isnt complete yet
vilbeyli Sep 4, 2020
c1cc0a1
Fix environment map rendering with orthographic scene camera
vilbeyli Sep 4, 2020
a75fb4e
Fix synchronization issue with GatherHDRMetaDataParameters(hwnd)
vilbeyli Sep 8, 2020
76589de
Parallel texture loading done without creating new upload heap every …
vilbeyli Sep 8, 2020
b24ed1f
Fix memory leak on Images
vilbeyli Sep 8, 2020
97009d2
Fix vertex/index buffer heap upload sync issue
vilbeyli Sep 8, 2020
bf3d557
update assimp to latest version
vilbeyli Sep 8, 2020
9e9a12d
Add GLTF loader to assimp, remove obj sponza
vilbeyli Sep 9, 2020
c95d5f0
Add VQModels as submodule
vilbeyli Sep 9, 2020
23c7686
Fix multithreaded texture loading during asset import, update sponza…
vilbeyli Sep 10, 2020
92e6cc7
Fix assertion on empty texture load queue
vilbeyli Sep 10, 2020
fe74298
Fix crash/assert on model not found
vilbeyli Sep 10, 2020
995534a
Add khronos gltf samples to readme
vilbeyli Sep 10, 2020
acc4bc1
Code cleanup, scene adjustments, SRV heap and VB/IB heap sizes are at…
vilbeyli Sep 10, 2020
2881337
Fix object rotations on stresstest scene, reduce memory footprint of …
vilbeyli Sep 10, 2020
5c038a6
Fix environment map switching
vilbeyli Sep 10, 2020
8e73e34
Rotation loading screens
vilbeyli Sep 10, 2020
603dbe2
Bump CBV_SRV_UAV descriptor counts
vilbeyli Sep 14, 2020
a0ab4ad
Fix environment map camera FoV not being the same as the main view FoV
vilbeyli Sep 14, 2020
8646e9e
Fix warning
vilbeyli Sep 14, 2020
7b49ccf
Fix starving threads w/ low thread-count systems by separating model …
vilbeyli Sep 15, 2020
e27e196
Add DPI awareness
vilbeyli Sep 15, 2020
672b1dd
Fix out-of-sync env map and scene views
vilbeyli Sep 15, 2020
bc952c8
remove unintended files
vilbeyli Sep 15, 2020
7e90165
Update readme screenshot (Add gif) + update CMakelists to move assimp…
vilbeyli Sep 15, 2020
1d82663
update readme: fix screenshot
vilbeyli Sep 15, 2020
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,7 @@ $RECYCLE.BIN/
# EXCEPTIONS
!Data/Models/*/*.obj
!Tools/7z.exe
!Tools/wget.exe
!Tools/wget.exe
!Libs/WinPixEventRuntime/bin
!Libs/WinPixEventRuntime/bin/x64/
!Libs/WinPixEventRuntime/bin/x64/*
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@
[submodule "Libs/D3D12MA"]
path = Libs/D3D12MA
url = https://github.com/vilbeyli/D3D12MemoryAllocator.git
[submodule "Libs/assimp"]
path = Libs/assimp
url = https://github.com/assimp/assimp.git
[submodule "Data/Models"]
path = Data/Models
url = https://github.com/vilbeyli/VQModels.git
17 changes: 15 additions & 2 deletions Build/GenerateProjectFiles.bat
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,20 @@ exit /b 0
::
:RunCmake

cmake ..\.. -G "Visual Studio 16 2019" -A x64
:: assimp importers
set ASSIMP_IMPORT_FORMATS=-DASSIMP_BUILD_OBJ_IMPORTER=TRUE
set ASSIMP_IMPORT_FORMATS=!ASSIMP_IMPORT_FORMATS! -DASSIMP_BUILD_GLTF_IMPORTER=TRUE
:: assimp build options
set CMAKE_ASSIMP_PARAMETERS=-DASSIMP_BUILD_ASSIMP_TOOLS=OFF
set CMAKE_ASSIMP_PARAMETERS=!CMAKE_ASSIMP_PARAMETERS! -DASSIMP_NO_EXPORT=ON
set CMAKE_ASSIMP_PARAMETERS=!CMAKE_ASSIMP_PARAMETERS! -DASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT=FALSE
set CMAKE_ASSIMP_PARAMETERS=!CMAKE_ASSIMP_PARAMETERS! -DBUILD_SHARED_LIBS=OFF
set CMAKE_ASSIMP_PARAMETERS=!CMAKE_ASSIMP_PARAMETERS! -DASSIMP_BUILD_TESTS=OFF
set CMAKE_ASSIMP_PARAMETERS=!CMAKE_ASSIMP_PARAMETERS! -DASSIMP_INSTALL=OFF
set CMAKE_ASSIMP_PARAMETERS=!CMAKE_ASSIMP_PARAMETERS! !ASSIMP_IMPORT_FORMATS!


cmake ..\.. -G "Visual Studio 16 2019" -A x64 !CMAKE_ASSIMP_PARAMETERS!

if !errorlevel! EQU 0 (
echo [VQBuild] Success!
Expand All @@ -140,7 +153,7 @@ if !errorlevel! EQU 0 (
echo [VQBuild] cmake VS2019 failed, retrying with VS 2017...
echo [VQBuild] removing %~dp0SolutionFiles ...
rmdir /S /Q %~dp0SolutionFiles
cmake ..\.. -G "Visual Studio 15 2017" -A x64
cmake ..\.. -G "Visual Studio 15 2017" -A x64 !CMAKE_ASSIMP_PARAMETERS!
if !errorlevel! NEQ 0 (
echo [VQBuild] cmake VS2017 failed, retrying without specifying VS version...
echo [VQBuild] removing %~dp0SolutionFiles ...
Expand Down
23 changes: 14 additions & 9 deletions Build/PackageEngine.bat
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ for %%i IN (%*) DO (
::echo SkipMSBuildFind=!MSBUILD_FIND!
if !MSBUILD_FIND! equ 1 (
call :FindMSBuild
if %ERRORLEVEL% neq 0 (
if !ERRORLEVEL! neq 0 (
echo [VQPackage] Error: Couldn't find MSBuild
exit /b -1
)
Expand Down Expand Up @@ -124,7 +124,7 @@ if !NO_BUILD! equ 0 (
:: Package the engine
call :ExecBuildTask_Build

if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
)

:: move build artifacts into destination folder
Expand Down Expand Up @@ -191,7 +191,7 @@ if not exist !SOLUTION_FILE_PATH! (
echo **********************************************************************
echo.
call %~dp0GenerateProjectFiles.bat -noVS
if %ERRORLEVEL% neq 0 (
if !ERRORLEVEL! neq 0 (
echo [VQPackage] Error: Couldn't generate project files.
exit /b -1
)
Expand All @@ -218,20 +218,25 @@ exit /b 0
:ExecBuildTask_Build
::echo [VQPackage] ENGINE_BUILD_COMMAND = !ENGINE_BUILD_COMMAND!
:: ---------------------- Build Release ----------------------
call :PrintBuildStage Release
call !ENGINE_BUILD_COMMAND! /p:Configuration=Release
set /A ERR_REL=!ERRORLEVEL!
set /A BUILD_NUM_CURR_TASK=!BUILD_NUM_CURR_TASK!+1
if !BUILD_CONFIG_RELEASE! neq 0 (
call :PrintBuildStage Release
call !ENGINE_BUILD_COMMAND! /p:Configuration=Release
if !ERRORLEVEL! neq 0 (
echo ERROR: BUILD ERROR
exit /b -1
)
set /A BUILD_NUM_CURR_TASK=!BUILD_NUM_CURR_TASK!+1
)
:: ---------------------- Build Release ----------------------
:: ---------------------- Build Debug ----------------------
if !BUILD_CONFIG_DEBUG! neq 0 (
call :PrintBuildStage Debug
call !ENGINE_BUILD_COMMAND! /p:Configuration=Debug
set /A BUILD_NUM_CURR_TASK=!BUILD_NUM_CURR_TASK!+1
if %ERRORLEVEL% neq 0 (
if !ERRORLEVEL! neq 0 (
echo ERROR: BUILD ERROR
exit /b -1
)
set /A BUILD_NUM_CURR_TASK=!BUILD_NUM_CURR_TASK!+1
)
:: ---------------------- Build Debug ----------------------
:: ---------------------- Build RelWithDebInfo----------------
Expand Down
41 changes: 40 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ set (Shaders
"Shaders/FullscreenTriangle.hlsl"
"Shaders/Tonemapper.hlsl"
"Shaders/Skydome.hlsl"
"Shaders/Object.hlsl"
)

set (HeaderVQE
Expand All @@ -54,6 +55,7 @@ set (HeaderVQE
"Source/Application/VQEngine.h"
"Source/Application/Events.h"
"Source/Application/Mesh.h"
"Source/Application/Material.h"
"Source/Application/Model.h"
"Source/Application/Geometry.h"
"Source/Application/Transform.h"
Expand All @@ -65,6 +67,7 @@ set (HeaderVQE
"Source/Application/Light.h"
"Source/Application/GameObject.h"
"Source/Application/Memory.h"
"Source/Application/GPUMarker.h"
)

set (SourceVQE
Expand All @@ -79,6 +82,7 @@ set (SourceVQE
"Source/Application/FileParser.cpp"
"Source/Application/Events.cpp"
"Source/Application/Mesh.cpp"
"Source/Application/Material.cpp"
"Source/Application/Model.cpp"
"Source/Application/Geometry.cpp"
"Source/Application/Transform.cpp"
Expand All @@ -91,6 +95,11 @@ set (SourceVQE
"Source/Application/Light.cpp"
"Source/Application/GameObject.cpp"
"Source/Application/Memory.cpp"
"Source/Application/GPUMarker.cpp"
)

set (PIXIncl
"Libs/WinPixEventRuntime/Include"
)

# ouput exe to bin directory
Expand All @@ -101,10 +110,20 @@ endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )

add_link_options(/SUBSYSTEM:WINDOWS)

# add submodules
add_subdirectory(Libs/VQUtils)
add_subdirectory(Libs/D3D12MA)
add_subdirectory(Source/Renderer)

#add_definitions(
# -DASSIMP_BUILD_ASSIMP_TOOLS=OFF
# -DASSIMP_NO_EXPORT=ON
# -DBUILD_SHARED_LIBS=OFF
# -DASSIMP_BUILD_TESTS=OFF
# -DASSIMP_INSTALL=OFF
#)
add_subdirectory(Libs/assimp)

source_group("Config" FILES ${Config})
source_group("Resource" FILES ${Resource})
source_group("Icons" FILES ${Icons})
Expand All @@ -118,12 +137,14 @@ set_source_files_properties(Data/Resources/VQE.rc PROPERTIES VS_TOOL_OVERRIDE "R
set_source_files_properties(Data/Icons/VQE32.ico PROPERTIES VS_TOOL_OVERRIDE "Image")

link_directories(${CMAKE_CURRENT_SOURCE_DIR}/Libs/VQUtils/Bin/)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/Libs/WinPixEventRuntime/bin/x64)

# Create a library with the project name that is build with the Headers and Source files
add_executable( ${PROJECT_NAME} ${HeaderVQE} ${SourceVQE} ${Config} ${Scenes} ${Resource} ${Shaders} )

set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_HOME_DIRECTORY} )


# set target executable name for debug/releasewithdebug builds, release is VQE.exe
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
Expand All @@ -135,9 +156,27 @@ foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )

set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

set_target_properties(assimp PROPERTIES FOLDER Libs/assimp)
set_target_properties(IrrXML PROPERTIES FOLDER Libs/assimp)
set_target_properties(uninstall PROPERTIES FOLDER Libs/assimp)
set_target_properties(UpdateAssimpLibsDebugSymbolsAndDLLs PROPERTIES FOLDER Libs/assimp)
set_target_properties(zlibstatic PROPERTIES FOLDER Libs/assimp)

#set_target_properties(VQRenderer PROPERTIES FOLDER Libs)
#set_target_properties(VQUtils PROPERTIES FOLDER Libs)
set_target_properties(D3D12MA PROPERTIES FOLDER Libs)

# Make sure the compiler can find include files for the libraries
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${Includes})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${PIXIncl})

target_link_libraries(${PROJECT_NAME} PRIVATE VQUtils VQRenderer assimp WinPixEventRuntime)

target_link_libraries(${PROJECT_NAME} PRIVATE VQUtils VQRenderer )

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/Libs/WinPixEventRuntime/bin/x64/WinPixEventRuntime.dll"
$<TARGET_FILE_DIR:${PROJECT_NAME}>
)
2 changes: 1 addition & 1 deletion Data/EngineSettings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Width=768
Height=432
DisplayMode=Windowed
PreferredDisplay=0
Scene=Sponza
Scene=StressTest

DebugWindow=false
DebugWindowWidth=450
Expand Down
52 changes: 28 additions & 24 deletions Data/Levels/Default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<Preset>Stadium01</Preset>
</EnvironmentMap>

<!-- CAMERAS -->
<Camera>
<Position> 0.0 3.0 -5 </Position>
<Pitch> 15 </Pitch>
Expand All @@ -29,39 +30,46 @@
<Drag>9.5</Drag>
</FirstPerson>
</Camera>

<GameObject>
<Transform>
<Position>0 0 4</Position>
<Quaternion>0 0 0 1</Quaternion>
<Scale>3 3 3</Scale>
</Transform>
<Model>
<Mesh>Cube</Mesh>
<Material>
<Diffuse></Diffuse>
</Material>
</Model>
</GameObject>


<Camera>
<Position> 6.0 3.0 -5 </Position>
<Pitch> 65 </Pitch>
<Yaw> 6 </Yaw>
<Projection>Orthographic</Projection>

<Projection>Perspective</Projection>
<FoV>90.0</FoV>
<Near>0.01</Near>
<Far>1000</Far>
<Far>5000</Far>

<FirstPerson>
<TranslationSpeed>1000</TranslationSpeed>
<AngularSpeed>0.05</AngularSpeed>
<Drag>9.5</Drag>
</FirstPerson>
</Camera>

<!-- MATERIALS -->
<Material>
<Name>Checkerboard</Name>
<DiffuseMap>Procedural/Checkerboard</DiffuseMap>
</Material>
<Material>
<Name>Checkerboard_Grayscale</Name>
<DiffuseMap>Procedural/Checkerboard_Grayscale</DiffuseMap>
</Material>

<!-- OBJECTS -->
<GameObject>
<Transform>
<Position>0 0 4</Position>
<Quaternion>0 0 0 1</Quaternion>
<Scale>3 3 3</Scale>
</Transform>
<Model>
<Mesh>Cube</Mesh>
<MaterialName>Checkerboard</MaterialName>
</Model>
</GameObject>

<GameObject>
<Transform>
<Position> 0.0 3.0 -14 </Position>
Expand All @@ -70,11 +78,7 @@
</Transform>
<Model>
<Mesh>Cube</Mesh>
<Material>
<Diffuse></Diffuse>
</Material>
<MaterialName>Checkerboard_Grayscale</MaterialName>
</Model>
</GameObject>


</Scene>
44 changes: 38 additions & 6 deletions Data/Levels/GeometryUnitTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@
<Preset>Stadium01</Preset>
</EnvironmentMap>
-->

<!--
MATERIALS
-->
<Material>
<Name>GreenMat</Name>
<Diffuse>0 0.5 0</Diffuse>
<Alpha> 0.5 </Alpha>
<DiffuseMap>Data/Textures/PBR/cgbookcase/black-herringbone-tiles-01/Black_herringbone_tiles_01_2K_Base_Color.png</DiffuseMap>
</Material>
<Material>
<Name>RedMat</Name>
<Diffuse>0.8 0.0 0</Diffuse>
<Alpha> 1 </Alpha>
</Material>
<Material>
<Name>Checkerboard</Name>
<DiffuseMap>Procedural/Checkerboard</DiffuseMap>
</Material>
<Material>
<Name>Checkerboard_Grayscale</Name>
<DiffuseMap>Procedural/Checkerboard_Grayscale</DiffuseMap>
</Material>

<Camera>
<Position> 0.0 3.0 -5 </Position>
<Pitch> 15 </Pitch>
Expand All @@ -55,9 +79,7 @@
</Transform>
<Model>
<Mesh>Cube</Mesh>
<Material>
<Diffuse></Diffuse>
</Material>
<MaterialName>GreenMat</MaterialName>
</Model>
</GameObject>

Expand All @@ -69,13 +91,23 @@
</Transform>
<Model>
<Mesh>Triangle</Mesh>
<Material>
<Diffuse></Diffuse>
</Material>
<MaterialName>Checkerboard</MaterialName>
</Model>
</GameObject>


<GameObject>
<Transform>
<Position>-5 0 0</Position>
<Quaternion>0 0 0 1</Quaternion>
<Scale>1 1 1</Scale>
</Transform>
<Model>
<Mesh>Triangle</Mesh>
<MaterialName>Checkerboard_Grayscale</MaterialName>
</Model>
</GameObject>

<PostProcess>
<!-- TBA -->
</PostProcess>
Expand Down
Loading