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

Implemented lights part of clustered rendering. #584

Merged
merged 19 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e8d524e
Castor3D: Implemented a way to display shader intermediate values.
DragonJoker May 1, 2023
03ef292
CMake: Release now write pdbs too.
DragonJoker May 1, 2023
7562ccf
Castor3D: Updated GPU buffer pointers types.
DragonJoker May 1, 2023
c32f857
Castor3D: Added basic support for HDR swapchain.
DragonJoker May 2, 2023
861f9c4
Updated submodules.
DragonJoker May 7, 2023
bc8f3ae
Castor3D: Added a way to accumulate rotations in scene files.
DragonJoker May 7, 2023
ff718ee
Castor3D: renamed MovableObject::getType to MovableObject::getMovable…
DragonJoker May 7, 2023
99281d9
Castor3D: Now passing the 5 first frames when computing average time.
DragonJoker May 15, 2023
e294086
Castor3D: Created a components mask member to RenderNodesPass.
DragonJoker May 25, 2023
ce2a8cd
Castor3D: Reduced GBuffer and added an additional opaque pass.
DragonJoker May 16, 2023
ca32121
Castor3D: Improved debug values consistency.
DragonJoker May 26, 2023
8557153
Lighting: Fixed some consistency issues between nodes passes.
DragonJoker May 25, 2023
f6e771d
Tools: Fixed HeightMapToNormalMap arguments handling.
DragonJoker May 17, 2023
f4a66b3
Export: Removed writing of empty materials and GUI styles.
DragonJoker May 17, 2023
11a9322
Debug: Improved times computations.
DragonJoker May 15, 2023
ff0d9dd
Castor3D: Added support for clustered rendering, lights part.
DragonJoker May 4, 2023
4007ad7
GuiCommon: Added DPI support.
DragonJoker May 26, 2023
622b2b0
Clustered: Added lights BVH generation.
DragonJoker May 27, 2023
ebfd8b9
Clusters: Added support for lights morton codes sorting.
DragonJoker May 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
- name: Checkout submodules
run: |
git submodule update --init -- "CMake"
git submodule update --init --recursive -- "external/Ashes"
git submodule update --init --recursive -- "external/ShaderWriter"
git submodule update --init --recursive -- "external/RenderGraph"
git submodule update --init -- "external/vcpkg"
- name: Setup vcpkg
uses: lukka/run-vcpkg@v10
Expand All @@ -51,7 +54,7 @@ jobs:
shell: bash
working-directory: ${{runner.workspace}}/build-${{ matrix.buildType }}
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.buildType }} -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/external/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/package/Castor3D -DPROJECTS_WARNINGS_AS_ERRORS=$PROJ_WAE -DPROJECTS_UNITY_BUILD=ON -DPROJECTS_USE_PRECOMPILED_HEADERS=OFF -DSDW_GENERATE_SOURCE=OFF -DCASTOR_BUILD_PLUGINS=ON -DCASTOR_BUILDGRP_INTEROP=OFF -DCASTOR_BUILDGRP_TEST=OFF -DCASTOR_USE_GLSLANG=ON -DCASTOR_DISABLE_DELAYED_INITIALISATION=ON -DASHES_BUILD_RENDERER_OGL=OFF -DCASTOR_BUILDGRP_SAMPLE=OFF -DCASTOR_BUILDGRP_TOOL=OFF -DCASTOR_FORCE_VCPKG_SUBMODULES=ON
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.buildType }} -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/external/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/package/Castor3D -DPROJECTS_WARNINGS_AS_ERRORS=$PROJ_WAE -DPROJECTS_UNITY_BUILD=ON -DPROJECTS_USE_PRECOMPILED_HEADERS=OFF -DSDW_GENERATE_SOURCE=OFF -DCASTOR_BUILD_PLUGINS=ON -DCASTOR_BUILDGRP_INTEROP=OFF -DCASTOR_BUILDGRP_TEST=OFF -DCASTOR_USE_GLSLANG=ON -DCASTOR_DISABLE_DELAYED_INITIALISATION=ON -DASHES_BUILD_RENDERER_OGL=OFF -DCASTOR_BUILDGRP_SAMPLE=OFF -DCASTOR_BUILDGRP_TOOL=OFF
- name: Build
if: steps.configure.conclusion == 'success'
id: build
Expand Down Expand Up @@ -230,7 +233,6 @@ jobs:
vcpkgDirectory: '${{ github.workspace }}/external/vcpkg'
vcpkgJsonGlob: 'vcpkg.json'
- name: Install necessary Clang++ version
if: matrix.os[2] == 'clang'
shell: bash
run: |
sudo apt-get update
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
[submodule "external/Ashes"]
path = external/Ashes
url = https://github.com/DragonJoker/Ashes.git
[submodule "external/glslang"]
path = external/glslang
url = https://github.com/KhronosGroup/glslang.git
[submodule "external/ShaderWriter"]
path = external/ShaderWriter
url = https://github.com/DragonJoker/ShaderWriter.git
Expand Down
2 changes: 1 addition & 1 deletion CMake
11 changes: 5 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ if ( WIN32 AND NOT VCPKG_TOOLCHAIN )
if ( EXISTS ${DEPENDENCIES_DIR}/wxWidgets/ )
set( wxWidgets_DIR ${DEPENDENCIES_DIR}/wxWidgets/lib/cmake/wxWidgets CACHE PATH "wxWidgets libraries directory" )
endif ()
endif ()
if ( CASTOR_USE_DEPS_WXWIDGETS AND WIN32 )
if ( NOT EXISTS ${DEPENDENCIES_DIR}/wxWidgets/ )
message( SEND_ERROR "${DEPENDENCIES_DIR}/wxWidgets not found" )
if ( CASTOR_USE_DEPS_WXWIDGETS AND WIN32 )
if ( NOT EXISTS ${DEPENDENCIES_DIR}/wxWidgets/ )
message( SEND_ERROR "${DEPENDENCIES_DIR}/wxWidgets not found" )
endif ()
set( wxWidgets_DIR ${DEPENDENCIES_DIR}/wxWidgets/lib/cmake/wxWidgets CACHE PATH "wxWidgets libraries directory" FORCE )
endif ()
set( wxWidgets_DIR ${DEPENDENCIES_DIR}/wxWidgets/lib/cmake/wxWidgets CACHE PATH "wxWidgets libraries directory" FORCE )
endif ()

if ( CMAKE_COMPILER_IS_GNUCXX )
Expand Down Expand Up @@ -149,7 +149,6 @@ add_compile_definitions( $<$<CXX_COMPILER_ID:MSVC>:_ENFORCE_MATCHING_ALLOCATORS=
set( ASHES_DIR external/Ashes )
set( SHADERWRITER_DIR external/ShaderWriter )
set( RENDERGRAPH_DIR external/RenderGraph )
set( MESHOPTIMIZER_DIR external/meshoptimizer )

msg_debug( "CMAKE_BUILD_TYPE : ${CMAKE_BUILD_TYPE}")
msg_debug( "CMAKE_C_FLAGS : ${CMAKE_C_FLAGS}" )
Expand Down
11 changes: 5 additions & 6 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"hidden": true,
"installDir": "${sourceDir}/package/Castor3D",
"cacheVariables": {
"ASHES_BUILD_RENDERER_OGL": false,
"CASTOR_BUILD_PLUGINS": true,
"CASTOR_BUILDGRP_DEMO": true,
"CASTOR_BUILDGRP_INTEROP": false,
Expand Down Expand Up @@ -82,20 +81,20 @@
{
"name": "ci-base",
"hidden": true,
"binaryDir": "${sourceDir}/build-Release",
"installDir": "${sourceDir}/package/Castor3D",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"ASHES_BUILD_RENDERER_OGL": false,
"SDW_GENERATE_SOURCE": false,
"CASTOR_BUILD_PLUGINS": true,
"CASTOR_BUILDGRP_DEMO": false,
"CASTOR_BUILDGRP_DEMO": true,
"CASTOR_BUILDGRP_INTEROP": false,
"CASTOR_BUILDGRP_TEST": false,
"CASTOR_BUILDGRP_TOOL": false,
"CASTOR_BUILDGRP_TOOL": true,
"CASTOR_DISABLE_DELAYED_INITIALISATION": true,
"CASTOR_FORCE_VCPKG_SUBMODULES": true,
"CASTOR_GUICOMMON_NEEDS_HLSL": true,
"CASTOR_USE_GLSLANG": true,
"CASTOR_USE_MESH_SHADERS": false,
"CASTOR_USE_TASK_SHADERS": false,
"PROJECTS_OUTPUT_DIR": "${sourceDir}",
"PROJECTS_UNITY_BUILD": true,
"PROJECTS_USE_PRECOMPILED_HEADERS": false
Expand Down
8 changes: 4 additions & 4 deletions data/vcpkg/ports/ashes/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO DragonJoker/Ashes
REF c532e8ff5b6f64150d24348ef40a02df4e692017
REF 51ad39a7c0b0b503d2c558c1bd8bcc2a8838bd07
HEAD_REF master
SHA512 1c5833ce898532b3ae87961743a921223e08bd80c25ef33155ee11c241f2eaca9047f2cfca8d2661bd3302d22acabc4cf13ccccd2f25a48c4ebc9976ad193c24
SHA512 96ceb03f0f9778c1ac436e4d553126fab4424817c1f56926e5bcd932969fb7e1cf6639b5de81a7c312f687371c2405bbe28a7c26150e6b18859a91cd5c77b103
)

vcpkg_from_github(
OUT_SOURCE_PATH CMAKE_SOURCE_PATH
REPO DragonJoker/CMakeUtils
REF 988f2aab2257175e8fb15a33a3a350ff92d25b89
REF 89a4c8fd4f0a464403676b6b1f1c5d178f6255b3
HEAD_REF master
SHA512 961370c110e77f67ed6f426d410335636ca3b5812ba1837662cc5fea403791cafa443c1a25144b92aed5edfc5928eb6e706883ea7f1e68de1123845cb89acb86
SHA512 98c46a563f2e4a28d9c91f4f255c500118dd0c66a4422d42969bdcc16c1493581db45b709fc3167e1ced8fa628d51880cb459df0d6b3dc013b945f66597ec768
)

file(REMOVE_RECURSE "${SOURCE_PATH}/CMake")
Expand Down
8 changes: 4 additions & 4 deletions data/vcpkg/ports/rendergraph/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH
REPO DragonJoker/RenderGraph
REF v${VERSION}
REF e9f6b3243095d832f409e15fbafff4f73af6e401
HEAD_REF master
SHA512 48bb3211022499538eebca0051f931ec105af9ccd3fea21d546fcd9cb41bc9d2191c70382e00caaf79fce48303e56d83d7089f7b975f635bcef3645c80abda30
SHA512 3609da52a6f5c5c213fcc56416cfc714403d0bc80742540990cab2973b2ee3e41e9629b04f379db84c2194acff6cecf11c4e86d4167ca78aa8606a85cbcaa433
)

vcpkg_from_github(OUT_SOURCE_PATH CMAKE_SOURCE_PATH
REPO DragonJoker/CMakeUtils
REF 7d355194fa795c437ce970cecf00e23ae10fc686
REF 3818effff171f863d0c23e6fbbf79911f03cc6d3
HEAD_REF master
SHA512 ca25b19bdeb3e8fda7abc32f8548731f0ba1cd09889a70f6f287ad76d2fdfa0fedbb7f6f65b26d356ea51543bed8926c6bb463f8e8461b7d51d3b7b33134374c
SHA512 3a13b371adf24f530fdef6005d3a9105185eca131c9b8aba68615a593f76d6aac2c3c7f0ecf6ce430e2b854afca4abd99f1400a1e6665478c9daa34a8dac6f5b
)

get_filename_component(SRC_PATH "${CMAKE_SOURCE_PATH}" DIRECTORY)
Expand Down
8 changes: 4 additions & 4 deletions data/vcpkg/ports/shaderwriter/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
vcpkg_from_github(OUT_SOURCE_PATH SOURCE_PATH
REPO DragonJoker/ShaderWriter
REF v${VERSION}
REF 6aa2e9bb7f51c80df3ebf5f3d7ea5936d87e671f
HEAD_REF development
SHA512 7e7d5fec16998bf99225e01a990fcb29612eee8f59e32fbb4e9650a0d69ffc658588380fdfd9374cc5492bd4eac5c9c6dadeb583129c649e5d792346a2d1a743
SHA512 04c9973c513ff4b912283d4db93e255455e2ed909fa1ebfc09759d39e79bd7e156abf65f5686a8ffa311f7441b9c802c8a346ec41b02eb4e42564b53431042b8
)

vcpkg_from_github(OUT_SOURCE_PATH CMAKE_SOURCE_PATH
REPO DragonJoker/CMakeUtils
REF 7d355194fa795c437ce970cecf00e23ae10fc686
REF 3818effff171f863d0c23e6fbbf79911f03cc6d3
HEAD_REF master
SHA512 ca25b19bdeb3e8fda7abc32f8548731f0ba1cd09889a70f6f287ad76d2fdfa0fedbb7f6f65b26d356ea51543bed8926c6bb463f8e8461b7d51d3b7b33134374c
SHA512 3a13b371adf24f530fdef6005d3a9105185eca131c9b8aba68615a593f76d6aac2c3c7f0ecf6ce430e2b854afca4abd99f1400a1e6665478c9daa34a8dac6f5b
)

file(REMOVE_RECURSE "${SOURCE_PATH}/CMake")
Expand Down
33 changes: 17 additions & 16 deletions demos/CastorDvpTD/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace castortd
MainFrame::MainFrame()
: wxFrame{ nullptr, wxID_ANY, ApplicationName, wxDefaultPosition, main::MainFrameSize, wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN | wxRESIZE_BORDER | wxMAXIMIZE_BOX }
{
SetClientSize( main::MainFrameSize );
SetClientSize( FromDIP( main::MainFrameSize ) );
Show( true );

try
Expand All @@ -61,43 +61,38 @@ namespace castortd
void MainFrame::doLoadScene()
{
auto & engine = *wxGetApp().getCastor();
auto target = GuiCommon::loadScene( engine
auto window = GuiCommon::loadScene( engine
, "CastorDvpTD"
, castor::File::getExecutableDirectory().getPath() / cuT( "share" ) / cuT( "CastorDvpTD" ) / cuT( "Data.zip" )
, nullptr );
castor::Logger::logInfo( cuT( "Scene file read" ) );

if ( target )
if ( auto target = window.renderTarget )
{
m_game = std::make_unique< Game >( *target->getScene() );
m_panel = wxMakeWindowPtr< RenderPanel >( this, main::MainFrameSize, *m_game );
m_panel->setRenderTarget( target );
auto & window = m_panel->getRenderWindow();
m_panel->updateRenderWindow( window );
auto & renderWindow = m_panel->getRenderWindow();

if ( window.isFullscreen() )
if ( renderWindow.isFullscreen() )
{
ShowFullScreen( true, wxFULLSCREEN_ALL );
}

auto size = FromDIP( GuiCommon::make_wxSize( renderWindow.getSize() ) );

if ( !IsMaximized() )
{
SetClientSize( int( window.getSize().getWidth() )
, int( window.getSize().getHeight() ) );
SetClientSize( size );
}
else
{
Maximize( false );
SetClientSize( int( window.getSize().getWidth() )
, int( window.getSize().getHeight() ) );
SetClientSize( size );
Maximize();
}

castor::Logger::logInfo( cuT( "Scene file read" ) );

#if wxCHECK_VERSION( 2, 9, 0 )

wxSize size = GetClientSize();
SetMinClientSize( size );

#endif

if ( engine.isThreaded() )
Expand All @@ -114,6 +109,12 @@ namespace castortd
m_timer = new wxTimer( this, main::eID_RENDER_TIMER );
m_timer->Start( 1000 / int( engine.getRenderLoop().getWantedFps() ), true );
}

castor::Logger::logInfo( cuT( "Initialised render panel." ) );
}
else
{
castor::Logger::logWarning( cuT( "No render target found in the scene" ) );
}
}

Expand Down
15 changes: 7 additions & 8 deletions demos/CastorDvpTD/RenderPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,18 @@ namespace castortd
m_renderWindow->cleanup();
}

void RenderPanel::setRenderTarget( castor3d::RenderTargetRPtr target )
void RenderPanel::updateRenderWindow( castor3d::RenderWindowDesc const & window )
{
if ( target )
if ( auto target = window.renderTarget )
{
m_renderWindow->initialise( *target );
m_renderWindow->initialise( window );

castor::Size sizeWnd = GuiCommon::makeSize( GetClientSize() );
auto sizeWnd = FromDIP( GetClientSize() );
castor::Size sizeScreen;
castor::System::getScreenSize( 0, sizeScreen );
GetParent()->SetClientSize( int( sizeWnd.getWidth() ), int( sizeWnd.getHeight() ) );
sizeWnd = GuiCommon::makeSize( GetParent()->GetClientSize() );
GetParent()->SetPosition( wxPoint( std::abs( int( sizeScreen.getWidth() ) - int( sizeWnd.getWidth() ) ) / 2
, std::abs( int( sizeScreen.getHeight() ) - int( sizeWnd.getHeight() ) ) / 2 ) );
GetParent()->SetClientSize( sizeWnd );
GetParent()->SetPosition( FromDIP( wxPoint( std::max( 0, int( sizeScreen.getWidth() ) - sizeWnd.GetWidth() ) / 2
, std::max( 0, int( sizeScreen.getHeight() ) - sizeWnd.GetHeight() ) / 2 ) ) );
castor3d::SceneRPtr scene = target->getScene();

if ( scene )
Expand Down
2 changes: 1 addition & 1 deletion demos/CastorDvpTD/RenderPanel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace castortd
~RenderPanel()override;

void reset();
void setRenderTarget( castor3d::RenderTargetRPtr target );
void updateRenderWindow( castor3d::RenderWindowDesc const & window );

castor3d::RenderWindow const & getRenderWindow()const
{
Expand Down
Loading