├── Source ├── Editor │ ├── console.cpp │ ├── console.h │ ├── menubar.h │ ├── mainwindow.h │ ├── main.cpp │ ├── menubar.cpp │ ├── mainwindow.cpp │ ├── directorytreeviewer.h │ ├── renderconfigurator.h │ ├── directoryviewer.h │ ├── icomponentpropertyeditor.h │ ├── directorylistviewer.h │ ├── viewport.h │ ├── adjustlabel.h │ ├── combolabeltext.h │ ├── propertyeditor.h │ ├── directorytreeviewer.cpp │ ├── transformcomponentpropertyeditor.h │ ├── materialcomponentpropertyeditor.h │ ├── cameracomponentpropertyeditor.h │ └── worldexplorer.h ├── Engine │ ├── Common │ │ ├── STL17.h │ │ ├── Randomizer.h │ │ ├── CMakeLists.txt │ │ ├── Template.h │ │ ├── Config.h.in │ │ ├── ComponentHeaders.h │ │ ├── Randomizer.cpp │ │ ├── Memory.h │ │ ├── STL14.h │ │ ├── LogServiceSpecialization.h │ │ ├── Object.h │ │ ├── Metadata.h │ │ ├── Thread.h │ │ └── Timer.h │ ├── ThirdParty │ │ ├── STBWrapper │ │ │ ├── stb_image_write.cpp │ │ │ ├── stb_image.cpp │ │ │ ├── CMakeLists.txt │ │ │ └── STBWrapper.h │ │ ├── AssimpWrapper │ │ │ ├── AssimpWrapper.h │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── ImGuiWrapper │ │ │ ├── IImGuiWindow.h │ │ │ ├── ImGuiWindowMac.h │ │ │ ├── ImGuiWindowLinux.h │ │ │ ├── ImGuiWindowWin.h │ │ │ ├── ImGuiWrapper.h │ │ │ ├── ImGuiRendererGL.h │ │ │ ├── ImGuiRendererDX11.h │ │ │ ├── ImGuiRendererMT.h │ │ │ ├── IImGuiRenderer.h │ │ │ ├── ImGuiRendererVK.h │ │ │ ├── ImGuiRendererDX12.h │ │ │ ├── ImGuiWindowMac.cpp │ │ │ ├── ImGuiWindowLinux.cpp │ │ │ └── ImGuiRendererVK.cpp │ │ ├── JSONWrapper │ │ │ ├── CMakeLists.txt │ │ │ └── JSONWrapper.h │ │ ├── PhysXWrapper │ │ │ ├── CMakeLists.txt │ │ │ └── PhysXWrapper.h │ │ └── ImGui │ │ │ └── CMakeLists.txt │ ├── Component │ │ ├── MTGPUBufferComponent.h │ │ ├── MTTextureComponent.h │ │ ├── MTMaterialComponent.h │ │ ├── MTShaderProgramComponent.h │ │ ├── MTMeshComponent.h │ │ ├── DX12MaterialComponent.h │ │ ├── MTRenderPassComponent.h │ │ ├── DX12SamplerComponent.h │ │ ├── VKSamplerComponent.h │ │ ├── VKMaterialComponent.h │ │ ├── VKMeshComponent.h │ │ ├── VKGPUBufferComponent.h │ │ ├── DX12TextureComponent.h │ │ ├── GPUResourceComponent.h │ │ ├── TextureComponent.h │ │ ├── SkeletonComponent.h │ │ ├── AnimationComponent.h │ │ ├── DX12MeshComponent.h │ │ ├── GPUBufferComponent.h │ │ ├── MeshComponent.h │ │ ├── MaterialComponent.h │ │ ├── CollisionComponent.h │ │ ├── VKTextureComponent.h │ │ ├── ModelComponent.h │ │ ├── ShaderProgramComponent.h │ │ ├── VKShaderProgramComponent.h │ │ ├── SamplerComponent.h │ │ ├── TransformComponent.h │ │ ├── RenderPassComponent.h │ │ ├── DX12ShaderProgramComponent.h │ │ ├── CameraComponent.h │ │ └── LightComponent.h │ ├── RenderingServer │ │ ├── MT │ │ │ ├── CMakeLists.txt │ │ │ └── MTRenderingServerBridge.h │ │ ├── Headless │ │ │ └── CMakeLists.txt │ │ ├── Common │ │ │ └── CMakeLists.txt │ │ ├── VK │ │ │ ├── VKHelper_Common.h │ │ │ ├── CMakeLists.txt │ │ │ ├── VKHeaders.h │ │ │ ├── VKHelper_Pipeline.h │ │ │ └── VKHelper_Texture.h │ │ ├── CMakeLists.txt │ │ ├── DX12 │ │ │ ├── CMakeLists.txt │ │ │ └── DX12Helper_Common.h │ │ └── CommonFunctionDefinationMacro.inl │ ├── Interface │ │ ├── IWindowSurface.h │ │ ├── ILogicClient.h │ │ ├── IRenderingClient.h │ │ ├── ISystem.h │ │ └── IRenderPass.h │ ├── Platform │ │ ├── HeadlessWindow │ │ │ ├── CMakeLists.txt │ │ │ └── HeadlessWindowSystem.h │ │ ├── WinWindow │ │ │ ├── DXWindowSurface │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── WinDXWindowSurface.h │ │ │ │ └── WinDXWindowSurface.cpp │ │ │ ├── VKWindowSurface │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── WinVKWindowSurface.h │ │ │ └── CMakeLists.txt │ │ ├── MacWindow │ │ │ ├── CMakeLists.txt │ │ │ ├── MacWindowSystemBridge.h │ │ │ └── MacWindowSystem.h │ │ ├── LinuxWindow │ │ │ ├── CMakeLists.txt │ │ │ └── LinuxWindowSystem.h │ │ ├── MacMain │ │ │ ├── MacWindow.m │ │ │ ├── NSApplication.h │ │ │ ├── CMakeLists.txt │ │ │ ├── MacWindow.h │ │ │ ├── MetalDelegate.h │ │ │ ├── MacWindowDelegate.h │ │ │ ├── MacMain.m │ │ │ ├── MacWindowSystemBridgeImpl.h │ │ │ └── MTRenderingServerBridgeImpl.h │ │ ├── WinMain │ │ │ ├── CMakeLists.txt │ │ │ └── WinMain.cpp │ │ ├── LinuxMain │ │ │ ├── CMakeLists.txt │ │ │ └── LinuxMain.cpp │ │ └── CMakeLists.txt │ ├── RayTracer │ │ ├── CMakeLists.txt │ │ ├── IRayTracer.h │ │ └── RayTracer.h │ └── Services │ │ ├── CullingResult.h │ │ ├── GUISystem.h │ │ ├── LightSystem.h │ │ ├── TransformSystem.h │ │ ├── CMakeLists.txt │ │ ├── EntityManager.h │ │ ├── CameraSystem.h │ │ ├── PhysicsSimulationService.h │ │ ├── BVHService.h │ │ ├── GUISystem.cpp │ │ └── TemplateAssetService.h ├── Test │ ├── ConcurrencyTests │ │ └── TaskSystemTests.h │ ├── StressTests │ │ └── TaskSystemStressTests.cpp │ ├── Common │ │ ├── TestTimer.cpp │ │ ├── TestRunner.h │ │ ├── TestData.cpp │ │ ├── TestData.h │ │ └── TestTimer.h │ ├── CMakeLists.txt │ └── PerformanceTests │ │ └── StringConversionPerf.cpp ├── Tool │ ├── CMakeLists.txt │ ├── Baker │ │ ├── Common.h │ │ ├── CMakeLists.txt │ │ ├── Serializer.h │ │ ├── SurfelGenerator.h │ │ ├── BrickGenerator.h │ │ └── ProbeGenerator.h │ ├── GLSLParser │ │ └── CMakeLists.txt │ └── Reflector │ │ └── CMakeLists.txt └── Client │ ├── ClientMetadata.h │ ├── ClientMetadata.h.in │ ├── CMakeLists.txt │ ├── RenderingClient │ ├── CMakeLists.txt │ ├── VolumetricPass.h │ ├── GIResolvePass.h │ ├── GIDataLoader.h │ ├── DefaultRenderingClient.h │ ├── BRDFLUTMSPass.h │ ├── SkyPass.h │ ├── BRDFLUTPass.h │ ├── PreTAAPass.h │ ├── SunShadowBlurEvenPass.h │ ├── SunShadowBlurOddPass.h │ ├── OpaquePass.h │ ├── VXGIGeometryProcessPass.h │ ├── LuminanceAveragePass.h │ ├── BillboardPass.h │ ├── RadianceCacheRaytracingPass.h │ ├── TransparentBlendPass.h │ ├── MotionBlurPass.h │ ├── AnimationPass.h │ ├── VXGIVisualizationPass.h │ ├── PostTAAPass.h │ ├── FinalBlendPass.h │ ├── LuminanceHistogramPass.h │ ├── VXGIScreenSpaceFeedbackPass.h │ ├── RadianceCacheIntegrationPass.h │ ├── SunShadowGeometryProcessPass.h │ ├── LightPass.h │ ├── BSDFTestPass.h │ ├── VXGILightPass.h │ ├── VXGIMultiBouncePass.h │ ├── TAAPass.h │ ├── VXGIConvertPass.h │ ├── SSAOPass.h │ ├── TiledFrustumGenerationPass.h │ ├── SurfelGITestPass.h │ ├── TransparentGeometryProcessPass.h │ ├── VXGIRayTracingPass.h │ └── RadianceCacheFilterPass.h │ └── LogicClient │ ├── CMakeLists.txt │ ├── DefaultLogicClient.h │ └── DefaultLogicClient.cpp ├── Scripts ├── StartEngineLinux.sh ├── StartEngineMac.sh ├── CleanRepo.sh ├── StartEngineWin.ps1 ├── GenerateMetadataWin.ps1 ├── PostBuildWin.ps1 ├── SPIR-V2HLSL.bat ├── CleanRepo.bat ├── PostBuildMac.sh ├── CleanGitSubmodules.bat ├── ai-quick-test.sh ├── HLSL2SPIR-V.ps1 ├── ai-main.sh ├── ai-test.sh ├── BakeScene.ps1 └── ai-build.sh ├── ScreenCapture.jpg └── Res ├── Shaders ├── HLSL │ ├── RadianceCacheAnyHit.hlsl │ ├── 2DImageProcess.vert │ ├── common │ │ ├── dummyInputLayout.hlsl │ │ └── CBuffers.hlsl │ ├── WIP │ │ ├── GIBakeBrickFactorPass.vert │ │ ├── GIBakeProbePass.frag │ │ ├── voxelVisualizationPass.frag │ │ ├── GIBakeSurfelPass.vert │ │ ├── voxelGeometryProcessPass.vert │ │ ├── GIBakeBrickFactorPass.frag │ │ ├── GIBakeProbePass.vert │ │ ├── debugPass.frag │ │ ├── volumetricVisualizationPass.vert │ │ ├── transparentGeometryProcessPass.vert │ │ ├── billboardPass.frag │ │ ├── debugPass.vert │ │ ├── volumetricVisualizationPass.frag │ │ ├── GIResolveTestProbePass.vert │ │ ├── voxelVisualizationPass.vert │ │ ├── GIBakeBrickFactorPass.geom │ │ ├── GIBakeSurfelPass.geom │ │ ├── GIResolveSkyIrradiancePass.comp │ │ ├── billboardPass.vert │ │ ├── voxelLightPass.comp │ │ ├── volumetricGeometryProcessPass.vert │ │ └── volumetricGeometryProcessPass.frag │ ├── swapChain.frag │ ├── mipmapGenerator2D.comp │ ├── mipmapGenerator3D.comp │ ├── sunShadowGeometryProcessPass.vert │ ├── RadianceCacheMiss.hlsl │ ├── RayTracingCommon.hlsl │ ├── postTAAPass.comp │ ├── sunShadowGeometryProcessPass.geom │ ├── preTAAPass.comp │ └── opaqueGeometryProcessPass.vert └── MSL │ └── library.metal └── ModelPresets ├── Building1.InnoModel ├── Building2.InnoModel ├── Building3.InnoModel └── Building4.InnoModel /Source/Editor/console.cpp: -------------------------------------------------------------------------------- 1 | #include "console.h" 2 | 3 | Console::Console() 4 | { 5 | } -------------------------------------------------------------------------------- /Scripts/StartEngineLinux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ../Bin 3 | ./InnoMain "-renderer 0 -mode 0" 4 | -------------------------------------------------------------------------------- /ScreenCapture.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangdoa/InnocenceEngine/HEAD/ScreenCapture.jpg -------------------------------------------------------------------------------- /Scripts/StartEngineMac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ../Bin 3 | open -a InnoMain --args "-renderer 4 -mode 0" 4 | -------------------------------------------------------------------------------- /Source/Engine/Common/STL17.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include -------------------------------------------------------------------------------- /Source/Test/ConcurrencyTests/TaskSystemTests.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | void RunTaskSystemTests(); 4 | -------------------------------------------------------------------------------- /Scripts/CleanRepo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ../ 3 | rm -rf Bin 4 | rm -rf Build 5 | rm -rf Source/Engine/Common/Config.h 6 | -------------------------------------------------------------------------------- /Source/Tool/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(GLSLParser) 2 | add_subdirectory(Baker) 3 | add_subdirectory(Reflector) -------------------------------------------------------------------------------- /Scripts/StartEngineWin.ps1: -------------------------------------------------------------------------------- 1 | Set-Location ..\Bin 2 | Start-Process RelWithDebInfo/Main.exe -ArgumentList "-renderer 0 -mode 0" 3 | -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/STBWrapper/stb_image_write.cpp: -------------------------------------------------------------------------------- 1 | #define STB_IMAGE_WRITE_IMPLEMENTATION 2 | #include "stb_image_write.h" -------------------------------------------------------------------------------- /Source/Client/ClientMetadata.h: -------------------------------------------------------------------------------- 1 | #define INNO_LOGIC_CLIENT DefaultLogicClient 2 | #define INNO_RENDERING_CLIENT DefaultRenderingClient 3 | -------------------------------------------------------------------------------- /Scripts/GenerateMetadataWin.ps1: -------------------------------------------------------------------------------- 1 | Get-ChildItem -Recurse -Path ..\Source\Engine -Include *.h | ForEach-Object {..\Bin\Debug\Reflector.exe $_.FullName} -------------------------------------------------------------------------------- /Source/Client/ClientMetadata.h.in: -------------------------------------------------------------------------------- 1 | #cmakedefine INNO_LOGIC_CLIENT @INNO_LOGIC_CLIENT@ 2 | #cmakedefine INNO_RENDERING_CLIENT @INNO_RENDERING_CLIENT@ -------------------------------------------------------------------------------- /Scripts/PostBuildWin.ps1: -------------------------------------------------------------------------------- 1 | xcopy /s/e/y ..\Source\External\DLL\Win\Debug\* ..\Bin\Debug\ 2 | xcopy /s/e/y ..\Source\External\DLL\Win\Release\* ..\Bin\Release\ -------------------------------------------------------------------------------- /Scripts/SPIR-V2HLSL.bat: -------------------------------------------------------------------------------- 1 | mkdir ..\Res\Shaders\Converted 2 | cd ../Res/Shaders/Converted 3 | del /S /Q *.* 4 | 5 | cd ../SPIRV 6 | for %%i in (*) do spirv-cross.exe %%i --hlsl --output ../Converted/%%~i 7 | pause -------------------------------------------------------------------------------- /Source/Editor/console.h: -------------------------------------------------------------------------------- 1 | #ifndef INNOCONSOLE_H 2 | #define INNOCONSOLE_H 3 | #include 4 | 5 | class Console : public QTextEdit 6 | { 7 | public: 8 | Console(); 9 | }; 10 | 11 | #endif // INNOCONSOLE_H 12 | -------------------------------------------------------------------------------- /Source/Engine/Component/MTGPUBufferComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GPUBufferComponent.h" 3 | 4 | namespace Inno 5 | { 6 | class MTGPUBufferComponent : public GPUBufferComponent 7 | { 8 | public: 9 | }; 10 | } -------------------------------------------------------------------------------- /Source/Engine/Component/MTTextureComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "TextureComponent.h" 3 | 4 | namespace Inno 5 | { 6 | class MTTextureComponent : public TextureComponent 7 | { 8 | public: 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /Source/Engine/Component/MTMaterialComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "MaterialComponent.h" 3 | 4 | namespace Inno 5 | { 6 | class MTMaterialComponent : public MaterialComponent 7 | { 8 | public: 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/AssimpWrapper/AssimpWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Inno 4 | { 5 | namespace AssimpWrapper 6 | { 7 | bool ConvertModel(const char* fileName, const char* exportPath); 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /Scripts/CleanRepo.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | cd ../ 4 | echo "Removing local generated files..." 5 | rd /s /q Bin 6 | rd /s /q Build 7 | rd /s /q Source\Editor\Build 8 | del /s /q Source\Engine\Common\Config.h 9 | 10 | echo "Done!" -------------------------------------------------------------------------------- /Res/Shaders/HLSL/RadianceCacheAnyHit.hlsl: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "RayTracingBindings.hlsl" 3 | 4 | [shader("anyhit")] 5 | void AnyHitShader(inout RayPayload payload, in BuiltInTriangleIntersectionAttributes attrib) 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /Source/Client/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file ("${CMAKE_SOURCE_DIR}/Source/Client/ClientMetadata.h.in" "${CMAKE_SOURCE_DIR}/Source/Client/ClientMetadata.h" @ONLY) 2 | 3 | add_subdirectory("RenderingClient") 4 | add_subdirectory("LogicClient") -------------------------------------------------------------------------------- /Source/Client/RenderingClient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | 4 | add_library(${INNO_RENDERING_CLIENT} ${HEADERS} ${SOURCES}) 5 | set_target_properties(${INNO_RENDERING_CLIENT} PROPERTIES FOLDER Client) -------------------------------------------------------------------------------- /Source/Engine/Common/Randomizer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/STL14.h" 3 | 4 | namespace Inno 5 | { 6 | class Randomizer 7 | { 8 | public: 9 | static bool Setup(); 10 | 11 | static uint64_t GenerateUUID(); 12 | }; 13 | } -------------------------------------------------------------------------------- /Source/Engine/Component/MTShaderProgramComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ShaderProgramComponent.h" 3 | 4 | namespace Inno 5 | { 6 | class MTShaderProgramComponent : public ShaderProgramComponent 7 | { 8 | public: 9 | }; 10 | } -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/MT/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(MTRenderingServer ${HEADERS} ${SOURCES}) 4 | set_target_properties(MTRenderingServer PROPERTIES FOLDER Engine/RenderingServer) -------------------------------------------------------------------------------- /Source/Engine/Interface/IWindowSurface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ISystem.h" 3 | 4 | namespace Inno 5 | { 6 | class IWindowSurface : public ISystem 7 | { 8 | public: 9 | INNO_CLASS_INTERFACE_NON_COPYABLE(IWindowSurface); 10 | }; 11 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/HeadlessWindow/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(HeadlessWindowSystem ${HEADERS} ${SOURCES}) 4 | set_target_properties(HeadlessWindowSystem PROPERTIES FOLDER Engine/Window) 5 | -------------------------------------------------------------------------------- /Source/Engine/Platform/WinWindow/DXWindowSurface/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(WinDXWindowSurface ${HEADERS} ${SOURCES}) 4 | set_target_properties(WinDXWindowSurface PROPERTIES FOLDER Engine/Window) -------------------------------------------------------------------------------- /Source/Test/StressTests/TaskSystemStressTests.cpp: -------------------------------------------------------------------------------- 1 | #include "../ConcurrencyTests/TaskSystemTests.h" 2 | 3 | // Implementation of stress test function declared in TestRunner.cpp 4 | void RunTaskSystemStressTests() 5 | { 6 | RunTaskSystemTests(); 7 | } 8 | -------------------------------------------------------------------------------- /Source/Engine/Component/MTMeshComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "MeshComponent.h" 3 | 4 | namespace Inno 5 | { 6 | class MTMeshComponent : public MeshComponent 7 | { 8 | public: 9 | void* m_VBO = 0; 10 | void* m_IBO = 0; 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /Source/Engine/Platform/MacWindow/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | aux_source_directory(. DIR_SRCS) 2 | add_library(MacWindow ${DIR_SRCS}) 3 | set_property(TARGET MacWindow PROPERTY POSITION_INDEPENDENT_CODE ON) 4 | set_target_properties(MacWindow PROPERTIES FOLDER Engine/Window) -------------------------------------------------------------------------------- /Source/Engine/Platform/LinuxWindow/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | aux_source_directory(. DIR_SRCS) 2 | add_library(LinuxWindow ${DIR_SRCS}) 3 | set_property(TARGET LinuxWindow PROPERTY POSITION_INDEPENDENT_CODE ON) 4 | set_target_properties(LinuxWindow PROPERTIES FOLDER Engine/Window) -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/Headless/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(HeadlessRenderingServer ${HEADERS} ${SOURCES}) 4 | set_target_properties(HeadlessRenderingServer PROPERTIES FOLDER Engine/RenderingServer) 5 | -------------------------------------------------------------------------------- /Source/Engine/Common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(Common ${HEADERS} ${SOURCES}) 4 | set_property(TARGET Common PROPERTY POSITION_INDEPENDENT_CODE ON) 5 | set_target_properties(Common PROPERTIES FOLDER Engine) 6 | -------------------------------------------------------------------------------- /Source/Engine/Component/DX12MaterialComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "MaterialComponent.h" 3 | #include "../RenderingServer/DX12/DX12Headers.h" 4 | 5 | namespace Inno 6 | { 7 | class DX12MaterialComponent : public MaterialComponent 8 | { 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /Source/Engine/RayTracer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(RayTracer ${HEADERS} ${SOURCES}) 4 | set_property(TARGET RayTracer PROPERTY POSITION_INDEPENDENT_CODE ON) 5 | set_target_properties(RayTracer PROPERTIES FOLDER Engine) -------------------------------------------------------------------------------- /Source/Client/LogicClient/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | 4 | add_library(${INNO_LOGIC_CLIENT} ${HEADERS} ${SOURCES}) 5 | set_target_properties(${INNO_LOGIC_CLIENT} PROPERTIES FOLDER Client) 6 | target_link_libraries(${INNO_LOGIC_CLIENT} Engine) -------------------------------------------------------------------------------- /Source/Engine/Platform/MacMain/MacWindow.m: -------------------------------------------------------------------------------- 1 | // 2 | // MacWindow.m 3 | // Main 4 | // 5 | // Created by zhangdoa on 11/06/2019. 6 | // Copyright © 2019 InnocenceEngine. All rights reserved. 7 | // 8 | 9 | #import "MacWindow.h" 10 | 11 | @implementation MacWindow 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Source/Engine/Component/MTRenderPassComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "TextureComponent.h" 3 | #include "MTTextureComponent.h" 4 | 5 | namespace Inno 6 | { 7 | class MTRenderPassComponent 8 | { 9 | public: 10 | std::vector m_MTTextureComps; 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory("JSONWrapper") 2 | add_subdirectory("AssimpWrapper") 3 | add_subdirectory("STBWrapper") 4 | add_subdirectory("ImGui") 5 | add_subdirectory("ImGuiWrapper") 6 | if (INNO_PLATFORM_WIN) 7 | add_subdirectory("PhysXWrapper") 8 | endif (INNO_PLATFORM_WIN) -------------------------------------------------------------------------------- /Source/Engine/Component/DX12SamplerComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "SamplerComponent.h" 3 | #include "../RenderingServer/DX12/DX12Headers.h" 4 | 5 | namespace Inno 6 | { 7 | class DX12SamplerComponent : public SamplerComponent 8 | { 9 | public: 10 | DX12Sampler m_Sampler = {}; 11 | }; 12 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/IImGuiWindow.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Interface/ISystem.h" 3 | 4 | namespace Inno 5 | { 6 | class IImGuiWindow : public ISystem 7 | { 8 | public: 9 | INNO_CLASS_INTERFACE_NON_COPYABLE(IImGuiWindow); 10 | 11 | virtual bool NewFrame() = 0; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /Source/Engine/Common/Template.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "STL14.h" 3 | 4 | namespace Inno 5 | { 6 | template 7 | using EnableType = typename std::enable_if::type; 8 | 9 | template 10 | using DisableType = typename std::enable_if::type; 11 | } -------------------------------------------------------------------------------- /Source/Engine/RayTracer/IRayTracer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Interface/ISystem.h" 3 | 4 | #include "../Common/ClassTemplate.h" 5 | 6 | namespace Inno 7 | { 8 | class IRayTracer : public ISystem 9 | { 10 | public: 11 | INNO_CLASS_INTERFACE_NON_COPYABLE(IRayTracer); 12 | 13 | virtual bool Execute() = 0; 14 | }; 15 | } -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/Common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(RenderingServerCommon ${HEADERS} ${SOURCES}) 4 | set_property(TARGET RenderingServerCommon PROPERTY POSITION_INDEPENDENT_CODE ON) 5 | set_target_properties(RenderingServerCommon PROPERTIES FOLDER Engine/RenderingServer) -------------------------------------------------------------------------------- /Source/Engine/Component/VKSamplerComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "SamplerComponent.h" 3 | #include "../RenderingServer/VK/VKHeaders.h" 4 | 5 | namespace Inno 6 | { 7 | class VKSamplerComponent : public SamplerComponent 8 | { 9 | public: 10 | VkSamplerCreateInfo m_samplerCInfo = {}; 11 | VkSampler m_sampler; 12 | }; 13 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/STBWrapper/stb_image.cpp: -------------------------------------------------------------------------------- 1 | #include "../../Common/Memory.h" 2 | #define STBI_MALLOC(sz) Inno::Memory::Allocate(sz) 3 | #define STBI_REALLOC(p,newsz) Inno::Memory::Reallocate(p,newsz) 4 | #define STBI_FREE(p) Inno::Memory::Deallocate(p) 5 | #define STB_IMAGE_IMPLEMENTATION 6 | #include "stb_image.h" -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/STBWrapper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | aux_source_directory(. DIR_SRCS) 2 | add_library(STBWrapper ${DIR_SRCS}) 3 | set_property(TARGET STBWrapper PROPERTY POSITION_INDEPENDENT_CODE ON) 4 | set_target_properties(STBWrapper PROPERTIES FOLDER ThirdParty) 5 | target_include_directories(STBWrapper PRIVATE "${INNO_GITSUBMODULE_DIRECTORIES}/stb") -------------------------------------------------------------------------------- /Source/Engine/Interface/ILogicClient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ISystem.h" 3 | #include "../Common/ComponentHeaders.h" 4 | 5 | namespace Inno 6 | { 7 | class ILogicClient : public ISystem 8 | { 9 | public: 10 | INNO_CLASS_INTERFACE_NON_COPYABLE(ILogicClient); 11 | 12 | virtual const char* GetApplicationName() = 0; 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/STBWrapper/STBWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Component/ModelComponent.h" 3 | 4 | namespace Inno 5 | { 6 | namespace STBWrapper 7 | { 8 | TextureComponent* LoadTexture(const char* fileName); 9 | bool SaveTexture(const char* fileName, const TextureDesc& textureDesc, void* textureData); 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /Source/Engine/Platform/WinMain/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(Main WIN32 WinMain.cpp) 2 | set_target_properties(Main PROPERTIES FOLDER Engine/Main) 3 | 4 | if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") 5 | set_target_properties(Main PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") 6 | endif() 7 | 8 | target_link_libraries(Main Engine) -------------------------------------------------------------------------------- /Source/Engine/Common/Config.h.in: -------------------------------------------------------------------------------- 1 | #cmakedefine INNO_DEBUG 2 | #cmakedefine INNO_RELEASE 3 | 4 | #cmakedefine INNO_PLATFORM_WIN 5 | #cmakedefine INNO_PLATFORM_LINUX 6 | #cmakedefine INNO_PLATFORM_MAC 7 | 8 | #cmakedefine INNO_RENDERER_DIRECTX 9 | #cmakedefine INNO_RENDERER_OPENGL 10 | #cmakedefine INNO_RENDERER_VULKAN 11 | #cmakedefine INNO_RENDERER_METAL -------------------------------------------------------------------------------- /Source/Engine/Platform/LinuxMain/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(Main LinuxMain.cpp) 2 | set_target_properties(Main PROPERTIES FOLDER Engine/ApplicationEntry) 3 | target_link_libraries(Main ApplicationEntry) 4 | 5 | add_custom_target(run 6 | COMMAND Main "-renderer 0 -mode 0" 7 | DEPENDS Main 8 | WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} 9 | ) -------------------------------------------------------------------------------- /Source/Engine/Platform/WinWindow/VKWindowSurface/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(WinVKWindowSurface ${HEADERS} ${SOURCES}) 4 | set_target_properties(WinVKWindowSurface PROPERTIES FOLDER Engine/Window) 5 | target_include_directories(WinVKWindowSurface PRIVATE "${INNO_GITSUBMODULE_DIRECTORIES}/Vulkan-Headers/include") -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/JSONWrapper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | aux_source_directory(. DIR_SRCS) 2 | add_library(JSONWrapper ${DIR_SRCS}) 3 | set_property(TARGET JSONWrapper PROPERTY POSITION_INDEPENDENT_CODE ON) 4 | set_target_properties(JSONWrapper PROPERTIES FOLDER ThirdParty) 5 | target_include_directories(JSONWrapper PRIVATE "${INNO_GITSUBMODULE_DIRECTORIES}/json/include") 6 | -------------------------------------------------------------------------------- /Source/Engine/Component/VKMaterialComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "MaterialComponent.h" 3 | #include "../RenderingServer/VK/VKHeaders.h" 4 | 5 | namespace Inno 6 | { 7 | class VKMaterialComponent : public MaterialComponent 8 | { 9 | public: 10 | VkDescriptorSet m_descriptorSet; 11 | std::vector m_writeDescriptorSets; 12 | }; 13 | } -------------------------------------------------------------------------------- /Source/Engine/Component/VKMeshComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "MeshComponent.h" 3 | #include "../RenderingServer/VK/VKHeaders.h" 4 | 5 | namespace Inno 6 | { 7 | class VKMeshComponent : public MeshComponent 8 | { 9 | public: 10 | VkBuffer m_VBO; 11 | VkBuffer m_IBO; 12 | VkDeviceMemory m_VBMemory; 13 | VkDeviceMemory m_IBMemory; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /Source/Engine/Services/CullingResult.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Component/CollisionComponent.h" 3 | #include "../Common/GPUDataStructure.h" 4 | 5 | namespace Inno 6 | { 7 | struct CullingResult 8 | { 9 | CollisionComponent* m_CollisionComponent = nullptr; 10 | VisibilityMask m_VisibilityMask = VisibilityMask::Invalid; 11 | }; 12 | } -------------------------------------------------------------------------------- /Source/Editor/menubar.h: -------------------------------------------------------------------------------- 1 | #ifndef INNOMENUBAR_H 2 | #define INNOMENUBAR_H 3 | 4 | #include 5 | class MenuBar : public QMenuBar 6 | { 7 | Q_OBJECT 8 | public: 9 | MenuBar(QWidget *parent = nullptr); 10 | 11 | private: 12 | QMenu* m_fileMenu; 13 | 14 | private slots: 15 | void openScene(); 16 | void saveScene(); 17 | }; 18 | 19 | #endif // INNOMENUBAR_H 20 | -------------------------------------------------------------------------------- /Source/Tool/Baker/Common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Common/GPUDataStructure.h" 3 | 4 | namespace Inno 5 | { 6 | struct BrickCache 7 | { 8 | Vec4 pos; 9 | std::vector surfelCaches; 10 | }; 11 | 12 | struct BrickCacheSummary 13 | { 14 | Vec4 pos; 15 | size_t fileIndex; 16 | size_t fileSize; 17 | }; 18 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/LinuxMain/LinuxMain.cpp: -------------------------------------------------------------------------------- 1 | #include "../ApplicationEntry/ApplicationEntry.h" 2 | 3 | int32_t main(int32_t argc, char* argv[]) 4 | { 5 | if (!ApplicationEntry::Setup(nullptr, nullptr, argv[1])) 6 | { 7 | return 0; 8 | } 9 | if (!ApplicationEntry::Initialize()) 10 | { 11 | return 0; 12 | } 13 | ApplicationEntry::Run(); 14 | ApplicationEntry::Terminate(); 15 | 16 | return 0; 17 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/2DImageProcess.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct PixelInputType 5 | { 6 | float4 position : SV_POSITION; 7 | float2 texCoord : TEXCOORD0; 8 | }; 9 | 10 | PixelInputType main(VertexInputType input) 11 | { 12 | PixelInputType output; 13 | 14 | output.position = float4(input.posLS, 1.0f); 15 | output.texCoord = input.texCoord; 16 | 17 | return output; 18 | } -------------------------------------------------------------------------------- /Scripts/PostBuildMac.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd ../ 3 | # copy binary 4 | rm -rf Bin 5 | mkdir Bin 6 | cp -r Build/Lib/* Build/InnoMain/Debug/ 7 | cp -r Build/InnoMain/Debug/* Bin/ 8 | 9 | # copy for sandbox 10 | rm -rf $HOME/Library/Containers/InnocenceEngine.InnoMain/Data/Res 11 | mkdir $HOME/Library/Containers/InnocenceEngine.InnoMain/Data/Res 12 | cp -r Res/* $HOME/Library/Containers/InnocenceEngine.InnoMain/Data/Res/ 13 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/VolumetricPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/RenderingServer/IRenderingServer.h" 3 | 4 | using namespace Inno; 5 | namespace VolumetricPass 6 | { 7 | bool Setup(); 8 | bool Initialize(); 9 | bool ExecuteCommands(bool visualize); 10 | bool Terminate(); 11 | 12 | GPUResourceComponent* GetRayMarchingResult(); 13 | GPUResourceComponent* GetVisualizationResult(); 14 | }; 15 | -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/PhysXWrapper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(PhysXWrapper PhysXWrapper.h PhysXWrapper.cpp) 2 | set_property(TARGET PhysXWrapper PROPERTY POSITION_INDEPENDENT_CODE ON) 3 | set_target_properties(PhysXWrapper PROPERTIES FOLDER ThirdParty) 4 | target_include_directories(PhysXWrapper PRIVATE "${INNO_GITSUBMODULE_DIRECTORIES}/PhysX/physx/include") 5 | 6 | target_link_libraries(PhysXWrapper PRIVATE ${PHYSX_LIBS}) -------------------------------------------------------------------------------- /Source/Tool/GLSLParser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (NOT INNO_PLATFORM_MAC) 2 | add_executable(GLSLParser GLSLParser.cpp) 3 | set_target_properties(GLSLParser PROPERTIES FOLDER Tool) 4 | target_link_libraries(GLSLParser Common) 5 | if (INNO_PLATFORM_LINUX) 6 | target_link_libraries(GLSLParser -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl -lm -lpthread -lstdc++fs) 7 | endif (INNO_PLATFORM_LINUX) 8 | endif (NOT INNO_PLATFORM_MAC) -------------------------------------------------------------------------------- /Source/Engine/Component/VKGPUBufferComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GPUBufferComponent.h" 3 | #include "../RenderingServer/VK/VKHeaders.h" 4 | 5 | namespace Inno 6 | { 7 | class VKGPUBufferComponent : public GPUBufferComponent 8 | { 9 | public: 10 | VkBuffer m_DeviceLocalBuffer; 11 | VkDeviceMemory m_DeviceLocalMemory; 12 | VkBuffer m_HostStagingBuffer; 13 | VkDeviceMemory m_HostStagingMemory; 14 | }; 15 | } -------------------------------------------------------------------------------- /Source/Engine/Interface/IRenderingClient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ISystem.h" 3 | 4 | namespace Inno 5 | { 6 | class IRenderingConfig {}; 7 | class IRenderingClient : public ISystem 8 | { 9 | public: 10 | INNO_CLASS_INTERFACE_NON_COPYABLE(IRenderingClient); 11 | 12 | virtual bool PrepareCommands() { return true; } 13 | virtual bool ExecuteCommands(IRenderingConfig* renderingConfig = nullptr) = 0; 14 | }; 15 | } -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/VK/VKHelper_Common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Common/STL17.h" 3 | #include "../../Common/LogService.h" 4 | #include "../../Component/VKTextureComponent.h" 5 | #include "../../Component/VKRenderPassComponent.h" 6 | #include "../../Component/VKShaderProgramComponent.h" 7 | #include "../IRenderingServer.h" 8 | 9 | namespace Inno 10 | { 11 | namespace VKHelper 12 | { 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/MacMain/NSApplication.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSApplication.h 3 | // Main 4 | // 5 | // Created by zhangdoa on 14/04/2019. 6 | // Copyright © 2019 InnocenceEngine. All rights reserved. 7 | // 8 | 9 | #ifndef NSApplication_h 10 | #define NSApplication_h 11 | 12 | #import 13 | @interface NSApplication : NSApplication { 14 | } 15 | - (void)run; 16 | @end 17 | 18 | #endif /* NSApplication_h */ 19 | -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiWindowMac.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IImGuiWindow.h" 3 | 4 | namespace Inno 5 | { 6 | class ImGuiWindowMac : public IImGuiWindow 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(ImGuiWindowMac); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool NewFrame() override; 14 | bool Terminate() override; 15 | }; 16 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/common/dummyInputLayout.hlsl: -------------------------------------------------------------------------------- 1 | struct VertexInputType 2 | { 3 | float3 posLS : POSITION; 4 | float3 normalLS : NORMAL; 5 | float3 tangentLS : TANGENT; 6 | float2 texCoord : TEXCOORD; 7 | float4 pad1 : PAD_A; 8 | uint instanceId : SV_InstanceID; 9 | }; 10 | 11 | struct PixelInputType 12 | { 13 | }; 14 | 15 | PixelInputType main(VertexInputType input) 16 | { 17 | PixelInputType output; 18 | return output; 19 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiWindowLinux.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IImGuiWindow.h" 3 | 4 | namespace Inno 5 | { 6 | class ImGuiWindowLinux : public IImGuiWindow 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(ImGuiWindowLinux); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool NewFrame() override; 14 | bool Terminate() override; 15 | }; 16 | } -------------------------------------------------------------------------------- /Source/Engine/RayTracer/RayTracer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IRayTracer.h" 3 | 4 | namespace Inno 5 | { 6 | class RayTracer : public IRayTracer 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(RayTracer); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool Execute() override; 14 | bool Terminate() override; 15 | 16 | ObjectStatus GetStatus() override; 17 | }; 18 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/GIBakeBrickFactorPass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct GeometryInputType 5 | { 6 | float4 posWS : SV_POSITION; 7 | float UUID : ID; 8 | }; 9 | 10 | GeometryInputType main(VertexInputType input) 11 | { 12 | GeometryInputType output; 13 | 14 | output.posWS = mul(float4(input.posLS, 1.0f), perObjectCBuffer.m); 15 | output.UUID = perObjectCBuffer.UUID; 16 | 17 | return output; 18 | } -------------------------------------------------------------------------------- /Source/Editor/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class MainWindow; 8 | } 9 | 10 | class MainWindow : public QMainWindow 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit MainWindow(QWidget *parent = nullptr); 16 | ~MainWindow(); 17 | 18 | void initializeEngine(); 19 | 20 | private: 21 | Ui::MainWindow *ui; 22 | }; 23 | 24 | #endif // MAINWINDOW_H 25 | -------------------------------------------------------------------------------- /Source/Engine/Component/DX12TextureComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../RenderingServer/DX12/DX12Headers.h" 3 | #include "TextureComponent.h" 4 | 5 | namespace Inno 6 | { 7 | class DX12TextureComponent : public TextureComponent 8 | { 9 | public: 10 | D3D12_RESOURCE_DESC m_DX12TextureDesc = {}; 11 | 12 | D3D12_RESOURCE_STATES m_WriteState; 13 | D3D12_RESOURCE_STATES m_ReadState; 14 | D3D12_RESOURCE_STATES m_CurrentState; 15 | }; 16 | } -------------------------------------------------------------------------------- /Source/Engine/Component/GPUResourceComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/GraphicsPrimitive.h" 3 | #include "../Common/Object.h" 4 | 5 | namespace Inno 6 | { 7 | class GPUResourceComponent : public Component 8 | { 9 | public: 10 | GPUResourceType m_GPUResourceType = GPUResourceType::Sampler; 11 | Accessibility m_CPUAccessibility = Accessibility::WriteOnly; 12 | Accessibility m_GPUAccessibility = Accessibility::ReadOnly; 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory("Common") 2 | 3 | # Always include headless rendering server (platform-agnostic) 4 | add_subdirectory("Headless") 5 | 6 | if (INNO_RENDERER_DIRECTX) 7 | add_subdirectory("DX12") 8 | endif (INNO_RENDERER_DIRECTX) 9 | 10 | if (INNO_RENDERER_VULKAN) 11 | add_subdirectory("VK") 12 | endif (INNO_RENDERER_VULKAN) 13 | 14 | if (INNO_RENDERER_METAL) 15 | add_subdirectory("MT") 16 | endif (INNO_RENDERER_METAL) -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/GIBakeProbePass.frag: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct PixelInputType 5 | { 6 | float4 posCS : SV_POSITION; 7 | float4 posWS : POSITION; 8 | }; 9 | 10 | struct PixelOutputType 11 | { 12 | float4 GIProbePassRT0 : SV_Target0; 13 | }; 14 | 15 | PixelOutputType main(PixelInputType input) 16 | { 17 | PixelOutputType output; 18 | 19 | output.GIProbePassRT0 = float4(input.posWS); 20 | 21 | return output; 22 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiWindowWin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IImGuiWindow.h" 3 | 4 | namespace Inno 5 | { 6 | class ImGuiWindowWin : public IImGuiWindow 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(ImGuiWindowWin); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool NewFrame() override; 14 | bool Terminate() override; 15 | ObjectStatus GetStatus() override; 16 | }; 17 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Inno 4 | { 5 | class ImGuiWrapper 6 | { 7 | public: 8 | ~ImGuiWrapper() {}; 9 | 10 | static ImGuiWrapper& Get() 11 | { 12 | static ImGuiWrapper instance; 13 | return instance; 14 | } 15 | bool Setup(); 16 | bool Initialize(); 17 | bool Prepare(); 18 | bool ExecuteCommands(); 19 | bool Terminate(); 20 | 21 | private: 22 | ImGuiWrapper() {}; 23 | }; 24 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | aux_source_directory(. DIR_SRCS) 2 | list(REMOVE_ITEM DIR_SRCS ./imgui_impl_win32.h ./imgui_impl_dx11.h ./imgui_impl_dx12.h ./imgui_impl_opengl3.h ./imgui_impl_win32.cpp ./imgui_impl_dx11.cpp ./imgui_impl_dx12.cpp ./imgui_impl_opengl3.cpp ./imgui_impl_opengl3_loader.h) 3 | add_library(ImGui ${DIR_SRCS}) 4 | set_property(TARGET ImGui PROPERTY POSITION_INDEPENDENT_CODE ON) 5 | set_target_properties(ImGui PROPERTIES FOLDER ThirdParty/ImGui) -------------------------------------------------------------------------------- /Source/Engine/Services/GUISystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Interface/ISystem.h" 3 | 4 | namespace Inno 5 | { 6 | class GUISystem : public ISystem 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(GUISystem); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool Update() override; 14 | bool ExecuteCommands(); 15 | bool Terminate() override; 16 | 17 | ObjectStatus GetStatus() override; 18 | }; 19 | } -------------------------------------------------------------------------------- /Source/Editor/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char *argv[]) 7 | { 8 | QApplication a(argc, argv); 9 | 10 | QFile f(":qdarkstyle/style.qss"); 11 | 12 | f.open(QFile::ReadOnly | QFile::Text); 13 | QTextStream ts(&f); 14 | a.setStyleSheet(ts.readAll()); 15 | 16 | MainWindow w; 17 | w.show(); 18 | w.initializeEngine(); 19 | return a.exec(); 20 | } 21 | -------------------------------------------------------------------------------- /Scripts/CleanGitSubmodules.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | cd ..\Source\External\GitSubmodules 4 | REM Iterate over each directory in the current folder 5 | for /d %%f in (*) do ( 6 | echo "Resetting Git workspace in %%f" 7 | cd "%%f" 8 | 9 | REM Reset workspace to last committed state 10 | git reset --hard HEAD 11 | 12 | REM Remove untracked files and directories, including those that are ignored by .gitignore 13 | git clean -f -d -x 14 | 15 | cd .. 16 | ) 17 | 18 | echo "Done!" -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/VK/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(VKRenderingServer ${HEADERS} ${SOURCES}) 4 | set_property(TARGET VKRenderingServer PROPERTY POSITION_INDEPENDENT_CODE ON) 5 | set_target_properties(VKRenderingServer PROPERTIES FOLDER Engine/RenderingServer) 6 | target_include_directories(VKRenderingServer PUBLIC "${INNO_GITSUBMODULE_DIRECTORIES}/Vulkan-Headers/include/") 7 | target_link_libraries(VKRenderingServer ${Vulkan_LIBRARIES}) -------------------------------------------------------------------------------- /Source/Tool/Baker/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (INNO_PLATFORM_WIN) 2 | file(GLOB HEADERS "*.h") 3 | file(GLOB SOURCES "*.cpp") 4 | add_executable(Baker WIN32 ${HEADERS} ${SOURCES}) 5 | set_target_properties(Baker PROPERTIES FOLDER Tool) 6 | if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") 7 | set_target_properties(Baker PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") 8 | endif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") 9 | target_link_libraries(Baker Engine) 10 | endif (INNO_PLATFORM_WIN) -------------------------------------------------------------------------------- /Source/Engine/Common/ComponentHeaders.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Component/TransformComponent.h" 3 | #include "../Component/ModelComponent.h" 4 | #include "../Component/LightComponent.h" 5 | #include "../Component/CameraComponent.h" 6 | #include "../Component/CollisionComponent.h" 7 | #include "../Component/MeshComponent.h" 8 | #include "../Component/MaterialComponent.h" 9 | #include "../Component/TextureComponent.h" 10 | #include "../Component/SkeletonComponent.h" 11 | #include "../Component/AnimationComponent.h" -------------------------------------------------------------------------------- /Source/Engine/Common/Randomizer.cpp: -------------------------------------------------------------------------------- 1 | #include "Randomizer.h" 2 | 3 | using namespace Inno; 4 | namespace Inno 5 | { 6 | namespace RandomizerNS 7 | { 8 | std::random_device rd; 9 | std::mt19937_64 e2(rd()); 10 | std::uniform_int_distribution dist(std::llround(std::pow(2, 61)), std::llround(std::pow(2, 62))); 11 | } 12 | } 13 | 14 | using namespace RandomizerNS; 15 | 16 | bool Randomizer::Setup() 17 | { 18 | return true; 19 | } 20 | 21 | uint64_t Randomizer::GenerateUUID() 22 | { 23 | return dist(e2); 24 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (INNO_PLATFORM_WIN) 2 | add_subdirectory("WinMain") 3 | add_subdirectory("WinWindow") 4 | endif (INNO_PLATFORM_WIN) 5 | 6 | if (INNO_PLATFORM_MAC) 7 | add_subdirectory("MacMain") 8 | add_subdirectory("MacWindow") 9 | endif (INNO_PLATFORM_MAC) 10 | 11 | if (INNO_PLATFORM_LINUX) 12 | add_subdirectory("LinuxMain") 13 | add_subdirectory("LinuxWindow") 14 | endif (INNO_PLATFORM_LINUX) 15 | 16 | # Always include headless window system (platform-agnostic) 17 | add_subdirectory("HeadlessWindow") -------------------------------------------------------------------------------- /Source/Engine/Services/LightSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Interface/ISystem.h" 3 | 4 | namespace Inno 5 | { 6 | struct LightSystemImpl; 7 | class LightSystem : public ISystem 8 | { 9 | public: 10 | INNO_CLASS_CONCRETE_NON_COPYABLE(LightSystem); 11 | 12 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 13 | bool Initialize() override; 14 | bool Update() override; 15 | bool Terminate() override; 16 | 17 | ObjectStatus GetStatus() override; 18 | 19 | private: 20 | LightSystemImpl* m_Impl; 21 | }; 22 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/swapChain.frag: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct PixelInputType 5 | { 6 | float4 position : SV_POSITION; 7 | float2 texCoord : TEXCOORD0; 8 | }; 9 | 10 | [[vk::binding(0, 0)]] 11 | Texture2D g_2DTexture : register(t0); 12 | 13 | [[vk::binding(0, 1)]] 14 | SamplerState g_Sampler : register(s0); 15 | 16 | float4 main(PixelInputType input) : SV_TARGET 17 | { 18 | float3 finalColor = g_2DTexture.Sample(g_Sampler, input.texCoord).xyz; 19 | 20 | return float4(finalColor, 1.0f); 21 | } -------------------------------------------------------------------------------- /Source/Client/RenderingClient/GIResolvePass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/RenderingServer/IRenderingServer.h" 3 | 4 | using namespace Inno; 5 | namespace GIResolvePass 6 | { 7 | bool Setup(); 8 | bool Initialize(); 9 | bool PrepareCommandList(); 10 | bool Terminate(); 11 | bool InitializeGPUBuffers(); 12 | bool DeleteGPUBuffers(); 13 | 14 | RenderPassComponent* GetRenderPassComp(); 15 | ShaderProgramComponent* GetSPC(); 16 | GPUResourceComponent* GetProbeVolume(); 17 | GPUResourceComponent* GetIrradianceVolume(); 18 | }; 19 | -------------------------------------------------------------------------------- /Source/Editor/menubar.cpp: -------------------------------------------------------------------------------- 1 | #include "menubar.h" 2 | #include "../Engine/Engine.h" 3 | 4 | using namespace Inno; 5 | Engine *g_Engine; 6 | 7 | MenuBar::MenuBar(QWidget* parent) : QMenuBar(parent) 8 | { 9 | m_fileMenu = this->addMenu("File"); 10 | m_fileMenu->addAction("Open Scene", this, SLOT(openScene())); 11 | m_fileMenu->addAction("Save Scene", this, SLOT(saveScene())); 12 | } 13 | 14 | void MenuBar::openScene() 15 | { 16 | 17 | } 18 | 19 | void MenuBar::saveScene() 20 | { 21 | g_Engine->Get()->saveScene(); 22 | } 23 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/voxelVisualizationPass.frag: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct PixelInputType 5 | { 6 | float4 posCS : SV_POSITION; 7 | float4 color : COLOR; 8 | }; 9 | 10 | struct PixelOutputType 11 | { 12 | float4 voxelVisualizationPassRT0 : SV_Target0; 13 | }; 14 | 15 | PixelOutputType main(PixelInputType input) 16 | { 17 | PixelOutputType output; 18 | 19 | if (input.color.a == 0.0) 20 | { 21 | discard; 22 | } 23 | 24 | output.voxelVisualizationPassRT0 = input.color; 25 | 26 | return output; 27 | } -------------------------------------------------------------------------------- /Scripts/ai-quick-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # AI Agent Team Quick Test Script 4 | # One-stop build and test execution 5 | # Equivalent to: VS Code Build Button + F5 Test Launch 6 | 7 | set -e 8 | 9 | echo "=== AI Agent Team Quick Test ===" 10 | echo "Build + Test in one command..." 11 | echo "" 12 | 13 | # Step 1: Build 14 | echo "🔨 Building project..." 15 | bash Scripts/ai-build.sh 16 | 17 | echo "" 18 | echo "🚀 Launching tests..." 19 | 20 | # Step 2: Test 21 | bash Scripts/ai-test.sh 22 | 23 | echo "" 24 | echo "=== Quick test complete ===" 25 | -------------------------------------------------------------------------------- /Source/Engine/Component/TextureComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GPUResourceComponent.h" 3 | 4 | namespace Inno 5 | { 6 | class TextureComponent : public GPUResourceComponent 7 | { 8 | public: 9 | static uint32_t GetTypeID() { return 8; }; 10 | static const char* GetTypeName() { return "TextureComponent"; }; 11 | TextureDesc m_TextureDesc = {}; 12 | 13 | std::vector m_MappedMemories; 14 | std::vector m_DeviceMemories; 15 | void* m_InitialData = 0; 16 | uint32_t m_PixelDataSize = 0; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/GIBakeSurfelPass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct GeometryInputType 5 | { 6 | float4 posWS : SV_POSITION; 7 | float2 texCoord : TEXCOORD; 8 | float4 normalWS : NORMAL; 9 | }; 10 | 11 | GeometryInputType main(VertexInputType input) 12 | { 13 | GeometryInputType output; 14 | 15 | output.posWS = mul(float4(input.posLS, 1.0f), perObjectCBuffer.m); 16 | output.texCoord = input.texCoord; 17 | output.normalWS = mul(float4(input.normalLS, 0.0f), perObjectCBuffer.normalMat); 18 | 19 | return output; 20 | } -------------------------------------------------------------------------------- /Source/Engine/Component/SkeletonComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/Object.h" 3 | #include "../Common/Array.h" 4 | #include "../Common/MathHelper.h" 5 | 6 | #include "MeshComponent.h" 7 | 8 | namespace Inno 9 | { 10 | struct Bone 11 | { 12 | Mat4 m_LocalToBoneSpace; 13 | }; 14 | 15 | class SkeletonComponent : public Component 16 | { 17 | public: 18 | static uint32_t GetTypeID() { return 9; }; 19 | static const char* GetTypeName() { return "SkeletonComponent"; }; 20 | 21 | Array m_BoneList; 22 | MeshComponent* m_Mesh; 23 | }; 24 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/MacWindow/MacWindowSystemBridge.h: -------------------------------------------------------------------------------- 1 | #ifndef MacWindowSystemBridge_h 2 | #define MacWindowSystemBridge_h 3 | 4 | namespace Inno 5 | { 6 | class MacWindowSystemBridge 7 | { 8 | public: 9 | MacWindowSystemBridge() {}; 10 | virtual ~MacWindowSystemBridge() {}; 11 | 12 | virtual bool Setup(uint32_t sizeX, uint32_t sizeY) = 0; 13 | virtual bool Initialize() = 0; 14 | virtual bool Update() = 0; 15 | virtual bool Terminate() = 0; 16 | 17 | virtual ObjectStatus GetStatus() = 0; 18 | }; 19 | } 20 | #endif /* MacWindowSystemBridge_h */ 21 | -------------------------------------------------------------------------------- /Source/Engine/Platform/WinWindow/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(WinWindowSystem ${HEADERS} ${SOURCES}) 4 | set_target_properties(WinWindowSystem PROPERTIES FOLDER Engine/Window) 5 | 6 | if (INNO_RENDERER_DIRECTX) 7 | add_subdirectory("DXWindowSurface") 8 | target_link_libraries(WinWindowSystem WinDXWindowSurface) 9 | endif (INNO_RENDERER_DIRECTX) 10 | 11 | if (INNO_RENDERER_VULKAN) 12 | add_subdirectory("VKWindowSurface") 13 | target_link_libraries(WinWindowSystem WinVKWindowSurface) 14 | endif (INNO_RENDERER_VULKAN) -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/voxelGeometryProcessPass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct GeometryInputType 5 | { 6 | float4 posWS : SV_POSITION; 7 | float4 normalWS : NORMAL; 8 | float2 texCoord : TEXCOORD; 9 | }; 10 | 11 | GeometryInputType main(VertexInputType input) 12 | { 13 | GeometryInputType output; 14 | 15 | output.posWS = mul(float4(input.posLS, 1.0f), perObjectCBuffer.m); 16 | output.normalWS = mul(float4(input.normalLS, 0.0f), perObjectCBuffer.normalMat); 17 | output.texCoord = input.texCoord; 18 | 19 | return output; 20 | } -------------------------------------------------------------------------------- /Source/Client/RenderingClient/GIDataLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/RenderingServer/IRenderingServer.h" 3 | #include "../../Engine/Common/GPUDataStructure.h" 4 | 5 | using namespace Inno; 6 | namespace GIDataLoader 7 | { 8 | bool Setup(); 9 | bool Initialize(); 10 | bool ReloadGIData(); 11 | bool Terminate(); 12 | 13 | const std::vector& GetSurfels(); 14 | const std::vector& GetBricks(); 15 | const std::vector& GetBrickFactors(); 16 | const std::vector& GetProbes(); 17 | const ProbeInfo& GetProbeInfo(); 18 | }; 19 | -------------------------------------------------------------------------------- /Source/Engine/Platform/MacMain/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp" "*.mm" "*.m") 3 | add_executable(Main ${HEADERS} ${SOURCES}) 4 | set_target_properties(Main PROPERTIES MACOSX_BUNDLE ON) 5 | set_target_properties(Main PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME ${CMAKE_PROJECT_NAME}) 6 | set_target_properties(Main PROPERTIES FOLDER Engine/ApplicationEntry) 7 | target_link_libraries(Main ApplicationEntry) 8 | find_library(METAL Metal) 9 | find_library(METALKIT MetalKit) 10 | target_link_libraries(Main ${METAL}) 11 | target_link_libraries(Main ${METALKIT}) -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/GIBakeBrickFactorPass.frag: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct PixelInputType 5 | { 6 | float4 posCS : SV_POSITION; 7 | float distanceVS : DISTANCE; 8 | float UUID : ID; 9 | uint rtvId : SV_RenderTargetArrayIndex; 10 | }; 11 | 12 | struct PixelOutputType 13 | { 14 | float4 GIBrickFactorPassRT0 : SV_Target0; 15 | }; 16 | 17 | PixelOutputType main(PixelInputType input) 18 | { 19 | PixelOutputType output; 20 | 21 | output.GIBrickFactorPassRT0 = float4(input.distanceVS, input.UUID, 0.0f, 0.0f); 22 | 23 | return output; 24 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiRendererGL.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IImGuiRenderer.h" 3 | 4 | namespace Inno 5 | { 6 | class ImGuiRendererGL : public IImGuiRenderer 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(ImGuiRendererGL); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool NewFrame() override; 14 | bool Prepare() override; 15 | bool Terminate() override; 16 | 17 | ObjectStatus GetStatus() override; 18 | 19 | void ShowRenderResult(RenderPassType renderPassType) override; 20 | }; 21 | } -------------------------------------------------------------------------------- /Res/ModelPresets/Building1.InnoModel: -------------------------------------------------------------------------------- 1 | { 2 | "Meshes": [ 3 | { 4 | "IndicesNumber": 0, 5 | "File": "", 6 | "Name": "Building1", 7 | "MeshShape": 7, 8 | "VerticesNumber": 0, 9 | "Material": { 10 | "AO": 0.0, 11 | "Albedo": { 12 | "A": 1.0, 13 | "B": 0.2, 14 | "G": 0.2, 15 | "R": 0.8 16 | }, 17 | "Metallic": 0.0, 18 | "Roughness": 0.2, 19 | "Thickness": 1.0, 20 | "ShaderModel": 1 21 | } 22 | } 23 | ], 24 | "Timestamp": "[2019-8-20-10-18-36-342]" 25 | } -------------------------------------------------------------------------------- /Res/ModelPresets/Building2.InnoModel: -------------------------------------------------------------------------------- 1 | { 2 | "Meshes": [ 3 | { 4 | "IndicesNumber": 0, 5 | "File": "", 6 | "Name": "Building2", 7 | "MeshShape": 7, 8 | "VerticesNumber": 0, 9 | "Material": { 10 | "AO": 0.0, 11 | "Albedo": { 12 | "A": 1.0, 13 | "B": 0.2, 14 | "G": 0.8, 15 | "R": 0.8 16 | }, 17 | "Metallic": 0.0, 18 | "Roughness": 0.4, 19 | "Thickness": 1.0, 20 | "ShaderModel": 1 21 | } 22 | } 23 | ], 24 | "Timestamp": "[2019-8-20-10-18-36-342]" 25 | } -------------------------------------------------------------------------------- /Res/ModelPresets/Building3.InnoModel: -------------------------------------------------------------------------------- 1 | { 2 | "Meshes": [ 3 | { 4 | "IndicesNumber": 0, 5 | "File": "", 6 | "Name": "Building3", 7 | "MeshShape": 7, 8 | "VerticesNumber": 0, 9 | "Material": { 10 | "AO": 0.0, 11 | "Albedo": { 12 | "A": 1.0, 13 | "B": 0.2, 14 | "G": 0.8, 15 | "R": 0.2 16 | }, 17 | "Metallic": 0.0, 18 | "Roughness": 0.6, 19 | "Thickness": 1.0, 20 | "ShaderModel": 1 21 | } 22 | } 23 | ], 24 | "Timestamp": "[2019-8-20-10-18-36-342]" 25 | } -------------------------------------------------------------------------------- /Res/ModelPresets/Building4.InnoModel: -------------------------------------------------------------------------------- 1 | { 2 | "Meshes": [ 3 | { 4 | "IndicesNumber": 0, 5 | "File": "", 6 | "Name": "Building4", 7 | "MeshShape": 7, 8 | "VerticesNumber": 0, 9 | "Material": { 10 | "AO": 0.0, 11 | "Albedo": { 12 | "A": 1.0, 13 | "B": 0.8, 14 | "G": 0.8, 15 | "R": 0.2 16 | }, 17 | "Metallic": 0.0, 18 | "Roughness": 0.8, 19 | "Thickness": 1.0, 20 | "ShaderModel": 1 21 | } 22 | } 23 | ], 24 | "Timestamp": "[2019-8-20-10-18-36-342]" 25 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiRendererDX11.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IImGuiRenderer.h" 3 | 4 | namespace Inno 5 | { 6 | class ImGuiRendererDX11 : public IImGuiRenderer 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(ImGuiRendererDX11); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool NewFrame() override; 14 | bool Prepare() override; 15 | bool Terminate() override; 16 | 17 | ObjectStatus GetStatus() override; 18 | 19 | void ShowRenderResult(RenderPassType renderPassType) override; 20 | }; 21 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiRendererMT.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IImGuiRenderer.h" 3 | 4 | namespace Inno 5 | { 6 | class ImGuiRendererMT : public IImGuiRenderer 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(ImGuiRendererMT); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool NewFrame() override; 14 | bool Prepare() override; 15 | bool Terminate() override; 16 | 17 | ObjectStatus GetStatus() override; 18 | 19 | void ShowRenderResult(RenderPassType renderPassType) override; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /Source/Engine/Platform/WinWindow/DXWindowSurface/WinDXWindowSurface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../../Interface/IWindowSurface.h" 3 | 4 | namespace Inno 5 | { 6 | class WinDXWindowSurface : public IWindowSurface 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(WinDXWindowSurface); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool Update() override; 14 | bool Terminate() override; 15 | 16 | ObjectStatus GetStatus() override; 17 | 18 | private: 19 | ObjectStatus m_ObjectStatus = ObjectStatus::Terminated; 20 | }; 21 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/WinWindow/VKWindowSurface/WinVKWindowSurface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../../Interface/IWindowSurface.h" 3 | 4 | namespace Inno 5 | { 6 | class WinVKWindowSurface : public IWindowSurface 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(WinVKWindowSurface); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool Update() override; 14 | bool Terminate() override; 15 | 16 | ObjectStatus GetStatus() override; 17 | 18 | private: 19 | ObjectStatus m_ObjectStatus = ObjectStatus::Terminated; 20 | }; 21 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/MacMain/MacWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // MacWindow.h 3 | // Main 4 | // 5 | // Created by zhangdoa on 11/06/2019. 6 | // Copyright © 2019 InnocenceEngine. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | @interface MacWindow : NSWindow { 15 | } 16 | -(id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag; 17 | -(NSRect)getFrame; 18 | -(void)setView:(MTKView*) view; 19 | -(BOOL)isAlive; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Source/Engine/Services/TransformSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Interface/ISystem.h" 3 | #include "../Component/TransformComponent.h" 4 | 5 | namespace Inno 6 | { 7 | class TransformSystem : public ITransformSystem 8 | { 9 | public: 10 | INNO_CLASS_CONCRETE_NON_COPYABLE(TransformSystem); 11 | 12 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 13 | bool Initialize() override; 14 | bool Update() override; 15 | bool Terminate() override; 16 | 17 | ObjectStatus GetStatus() override; 18 | 19 | const TransformComponent* GetRootTransformComponent() override; 20 | }; 21 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/GIBakeProbePass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct PixelInputType 5 | { 6 | float4 posCS : SV_POSITION; 7 | float4 posWS : POSITION; 8 | }; 9 | 10 | PixelInputType main(VertexInputType input) 11 | { 12 | PixelInputType output; 13 | 14 | output.posWS = mul(float4(input.posLS, 1.0f), perObjectCBuffer.m); 15 | output.posCS = mul(output.posWS, GICBuffer.t); 16 | output.posCS = mul(output.posCS, GICBuffer.r[0]); 17 | output.posCS = mul(output.posCS, GICBuffer.p); 18 | output.posCS.z = output.posCS.z * 0.5 + 0.5; 19 | 20 | return output; 21 | } -------------------------------------------------------------------------------- /Source/Engine/Component/AnimationComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/Object.h" 3 | #include "../Common/MathHelper.h" 4 | 5 | namespace Inno 6 | { 7 | struct KeyData 8 | { 9 | Mat4 m; 10 | }; 11 | 12 | class AnimationComponent : public Component 13 | { 14 | public: 15 | static uint32_t GetTypeID() { return 10; }; 16 | static const char* GetTypeName() { return "AnimationComponent"; }; 17 | 18 | float m_Duration = 0.0f; 19 | uint32_t m_NumChannels = 0; 20 | uint32_t m_NumTicks = 0; 21 | // for each tick first, then for each channel 22 | std::vector m_KeyData; 23 | }; 24 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/IImGuiRenderer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Interface/ISystem.h" 3 | #include "../ImGui/imgui.h" 4 | 5 | namespace Inno 6 | { 7 | enum class RenderPassType { Shadow, GI, Opaque, Light, Transparent, Terrain, PostProcessing, Development }; 8 | 9 | class IImGuiRenderer : public ISystem 10 | { 11 | public: 12 | INNO_CLASS_INTERFACE_NON_COPYABLE(IImGuiRenderer); 13 | 14 | virtual bool NewFrame() = 0; 15 | virtual bool Prepare() = 0; 16 | virtual bool ExecuteCommands() = 0; 17 | 18 | virtual void ShowRenderResult(RenderPassType renderPassType) = 0; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiRendererVK.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IImGuiRenderer.h" 3 | 4 | namespace Inno 5 | { 6 | class ImGuiRendererVK : public IImGuiRenderer 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(ImGuiRendererVK); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool NewFrame() override; 14 | bool Prepare() override; 15 | bool ExecuteCommands() override; 16 | bool Terminate() override; 17 | 18 | ObjectStatus GetStatus() override; 19 | 20 | void ShowRenderResult(RenderPassType renderPassType) override; 21 | }; 22 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiRendererDX12.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "IImGuiRenderer.h" 3 | 4 | namespace Inno 5 | { 6 | class ImGuiRendererDX12 : public IImGuiRenderer 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(ImGuiRendererDX12); 10 | 11 | bool Setup(ISystemConfig* systemConfig) override; 12 | bool Initialize() override; 13 | bool NewFrame() override; 14 | bool Prepare() override; 15 | bool ExecuteCommands() override; 16 | bool Terminate() override; 17 | 18 | ObjectStatus GetStatus() override; 19 | 20 | void ShowRenderResult(RenderPassType renderPassType) override; 21 | }; 22 | } -------------------------------------------------------------------------------- /Source/Editor/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "ui_mainwindow.h" 3 | #include 4 | 5 | MainWindow::MainWindow(QWidget *parent) : 6 | QMainWindow(parent), 7 | ui(new Ui::MainWindow) 8 | { 9 | ui->setupUi(this); 10 | } 11 | 12 | MainWindow::~MainWindow() 13 | { 14 | delete ui; 15 | } 16 | 17 | void MainWindow::initializeEngine() 18 | { 19 | ui->widgetViewport->initialize(); 20 | ui->comboBoxRenderConfigurator->initialize(); 21 | ui->widgetPropertyEditor->initialize(); 22 | 23 | ui->treeWidgetWorldExplorer->initialize(ui->widgetPropertyEditor); 24 | ui->directoryViewer->Initialize(); 25 | } 26 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/mipmapGenerator2D.comp: -------------------------------------------------------------------------------- 1 | Texture2D SrcTexture : register(t0); 2 | RWTexture2D DstTexture : register(u0); 3 | SamplerState BilinearClamp : register(s0); 4 | 5 | // Root constants should be declared directly as cbuffer, not ConstantBuffer 6 | cbuffer RootConstants : register(b0) 7 | { 8 | float InvWidth; 9 | float InvHeight; 10 | }; 11 | 12 | [numthreads(8, 8, 1)] 13 | void main(uint3 DTid : SV_DispatchThreadID) 14 | { 15 | float2 texcoords = float2(InvWidth, InvHeight) * (DTid.xy + 0.5); 16 | 17 | float4 color = SrcTexture.SampleLevel(BilinearClamp, texcoords, 0); 18 | 19 | DstTexture[DTid.xy] = color; 20 | } -------------------------------------------------------------------------------- /Source/Engine/Component/DX12MeshComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../RenderingServer/DX12/DX12Headers.h" 3 | #include "MeshComponent.h" 4 | 5 | namespace Inno 6 | { 7 | class DX12MeshComponent : public MeshComponent 8 | { 9 | public: 10 | ComPtr m_UploadHeapBuffer_VB = 0; 11 | ComPtr m_UploadHeapBuffer_IB = 0; 12 | ComPtr m_DefaultHeapBuffer_VB = 0; 13 | ComPtr m_DefaultHeapBuffer_IB = 0; 14 | ComPtr m_BLAS = 0; 15 | ComPtr m_ScratchBuffer = 0; 16 | D3D12_VERTEX_BUFFER_VIEW m_VBV; 17 | D3D12_INDEX_BUFFER_VIEW m_IBV; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/debugPass.frag: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct DebugMaterialData 5 | { 6 | float4 color; 7 | }; 8 | 9 | [[vk::binding(1, 1)]] 10 | StructuredBuffer debugMaterialSBuffer : register(t1); 11 | 12 | struct PixelInputType 13 | { 14 | float4 posCS : SV_POSITION; 15 | uint materialID : MATERIALID; 16 | }; 17 | 18 | struct PixelOutputType 19 | { 20 | float4 debugPassRT0 : SV_Target0; 21 | }; 22 | 23 | PixelOutputType main(PixelInputType input) 24 | { 25 | PixelOutputType output; 26 | 27 | output.debugPassRT0 = debugMaterialSBuffer[input.materialID].color; 28 | 29 | return output; 30 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/volumetricVisualizationPass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct PixelInputType 5 | { 6 | float4 posCS : SV_POSITION; 7 | float2 TexCoord : TEXCOORD; 8 | float3 Normal : NORMAL; 9 | }; 10 | 11 | PixelInputType main(VertexInputType input) 12 | { 13 | PixelInputType output; 14 | 15 | float4 posWS = mul(float4(input.posLS, 1.0f), perObjectCBuffer.m); 16 | float4 posVS = mul(posWS, perFrameCBuffer.v); 17 | output.posCS = mul(posVS, perFrameCBuffer.p_original); 18 | output.TexCoord = input.texCoord; 19 | output.Normal = mul(float4(input.normalLS, 0.0f), perObjectCBuffer.normalMat).xyz; 20 | 21 | return output; 22 | } -------------------------------------------------------------------------------- /Source/Editor/directorytreeviewer.h: -------------------------------------------------------------------------------- 1 | #ifndef INNODIRECTORYTREEVIEWER_H 2 | #define INNODIRECTORYTREEVIEWER_H 3 | 4 | #include 5 | #include 6 | 7 | class DirectoryTreeViewer : public QTreeView 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit DirectoryTreeViewer(QWidget *parent = nullptr); 12 | 13 | void Initialize(); 14 | 15 | QString GetRootPath(); 16 | void SetRootPath(QString path); 17 | void SetActivePath(QString path); 18 | QString GetFilePath(QModelIndex index); 19 | 20 | private: 21 | QFileSystemModel* m_dirModel; 22 | 23 | signals: 24 | 25 | public slots: 26 | }; 27 | 28 | #endif // INNODIRECTORYTREEVIEWER_H 29 | -------------------------------------------------------------------------------- /Source/Engine/Services/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(Services ${HEADERS} ${SOURCES}) 4 | set_property(TARGET Services PROPERTY POSITION_INDEPENDENT_CODE ON) 5 | set_target_properties(Services PROPERTIES FOLDER Engine) 6 | target_include_directories(Services PRIVATE "${INNO_GITSUBMODULE_DIRECTORIES}/json/include") 7 | 8 | target_link_libraries(Services AssimpWrapper) 9 | target_link_libraries(Services STBWrapper) 10 | target_link_libraries(Services JSONWrapper) 11 | target_link_libraries(Services ImGuiWrapper) 12 | 13 | if (INNO_PLATFORM_WIN) 14 | target_link_libraries(Services PhysXWrapper) 15 | endif (INNO_PLATFORM_WIN) -------------------------------------------------------------------------------- /Res/Shaders/HLSL/mipmapGenerator3D.comp: -------------------------------------------------------------------------------- 1 | Texture3D SrcTexture : register(t0); 2 | RWTexture3D DstTexture : register(u0); 3 | SamplerState BilinearClamp : register(s0); 4 | 5 | // Root constants should be declared directly as cbuffer, not ConstantBuffer 6 | cbuffer RootConstants : register(b0) 7 | { 8 | float InvWidth; 9 | float InvHeight; 10 | float InvDepth; 11 | }; 12 | 13 | [numthreads(8, 8, 8)] 14 | void main(uint3 DTid : SV_DispatchThreadID) 15 | { 16 | float3 texcoords = float3(InvWidth, InvHeight, InvDepth) * (DTid.xyz + 0.5); 17 | 18 | float4 color = SrcTexture.SampleLevel(BilinearClamp, texcoords, 0); 19 | 20 | DstTexture[DTid.xyz] = color; 21 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/WinMain/WinMain.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "../../Common/STL14.h" 6 | #include "../../Engine.h" 7 | 8 | using namespace Inno; 9 | 10 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int nCmdshow) 11 | { 12 | std::unique_ptr m_pEngine = std::make_unique(); 13 | 14 | if (!m_pEngine->Setup(hInstance, nullptr, pScmdline)) 15 | { 16 | return 0; 17 | } 18 | 19 | if (!m_pEngine->Initialize()) 20 | { 21 | return 0; 22 | } 23 | 24 | m_pEngine->Run(); 25 | 26 | m_pEngine->Terminate(); 27 | 28 | return 0; 29 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/MacMain/MetalDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // MetalDelegate.h 3 | // Main 4 | // 5 | // Created by zhangdoa on 14/04/2019. 6 | // Copyright © 2019 InnocenceEngine. All rights reserved. 7 | // 8 | 9 | #ifndef MetalDelegate_h 10 | #define MetalDelegate_h 11 | 12 | #import 13 | #import 14 | 15 | @interface MetalDelegate : NSObject { 16 | } 17 | - (void)createDevice; 18 | - (void)createView:(NSRect)frame; 19 | - (MTKView*)getView; 20 | - (void)createLibrary; 21 | - (void)createPipeline; 22 | - (void)createBuffer; 23 | - (void)submitGPUData:(void*)MeshComp; 24 | - (void)render; 25 | @end 26 | 27 | #endif /* MetalDelegate_h */ 28 | -------------------------------------------------------------------------------- /Source/Client/LogicClient/DefaultLogicClient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/ILogicClient.h" 3 | 4 | namespace Inno 5 | { 6 | class DefaultLogicClientImpl; 7 | class DefaultLogicClient : public ILogicClient 8 | { 9 | public: 10 | INNO_CLASS_CONCRETE_NON_COPYABLE(DefaultLogicClient); 11 | 12 | bool Setup(ISystemConfig* systemConfig) override; 13 | bool Initialize() override; 14 | bool Update() override; 15 | bool Terminate() override; 16 | 17 | ObjectStatus GetStatus() override; 18 | 19 | const char* GetApplicationName() override; 20 | 21 | private: 22 | DefaultLogicClientImpl* GetImpl(); 23 | DefaultLogicClientImpl* m_Impl = nullptr; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /Source/Engine/Component/GPUBufferComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GPUResourceComponent.h" 3 | 4 | namespace Inno 5 | { 6 | class GPUBufferComponent : public GPUResourceComponent 7 | { 8 | public: 9 | static uint32_t GetTypeID() { return 14; }; 10 | static const char* GetTypeName() { return "GPUBufferComponent"; }; 11 | 12 | size_t m_ElementCount = 0; 13 | size_t m_ElementSize = 0; 14 | size_t m_TotalSize = 0; 15 | GPUBufferUsage m_Usage = GPUBufferUsage::None; 16 | void* m_InitialData = 0; 17 | IIndirectDrawCommandList* m_IndirectDrawCommandList = 0; 18 | std::vector m_MappedMemories; 19 | std::vector m_DeviceMemories; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /Source/Engine/Component/MeshComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/Object.h" 3 | #include "../Common/GraphicsPrimitive.h" 4 | #include "../Common/Array.h" 5 | #include "../Common/MathHelper.h" 6 | 7 | namespace Inno 8 | { 9 | class MeshComponent : public Component 10 | { 11 | public: 12 | static uint32_t GetTypeID() { return 6; }; 13 | static const char* GetTypeName() { return "MeshComponent"; }; 14 | 15 | MeshShape m_MeshShape = MeshShape::Customized; 16 | void* m_MappedMemory_VB = nullptr; 17 | void* m_MappedMemory_IB = nullptr; 18 | size_t m_IndexCount = 0; 19 | bool m_NeedUploadToGPU = false; 20 | 21 | Array m_Vertices; 22 | Array m_Indices; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /Source/Engine/Interface/ISystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/ClassTemplate.h" 3 | #include "../Common/Object.h" 4 | #include 5 | #include 6 | 7 | namespace Inno 8 | { 9 | class ISystemConfig 10 | { 11 | }; 12 | 13 | class ISystem 14 | { 15 | public: 16 | INNO_CLASS_INTERFACE_NON_COPYABLE(ISystem); 17 | 18 | virtual bool Setup(ISystemConfig* systemConfig = nullptr) = 0; 19 | virtual bool Initialize() = 0; 20 | virtual bool Update() { return true; }; 21 | virtual bool Terminate() = 0; 22 | virtual ObjectStatus GetStatus() = 0; 23 | 24 | // Dependency resolution support 25 | virtual std::vector GetDependencies() { return {}; } 26 | }; 27 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiWindowMac.cpp: -------------------------------------------------------------------------------- 1 | #include "ImGuiWindowMac.h" 2 | 3 | #include "../../Engine.h" 4 | using namespace Inno; 5 | ; 6 | 7 | namespace ImGuiWindowMacNS 8 | { 9 | } 10 | 11 | bool ImGuiWindowMac::Setup(ISystemConfig* systemConfig) 12 | { 13 | Log(Success, "ImGuiWindowMac Setup finished."); 14 | 15 | return true; 16 | } 17 | 18 | bool ImGuiWindowMac::Initialize() 19 | { 20 | Log(Success, "ImGuiWindowMac has been initialized."); 21 | 22 | return true; 23 | } 24 | 25 | bool ImGuiWindowMac::newFrame() 26 | { 27 | return true; 28 | } 29 | 30 | bool ImGuiWindowMac::Terminate() 31 | { 32 | Log(Success, "ImGuiWindowMac has been terminated."); 33 | 34 | return true; 35 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/sunShadowGeometryProcessPass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct GeometryInputType 5 | { 6 | float4 posWS : SV_POSITION; 7 | float2 texCoord : TEXCOORD; 8 | }; 9 | 10 | [[vk::binding(0, 0)]] 11 | cbuffer RootConstants : register(b0) 12 | { 13 | uint m_ObjectIndex; 14 | }; 15 | 16 | [[vk::binding(0, 1)]] 17 | StructuredBuffer g_Objects : register(t0); 18 | 19 | GeometryInputType main(VertexInputType input) 20 | { 21 | GeometryInputType output; 22 | 23 | PerObject_CB perObjectCB = g_Objects[m_ObjectIndex]; 24 | 25 | output.posWS = mul(float4(input.posLS, 1.0f), perObjectCB.m); 26 | output.texCoord = input.texCoord; 27 | 28 | return output; 29 | } -------------------------------------------------------------------------------- /Source/Engine/Interface/IRenderPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ISystem.h" 3 | #include "../Component/RenderPassComponent.h" 4 | #include "../Component/GPUResourceComponent.h" 5 | #include "../Component/SamplerComponent.h" 6 | #include "../Component/GPUBufferComponent.h" 7 | #include "../Common/Math.h" 8 | 9 | namespace Inno 10 | { 11 | class IRenderingContext {}; 12 | 13 | class IRenderPass : public ISystem 14 | { 15 | public: 16 | INNO_CLASS_INTERFACE_NON_COPYABLE(IRenderPass); 17 | 18 | virtual bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) = 0; 19 | virtual RenderPassComponent* GetRenderPassComp() = 0; 20 | virtual void InitializeResourceBindingLayoutDescs() {} 21 | }; 22 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/MacMain/MacWindowDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // MacWindowDelegate.h 3 | // Main 4 | // 5 | // Created by zhangdoa on 14/04/2019. 6 | // Copyright © 2019 InnocenceEngine. All rights reserved. 7 | // 8 | 9 | #ifndef MacWindowDelegate_h 10 | #define MacWindowDelegate_h 11 | 12 | #import 13 | #import 14 | 15 | @interface MacWindowDelegate : NSWindow { 16 | } 17 | -(id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag; 18 | -(NSRect)getFrame; 19 | -(void)setView:(MTKView*) view; 20 | -(BOOL)isAlive; 21 | @end 22 | 23 | #endif /* MacWindowDelegate_h */ 24 | -------------------------------------------------------------------------------- /Source/Editor/renderconfigurator.h: -------------------------------------------------------------------------------- 1 | #ifndef INNORENDERCONFIGURATOR_H 2 | #define INNORENDERCONFIGURATOR_H 3 | 4 | #include 5 | #include 6 | 7 | class RenderConfigurator : public QComboBox 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit RenderConfigurator(QWidget *parent = nullptr); 12 | ~RenderConfigurator(); 13 | virtual void showPopup(); 14 | void initialize(); 15 | 16 | private slots: 17 | void OnItemPressed(const QModelIndex& index); 18 | 19 | private: 20 | void AddCheckItem(int row, const QString& text); 21 | void SetRenderConfig(); 22 | void GetRenderConfig(); 23 | 24 | unsigned int m_rows; 25 | QStandardItemModel* m_model; 26 | }; 27 | 28 | #endif // INNORENDERCONFIGURATOR_H 29 | -------------------------------------------------------------------------------- /Source/Engine/Services/EntityManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/STL17.h" 3 | #include "../Interface/ISystem.h" 4 | 5 | namespace Inno 6 | { 7 | class EntityManager : public ISystem 8 | { 9 | public: 10 | INNO_CLASS_CONCRETE_NON_COPYABLE(EntityManager); 11 | 12 | bool Setup(ISystemConfig* systemConfig) override; 13 | bool Initialize() override; 14 | bool Update() override; 15 | bool Terminate() override; 16 | 17 | ObjectStatus GetStatus() override; 18 | 19 | Entity* Spawn(bool serializable, ObjectLifespan objectLifespan, const char* entityName); 20 | bool Destroy(Entity* entity); 21 | const std::vector& GetEntities(); 22 | std::optional Find(const char* entityName); 23 | }; 24 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiWindowLinux.cpp: -------------------------------------------------------------------------------- 1 | #include "ImGuiWindowLinux.h" 2 | 3 | #include "../ModuleManager/Engine.h" 4 | using namespace Inno; 5 | ; 6 | 7 | namespace ImGuiWindowLinuxNS 8 | { 9 | } 10 | 11 | bool ImGuiWindowLinux::Setup(ISystemConfig* systemConfig) 12 | { 13 | Log(Success, "ImGuiWindowLinux Setup finished."); 14 | 15 | return true; 16 | } 17 | 18 | bool ImGuiWindowLinux::Initialize() 19 | { 20 | Log(Success, "ImGuiWindowLinux has been initialized."); 21 | 22 | return true; 23 | } 24 | 25 | bool ImGuiWindowLinux::newFrame() 26 | { 27 | return true; 28 | } 29 | 30 | bool ImGuiWindowLinux::Terminate() 31 | { 32 | Log(Success, "ImGuiWindowLinux has been terminated."); 33 | 34 | return true; 35 | } -------------------------------------------------------------------------------- /Source/Editor/directoryviewer.h: -------------------------------------------------------------------------------- 1 | #ifndef INNODIRECTORYVIEWER_H 2 | #define INNODIRECTORYVIEWER_H 3 | 4 | #include 5 | #include 6 | #include "directorytreeviewer.h" 7 | #include "directorylistviewer.h" 8 | 9 | class DirectoryViewer : public QSplitter 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit DirectoryViewer(QWidget *parent = nullptr); 14 | 15 | void Initialize(); 16 | 17 | private: 18 | QSplitter* m_splitter; 19 | DirectoryTreeViewer* m_treeViewer; 20 | DirectoryListViewer* m_listViewer; 21 | 22 | signals: 23 | 24 | public slots: 25 | void UpdateDirectoryList(QModelIndex index); 26 | void UpdateDirectoryTree(QModelIndex index); 27 | }; 28 | 29 | #endif // INNODIRECTORYVIEWER_H 30 | -------------------------------------------------------------------------------- /Source/Editor/icomponentpropertyeditor.h: -------------------------------------------------------------------------------- 1 | #ifndef ICOMPONENTPROPERTYEDITOR_H 2 | #define ICOMPONENTPROPERTYEDITOR_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class IComponentPropertyEditor : public QWidget 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit IComponentPropertyEditor(QWidget *parent = nullptr) : QWidget(parent) {} 13 | virtual void initialize() = 0; 14 | virtual void edit(void* component) = 0; 15 | 16 | protected: 17 | QLabel* m_title; 18 | QWidget* m_line; 19 | QGridLayout* m_gridLayout; 20 | int m_verticalSpacing = 0; 21 | int m_horizontalSpacing = 0; 22 | 23 | signals: 24 | 25 | public slots: 26 | virtual void remove() = 0; 27 | }; 28 | 29 | #endif // ICOMPONENTPROPERTYEDITOR_H 30 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/transparentGeometryProcessPass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct PixelInputType 5 | { 6 | float4 posCS : SV_POSITION; 7 | float3 posWS : POSITION; 8 | float2 TexCoord : TEXCOORD; 9 | float3 normalWS : NORMAL; 10 | }; 11 | 12 | PixelInputType main(VertexInputType input) 13 | { 14 | PixelInputType output; 15 | 16 | float4 posWS = mul(float4(input.posLS, 1.0f), perObjectCBuffer.m); 17 | float4 posVS = mul(posWS, perFrameCBuffer.v); 18 | output.posCS = mul(posVS, perFrameCBuffer.p_original); 19 | 20 | output.posWS = posWS.xyz; 21 | output.TexCoord = input.texCoord; 22 | output.normalWS = mul(float4(input.normalLS, 0.0f), perObjectCBuffer.normalMat).xyz; 23 | 24 | return output; 25 | } -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/VK/VKHeaders.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "vulkan/vulkan.h" 3 | 4 | namespace Inno 5 | { 6 | struct QueueFamilyIndices 7 | { 8 | std::optional m_graphicsFamily; 9 | std::optional m_presentFamily; 10 | std::optional m_computeFamily; 11 | std::optional m_transferFamily; 12 | 13 | bool isComplete() 14 | { 15 | return m_graphicsFamily.has_value() && m_presentFamily.has_value() && m_computeFamily.has_value() && m_transferFamily.has_value(); 16 | } 17 | }; 18 | 19 | struct SwapChainSupportDetails 20 | { 21 | VkSurfaceCapabilitiesKHR m_capabilities; 22 | std::vector m_formats; 23 | std::vector m_presentModes; 24 | }; 25 | } -------------------------------------------------------------------------------- /Source/Engine/Services/CameraSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Interface/ISystem.h" 3 | #include "../Component/CameraComponent.h" 4 | 5 | namespace Inno 6 | { 7 | class CameraSystem : public ICameraSystem 8 | { 9 | public: 10 | INNO_CLASS_CONCRETE_NON_COPYABLE(CameraSystem); 11 | 12 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 13 | bool Initialize() override; 14 | bool Update() override; 15 | bool Terminate() override; 16 | 17 | ObjectStatus GetStatus() override; 18 | 19 | void SetMainCamera(CameraComponent* cameraComponent) override; 20 | CameraComponent* GetMainCamera() override; 21 | void SetActiveCamera(CameraComponent* cameraComponent) override; 22 | CameraComponent* GetActiveCamera() override; 23 | }; 24 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/billboardPass.frag: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | [[vk::binding(0, 1)]] 5 | Texture2D iconTexture : register(t0); 6 | 7 | [[vk::binding(0, 2)]] 8 | SamplerState in_samplerTypePoint : register(s0); 9 | 10 | struct PixelInputType 11 | { 12 | float4 posCS : SV_POSITION; 13 | float2 texCoord : TEXCOORD; 14 | }; 15 | 16 | struct PixelOutputType 17 | { 18 | float4 billboardPass : SV_Target0; 19 | }; 20 | 21 | PixelOutputType main(PixelInputType input) 22 | { 23 | PixelOutputType output; 24 | 25 | float4 textureColor = iconTexture.Sample(in_samplerTypePoint, input.texCoord); 26 | if (textureColor.a == 0.0) 27 | discard; 28 | output.billboardPass = float4(textureColor.rgb, 1.0); 29 | 30 | return output; 31 | } -------------------------------------------------------------------------------- /Source/Test/Common/TestTimer.cpp: -------------------------------------------------------------------------------- 1 | #include "TestTimer.h" 2 | 3 | using namespace Inno; 4 | 5 | void TestTimer::Start() 6 | { 7 | m_StartTime = Timer::GetCurrentTimeFromEpoch(TimeUnit::Microsecond); 8 | } 9 | 10 | void TestTimer::Stop() 11 | { 12 | m_EndTime = Timer::GetCurrentTimeFromEpoch(TimeUnit::Microsecond); 13 | } 14 | 15 | double TestTimer::GetDurationMs() const 16 | { 17 | return (double)(m_EndTime - m_StartTime) / 1000.0; 18 | } 19 | 20 | uint64_t TestTimer::GetDurationMicroseconds() const 21 | { 22 | return m_EndTime - m_StartTime; 23 | } 24 | 25 | double TestTimer::MeasureFunction(const std::function& func) 26 | { 27 | TestTimer l_Timer; 28 | l_Timer.Start(); 29 | func(); 30 | l_Timer.Stop(); 31 | return l_Timer.GetDurationMs(); 32 | } 33 | -------------------------------------------------------------------------------- /Source/Engine/Platform/LinuxWindow/LinuxWindowSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Interface/IWindowSystem.h" 3 | 4 | namespace Inno 5 | { 6 | class LinuxWindowSystem : public IWindowSystem 7 | { 8 | public: 9 | INNO_CLASS_CONCRETE_NON_COPYABLE(LinuxWindowSystem); 10 | 11 | bool Setup(void* hInstance, void* hwnd) override; 12 | bool Initialize() override; 13 | bool Update() override; 14 | bool Terminate() override; 15 | 16 | ObjectStatus GetStatus() override; 17 | 18 | IWindowSurface* GetWindowSurface() override; 19 | const std::vector& GetButtonState() override; 20 | 21 | bool SendEvent(uint32_t uMsg, uint32_t wParam, int32_t lParam) override; 22 | bool AddEventCallback(WindowEventCallback* callback) override; 23 | }; 24 | } 25 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/DefaultRenderingClient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderingClient.h" 3 | 4 | namespace Inno 5 | { 6 | class DefaultRenderingClientImpl; 7 | class DefaultRenderingClient : public IRenderingClient 8 | { 9 | public: 10 | INNO_CLASS_CONCRETE_NON_COPYABLE(DefaultRenderingClient); 11 | 12 | // Inherited via IRenderingClient 13 | bool Setup(ISystemConfig* systemConfig) override; 14 | bool Initialize() override; 15 | bool Update() override; 16 | bool PrepareCommands() override; 17 | bool ExecuteCommands(IRenderingConfig* renderingConfig = nullptr) override; 18 | bool Terminate() override; 19 | 20 | ObjectStatus GetStatus() override; 21 | 22 | private: 23 | DefaultRenderingClientImpl* m_Impl; 24 | }; 25 | } -------------------------------------------------------------------------------- /Source/Engine/Common/Memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef INNO_DECLSPEC_ALLOCATOR 3 | #ifdef _MSC_VER 4 | #define INNO_DECLSPEC_ALLOCATOR __declspec(allocator) 5 | #else 6 | #define INNO_DECLSPEC_ALLOCATOR 7 | #endif 8 | #endif 9 | 10 | #include 11 | #include 12 | #include "STL14.h" 13 | #include "STL17.h" 14 | 15 | namespace Inno 16 | { 17 | class Memory 18 | { 19 | public: 20 | static void* Allocate(const std::size_t size); 21 | static void* Reallocate(void* const ptr, const std::size_t size); 22 | static void Deallocate(void* const ptr); 23 | 24 | private: 25 | bool Record(void* ptr, std::size_t size); 26 | 27 | bool Erase(void* ptr); 28 | 29 | private: 30 | std::shared_mutex m_Mutex; 31 | std::unordered_map m_Memo; 32 | }; 33 | } -------------------------------------------------------------------------------- /Source/Engine/Component/MaterialComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/GPUDataStructure.h" 3 | #include "GPUResourceComponent.h" 4 | #include "TextureComponent.h" 5 | 6 | namespace Inno 7 | { 8 | enum class ShaderModel { Invalid, Opaque, Transparent, Emissive, Volumetric, Debug }; 9 | 10 | struct TextureSlot 11 | { 12 | TextureComponent* m_Texture = 0; 13 | bool m_Activated = false; 14 | }; 15 | 16 | class MaterialComponent : public GPUResourceComponent 17 | { 18 | public: 19 | static uint32_t GetTypeID() { return 7; }; 20 | static const char* GetTypeName() { return "MaterialComponent"; }; 21 | 22 | MaterialAttributes m_materialAttributes = {}; 23 | TextureSlot m_TextureSlots[MaxTextureSlotCount]; 24 | ShaderModel m_ShaderModel = ShaderModel::Invalid; 25 | }; 26 | } -------------------------------------------------------------------------------- /Source/Tool/Baker/Serializer.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #include "Common.h" 4 | 5 | namespace Inno 6 | { 7 | namespace Baker 8 | { 9 | bool serializeProbeInfos(const ProbeInfo& probeInfo); 10 | bool serializeProbes(const std::vector& probes); 11 | bool serializeSurfels(const std::vector& surfels); 12 | bool serializeSurfelCaches(const std::vector& surfelCaches); 13 | bool serializeBrickCaches(const std::vector& brickCaches); 14 | bool deserializeBrickCaches(const std::vector& brickCacheSummaries, std::vector& brickCaches); 15 | bool serializeBricks(const std::vector& bricks); 16 | bool serializeBrickFactors(const std::vector& brickFactors); 17 | } 18 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/debugPass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct DebugMeshData 5 | { 6 | matrix m; 7 | uint materialID; 8 | uint padding[15]; 9 | }; 10 | 11 | [[vk::binding(0, 1)]] 12 | StructuredBuffer debugMeshSBuffer : register(t0); 13 | 14 | struct PixelInputType 15 | { 16 | float4 posCS : SV_POSITION; 17 | uint materialID : MATERIALID; 18 | }; 19 | 20 | PixelInputType main(VertexInputType input) 21 | { 22 | PixelInputType output; 23 | 24 | output.materialID = debugMeshSBuffer[input.instanceId].materialID; 25 | output.posCS = mul(float4(input.posLS, 1.0f), debugMeshSBuffer[input.instanceId].m); 26 | output.posCS = mul(output.posCS, perFrameCBuffer.v); 27 | output.posCS = mul(output.posCS, perFrameCBuffer.p_jittered); 28 | 29 | return output; 30 | } -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/VK/VKHelper_Pipeline.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Common/STL17.h" 3 | #include "../../Common/LogService.h" 4 | #include "../../Component/VKTextureComponent.h" 5 | #include "../../Component/VKRenderPassComponent.h" 6 | #include "../../Component/VKShaderProgramComponent.h" 7 | #include "../IRenderingServer.h" 8 | 9 | namespace Inno 10 | { 11 | namespace VKHelper 12 | { 13 | VkCompareOp GetComparisionFunctionEnum(ComparisionFunction comparisionFunction); 14 | VkStencilOp GetStencilOperationEnum(StencilOperation stencilOperation); 15 | VkBlendFactor GetBlendFactorEnum(BlendFactor blendFactor); 16 | VkBlendOp GetBlendOperation(BlendOperation blendOperation); 17 | 18 | VkPipelineStageFlags GetPipelineStageFlags(const VkImageLayout& imageLayout, ShaderStage shaderStage); 19 | } 20 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/PhysXWrapper/PhysXWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Common/MathHelper.h" 3 | #include "../../Component/CollisionComponent.h" 4 | 5 | namespace Inno 6 | { 7 | class PhysXWrapper 8 | { 9 | public: 10 | ~PhysXWrapper() {}; 11 | 12 | static PhysXWrapper& get() 13 | { 14 | static PhysXWrapper instance; 15 | return instance; 16 | } 17 | bool Setup(); 18 | bool Initialize(); 19 | bool Update(); 20 | bool Terminate(); 21 | 22 | bool createPxSphere(CollisionComponent* rhs, float radius, bool isDynamic); 23 | bool createPxBox(CollisionComponent* rhs, bool isDynamic); 24 | bool createPxMesh(CollisionComponent* rhs, bool isDynamic, bool isConvex); 25 | 26 | bool addForce(CollisionComponent* rhs, Vec4 force); 27 | 28 | private: 29 | PhysXWrapper() {}; 30 | }; 31 | } -------------------------------------------------------------------------------- /Source/Engine/Component/CollisionComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/Object.h" 3 | #include "../Common/MathHelper.h" 4 | #include "TransformComponent.h" 5 | #include "ModelComponent.h" 6 | 7 | namespace Inno 8 | { 9 | struct CollisionPrimitive 10 | { 11 | AABB m_AABB = {}; 12 | Sphere m_Sphere = {}; 13 | }; 14 | 15 | class CollisionComponent : public Component 16 | { 17 | public: 18 | static uint32_t GetTypeID() { return 5; }; 19 | static const char* GetTypeName() { return "CollisionComponent"; }; 20 | 21 | CollisionPrimitive* m_BottomLevelCollisionPrimitive = 0; 22 | CollisionPrimitive* m_TopLevelCollisionPrimitive = 0; 23 | TransformComponent* m_TransformComponent = 0; 24 | ModelComponent* m_ModelComponent = 0; 25 | RenderableSet* m_RenderableSet = 0; 26 | void* m_SimulationProxy = 0; 27 | }; 28 | } -------------------------------------------------------------------------------- /Source/Engine/Component/VKTextureComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "TextureComponent.h" 3 | #include "../RenderingServer/VK/VKHeaders.h" 4 | 5 | namespace Inno 6 | { 7 | struct VKTextureDesc 8 | { 9 | VkImageType imageType; 10 | VkImageViewType imageViewType; 11 | VkImageUsageFlags imageUsageFlags; 12 | VkFormat format; 13 | VkDeviceSize imageSize; 14 | VkBorderColor boarderColor; 15 | VkImageAspectFlags aspectFlags; 16 | }; 17 | 18 | class VKTextureComponent : public TextureComponent 19 | { 20 | public: 21 | VkImage m_image; 22 | VkDeviceMemory m_imageMemory; 23 | VkImageView m_imageView; 24 | VKTextureDesc m_VKTextureDesc = {}; 25 | VkImageCreateInfo m_ImageCreateInfo = {}; 26 | VkImageLayout m_WriteImageLayout; 27 | VkImageLayout m_ReadImageLayout; 28 | VkImageLayout m_CurrentImageLayout; 29 | }; 30 | } -------------------------------------------------------------------------------- /Source/Client/RenderingClient/BRDFLUTMSPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class BRDFLUTMSPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(BRDFLUTMSPass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent *GetRenderPassComp() override; 18 | 19 | GPUResourceComponent *GetResult(); 20 | 21 | private: 22 | ObjectStatus m_ObjectStatus; 23 | RenderPassComponent *m_RenderPassComp; 24 | ShaderProgramComponent *m_ShaderProgramComp; 25 | TextureComponent *m_Result; 26 | }; 27 | } // namespace Inno 28 | -------------------------------------------------------------------------------- /Source/Editor/directorylistviewer.h: -------------------------------------------------------------------------------- 1 | #ifndef DIRECTORYLISTVIEWER_H 2 | #define DIRECTORYLISTVIEWER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class DirectoryListViewer : public QListView 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit DirectoryListViewer(QWidget *parent = nullptr); 14 | 15 | void Initialize(); 16 | 17 | QString GetRootPath(); 18 | void SetRootPath(QString path); 19 | QString GetFilePath(QModelIndex index); 20 | 21 | private: 22 | QString GetSelectionPath(); 23 | 24 | QFileSystemModel* m_fileModel; 25 | QString m_rootDir; 26 | 27 | signals: 28 | 29 | public slots: 30 | void InteractiveWithFile(QModelIndex index); 31 | void OpenFileMenu(QModelIndex index); 32 | void SaveScene(); 33 | }; 34 | 35 | #endif // DIRECTORYLISTVIEWER_H 36 | -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/DX12/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB HEADERS "*.h") 2 | file(GLOB SOURCES "*.cpp") 3 | add_library(DX12RenderingServer ${HEADERS} ${SOURCES}) 4 | set_target_properties(DX12RenderingServer PROPERTIES FOLDER Engine/RenderingServer) 5 | target_include_directories(DX12RenderingServer PUBLIC "${INNO_GITSUBMODULE_DIRECTORIES}/DirectX-Headers/include") 6 | 7 | find_library(D3D12_LIB d3d12) 8 | find_library(DXGI_LIB dxgi) 9 | find_library(D3DCOMPILER_LIB d3dcompiler) 10 | find_library(DXGUID_LIB dxguid) 11 | 12 | if (D3D12_LIB AND DXGI_LIB AND D3DCOMPILER_LIB AND DXGUID_LIB) 13 | message(STATUS "Found DirectX libraries") 14 | target_link_libraries(DX12RenderingServer PRIVATE ${D3D12_LIB} ${DXGI_LIB} ${D3DCOMPILER_LIB} ${DXGUID_LIB}) 15 | else() 16 | message(FATAL_ERROR "Failed to find DirectX libraries") 17 | endif() 18 | -------------------------------------------------------------------------------- /Source/Engine/Component/ModelComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/Object.h" 3 | #include "MeshComponent.h" 4 | #include "SkeletonComponent.h" 5 | #include "MaterialComponent.h" 6 | 7 | namespace Inno 8 | { 9 | struct RenderableSet 10 | { 11 | MeshComponent* mesh; 12 | SkeletonComponent* skeleton; 13 | MaterialComponent* material; 14 | }; 15 | 16 | struct Model 17 | { 18 | ArrayRangeInfo renderableSets; 19 | }; 20 | 21 | class ModelComponent : public Component 22 | { 23 | public: 24 | static uint32_t GetTypeID() { return 2; }; 25 | static const char* GetTypeName() { return "ModelComponent"; }; 26 | 27 | MeshUsage m_meshUsage = MeshUsage::Static; 28 | MeshShape m_MeshShape = MeshShape::Customized; 29 | 30 | std::string m_modelFileName; 31 | bool m_simulatePhysics = false; 32 | 33 | Model* m_Model; 34 | }; 35 | } -------------------------------------------------------------------------------- /Source/Tool/Baker/SurfelGenerator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Common.h" 3 | #include "../../Engine/Engine.h" 4 | 5 | namespace Inno 6 | { 7 | namespace Baker 8 | { 9 | class SurfelGenerator 10 | { 11 | INNO_CLASS_SINGLETON(SurfelGenerator) 12 | 13 | void setup(); 14 | bool captureSurfels(std::vector& probes); 15 | bool drawObjects(Probe& probe, const Mat4& p, const std::vector& v); 16 | bool readBackSurfelCaches(Probe& probe, std::vector& surfelCaches); 17 | bool eliminateDuplicatedSurfels(std::vector& surfelCaches); 18 | 19 | RenderPassComponent* m_RenderPassComp_Surfel; 20 | ShaderProgramComponent* m_SPC_Surfel; 21 | SamplerComponent* m_SamplerComp_Surfel; 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Source/Engine/Common/STL14.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | -------------------------------------------------------------------------------- /Source/Engine/Platform/MacMain/MacMain.m: -------------------------------------------------------------------------------- 1 | // 2 | // macMain.mm 3 | // macMain 4 | // 5 | // Created by zhangdoa on 13/04/2019. 6 | // Copyright © 2019 zhangdoa. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "NSApplication.h" 12 | 13 | int main(int argc, const char * argv[]) { 14 | NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; 15 | Class principalClass = 16 | NSClassFromString(@"NSApplication"); 17 | NSApplication *applicationObject = [principalClass sharedApplication]; 18 | 19 | if ([applicationObject respondsToSelector:@selector(run)]) 20 | { 21 | [applicationObject 22 | performSelectorOnMainThread:@selector(run) 23 | withObject:nil 24 | waitUntilDone:YES]; 25 | } 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /Source/Engine/Platform/MacWindow/MacWindowSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Interface/IWindowSystem.h" 3 | #include "MacWindowSystemBridge.h" 4 | 5 | namespace Inno 6 | { 7 | class MacWindowSystem : public IWindowSystem 8 | { 9 | public: 10 | INNO_CLASS_CONCRETE_NON_COPYABLE(MacWindowSystem); 11 | 12 | bool Setup(ISystemConfig* systemConfig) override; 13 | bool Initialize() override; 14 | bool Update() override; 15 | bool Terminate() override; 16 | 17 | ObjectStatus GetStatus() override; 18 | 19 | IWindowSurface* GetWindowSurface() override; 20 | const std::vector& GetButtonState() override; 21 | 22 | bool SendEvent(uint32_t uMsg, uint32_t wParam, int32_t lParam) override; 23 | bool AddEventCallback(WindowEventCallback* callback) override; 24 | 25 | void setBridge(MacWindowSystemBridge* bridge); 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/SkyPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class SkyPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(SkyPass) 10 | 11 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent* GetRenderPassComp() override; 18 | 19 | GPUResourceComponent* GetResult(); 20 | 21 | private: 22 | ObjectStatus m_ObjectStatus; 23 | RenderPassComponent* m_RenderPassComp; 24 | ShaderProgramComponent* m_ShaderProgramComp; 25 | TextureComponent* m_Result; 26 | 27 | bool RenderTargetsCreationFunc(); 28 | }; 29 | } // namespace Inno 30 | -------------------------------------------------------------------------------- /Res/Shaders/MSL/library.metal: -------------------------------------------------------------------------------- 1 | // 2 | // library.metal 3 | // InnoMain 4 | // 5 | // Created by zhangdoa on 14/04/2019. 6 | // Copyright © 2019 InnocenceEngine. All rights reserved. 7 | // 8 | 9 | #include 10 | 11 | using namespace metal; 12 | 13 | struct VertexIn 14 | { 15 | float4 position; 16 | float2 texCoord; 17 | float2 pad1; 18 | float4 normal; 19 | float4 pad2; 20 | }; 21 | 22 | struct VertexOut 23 | { 24 | float4 position [[position]]; 25 | }; 26 | 27 | vertex VertexOut vertexFunction(device VertexIn *vertices [[buffer(0)]], 28 | uint vid [[vertex_id]]) 29 | { 30 | VertexOut out; 31 | out.position = vertices[vid].position; 32 | return out; 33 | } 34 | 35 | fragment float4 fragmentFunction(VertexOut in [[stage_in]]) 36 | { 37 | return float4(0.1f, 0.2f, 0.3f, 1.0f); 38 | } 39 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/BRDFLUTPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class BRDFLUTPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(BRDFLUTPass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent *GetRenderPassComp() override; 18 | 19 | GPUResourceComponent *GetResult(); 20 | 21 | private: 22 | ObjectStatus m_ObjectStatus; 23 | RenderPassComponent *m_RenderPassComp; 24 | ShaderProgramComponent *m_ShaderProgramComp; 25 | SamplerComponent *m_SamplerComp; 26 | TextureComponent *m_Result; 27 | }; 28 | } // namespace Inno 29 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/PreTAAPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class PreTAAPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(PreTAAPass) 10 | 11 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent* GetRenderPassComp() override; 18 | 19 | GPUResourceComponent* GetResult(); 20 | 21 | private: 22 | ObjectStatus m_ObjectStatus; 23 | RenderPassComponent* m_RenderPassComp; 24 | ShaderProgramComponent* m_ShaderProgramComp; 25 | TextureComponent* m_Result; 26 | 27 | bool RenderTargetsCreationFunc(); 28 | }; 29 | } // namespace Inno 30 | -------------------------------------------------------------------------------- /Source/Engine/Component/ShaderProgramComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/Object.h" 3 | 4 | namespace Inno 5 | { 6 | using ShaderFilePath = FixedSizeString<128>; 7 | 8 | struct ShaderFilePaths 9 | { 10 | ShaderFilePath m_VSPath = ""; 11 | ShaderFilePath m_HSPath = ""; 12 | ShaderFilePath m_DSPath = ""; 13 | ShaderFilePath m_GSPath = ""; 14 | ShaderFilePath m_PSPath = ""; 15 | ShaderFilePath m_CSPath = ""; 16 | ShaderFilePath m_RayGenPath = ""; 17 | ShaderFilePath m_AnyHitPath = ""; 18 | ShaderFilePath m_ClosestHitPath = ""; 19 | ShaderFilePath m_MissPath = ""; 20 | }; 21 | 22 | class ShaderProgramComponent : public Component 23 | { 24 | public: 25 | static uint32_t GetTypeID() { return 12; }; 26 | static const char* GetTypeName() { return "ShaderProgramComponent"; }; 27 | 28 | ShaderFilePaths m_ShaderFilePaths = {}; 29 | }; 30 | } -------------------------------------------------------------------------------- /Source/Engine/Component/VKShaderProgramComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ShaderProgramComponent.h" 3 | #include "../RenderingServer/VK/VKHeaders.h" 4 | 5 | namespace Inno 6 | { 7 | class VKShaderProgramComponent : public ShaderProgramComponent 8 | { 9 | public: 10 | VkShaderModule m_VSHandle; 11 | VkShaderModule m_HSHandle; 12 | VkShaderModule m_DSHandle; 13 | VkShaderModule m_GSHandle; 14 | VkShaderModule m_PSHandle; 15 | VkShaderModule m_CSHandle; 16 | VkPipelineVertexInputStateCreateInfo m_vertexInputStateCInfo = {}; 17 | VkPipelineShaderStageCreateInfo m_VSCInfo = {}; 18 | VkPipelineShaderStageCreateInfo m_HSCInfo = {}; 19 | VkPipelineShaderStageCreateInfo m_DSCInfo = {}; 20 | VkPipelineShaderStageCreateInfo m_GSCInfo = {}; 21 | VkPipelineShaderStageCreateInfo m_PSCInfo = {}; 22 | VkPipelineShaderStageCreateInfo m_CSCInfo = {}; 23 | }; 24 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/volumetricVisualizationPass.frag: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | [[vk::binding(0, 1)]] 5 | Texture3D in_volume : register(t0); 6 | [[vk::binding(0, 2)]] 7 | SamplerState in_samplerTypePoint : register(s0); 8 | 9 | struct PixelInputType 10 | { 11 | float4 posCS : SV_POSITION; 12 | float2 TexCoord : TEXCOORD; 13 | float3 Normal : NORMAL; 14 | }; 15 | 16 | struct PixelOutputType 17 | { 18 | float4 visualizationPassRT0 : SV_Target0; 19 | }; 20 | 21 | PixelOutputType main(PixelInputType input) 22 | { 23 | PixelOutputType output; 24 | 25 | float3 tc = float3(input.posCS.xy / perFrameCBuffer.viewportSize.xy, 0.0f); 26 | tc = tc * 0.5f + 0.5f; 27 | tc.z = input.posCS.z; 28 | 29 | float4 result = in_volume.Sample(in_samplerTypePoint, tc); 30 | 31 | output.visualizationPassRT0 = float4(result.xyz, 1.0); 32 | 33 | return output; 34 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/AssimpWrapper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | aux_source_directory(. DIR_SRCS) 2 | add_library(AssimpWrapper ${DIR_SRCS}) 3 | set_property(TARGET AssimpWrapper PROPERTY POSITION_INDEPENDENT_CODE ON) 4 | set_target_properties(AssimpWrapper PROPERTIES FOLDER ThirdParty) 5 | 6 | target_include_directories(AssimpWrapper PRIVATE "${INNO_GITSUBMODULE_DIRECTORIES}/json/include") 7 | target_include_directories(AssimpWrapper PRIVATE "${INNO_GITSUBMODULE_DIRECTORIES}/assimp/include") 8 | target_include_directories(AssimpWrapper PRIVATE "${INNO_GITSUBMODULE_DIRECTORIES}/assimp/build/${CMAKE_BUILD_TYPE}/include") 9 | target_include_directories(AssimpWrapper PRIVATE "${INNO_GITSUBMODULE_DIRECTORIES}/stb") 10 | 11 | target_include_directories(AssimpWrapper PRIVATE ${ASSIMP_INCLUDE_DIR}) 12 | foreach(LIB ${ASSIMP_LIBS}) 13 | target_link_libraries(AssimpWrapper PRIVATE ${LIB}) 14 | endforeach() -------------------------------------------------------------------------------- /Source/Client/RenderingClient/SunShadowBlurEvenPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class SunShadowBlurEvenPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(SunShadowBlurEvenPass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent *GetRenderPassComp() override; 18 | 19 | GPUResourceComponent *GetResult(); 20 | 21 | private: 22 | ObjectStatus m_ObjectStatus; 23 | RenderPassComponent *m_RenderPassComp; 24 | ShaderProgramComponent *m_ShaderProgramComp; 25 | Math::TVec4 m_numThreads; 26 | Math::TVec4 m_numThreadGroups; 27 | }; 28 | } // namespace Inno -------------------------------------------------------------------------------- /Source/Client/RenderingClient/SunShadowBlurOddPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class SunShadowBlurOddPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(SunShadowBlurOddPass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent *GetRenderPassComp() override; 18 | 19 | GPUResourceComponent *GetResult(); 20 | 21 | private: 22 | ObjectStatus m_ObjectStatus; 23 | RenderPassComponent *m_RenderPassComp; 24 | ShaderProgramComponent *m_ShaderProgramComp; 25 | Math::TVec4 m_numThreads; 26 | Math::TVec4 m_numThreadGroups; 27 | }; 28 | } // namespace Inno -------------------------------------------------------------------------------- /Source/Client/RenderingClient/OpaquePass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class OpaquePass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(OpaquePass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Update() override; 14 | bool Terminate() override; 15 | ObjectStatus GetStatus() override; 16 | 17 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 18 | RenderPassComponent *GetRenderPassComp() override; 19 | 20 | GPUResourceComponent *GetResult(); 21 | 22 | private: 23 | ObjectStatus m_ObjectStatus; 24 | RenderPassComponent *m_RenderPassComp; 25 | ShaderProgramComponent *m_ShaderProgramComp; 26 | SamplerComponent *m_SamplerComp; 27 | GPUBufferComponent* m_IndirectDrawCommand; 28 | }; 29 | } // namespace Inno 30 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/VXGIGeometryProcessPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class VXGIGeometryProcessPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(VXGIGeometryProcessPass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent *GetRenderPassComp() override; 18 | 19 | GPUResourceComponent *GetResult(); 20 | 21 | private: 22 | ObjectStatus m_ObjectStatus; 23 | RenderPassComponent *m_RenderPassComp; 24 | ShaderProgramComponent *m_ShaderProgramComp; 25 | SamplerComponent *m_SamplerComp; 26 | 27 | GPUBufferComponent *m_result; 28 | }; 29 | } // namespace Inno 30 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/LuminanceAveragePass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class LuminanceAveragePass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(LuminanceAveragePass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent *GetRenderPassComp() override; 18 | 19 | GPUResourceComponent *GetResult(); 20 | 21 | private: 22 | ObjectStatus m_ObjectStatus; 23 | RenderPassComponent *m_RenderPassComp; 24 | ShaderProgramComponent *m_ShaderProgramComp; 25 | uint32_t m_MaxResultToKeep = 8; 26 | 27 | GPUBufferComponent *m_luminanceAverage = 0; 28 | }; 29 | } // namespace Inno 30 | -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/MT/MTRenderingServerBridge.h: -------------------------------------------------------------------------------- 1 | #ifndef MTRenderingServerBridge_h 2 | #define MTRenderingServerBridge_h 3 | 4 | #include "../../Component/MTMeshComponent.h" 5 | #include "../../Component/MTTextureComponent.h" 6 | 7 | namespace Inno 8 | { 9 | class MTRenderingServerBridge 10 | { 11 | public: 12 | MTRenderingServerBridge() {}; 13 | virtual ~MTRenderingServerBridge() {}; 14 | 15 | virtual bool Setup() = 0; 16 | virtual bool Initialize() = 0; 17 | virtual bool Update() = 0; 18 | virtual bool render() = 0; 19 | virtual bool present() = 0; 20 | virtual bool Terminate() = 0; 21 | 22 | virtual ObjectStatus GetStatus() = 0; 23 | 24 | virtual bool resize() = 0; 25 | 26 | virtual bool initializeMTMeshComponent(MTMeshComponent* rhs) = 0; 27 | virtual bool initializeMTTextureComponent(MTTextureComponent* rhs) = 0; 28 | }; 29 | } 30 | #endif /* MTRenderingSystemBridge_h */ 31 | -------------------------------------------------------------------------------- /Source/Editor/viewport.h: -------------------------------------------------------------------------------- 1 | #ifndef INNOVIEWPORT_H 2 | #define INNOVIEWPORT_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class ViewportEventFilter : public QObject 10 | { 11 | Q_OBJECT 12 | 13 | protected: 14 | bool eventFilter(QObject *obj, QEvent *event) override; 15 | }; 16 | 17 | class Viewport : public QWidget 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit Viewport(QWidget *parent = nullptr); 23 | virtual ~Viewport() override; 24 | 25 | void initialize(); 26 | 27 | ViewportEventFilter* m_viewportEventFilter; 28 | 29 | protected: 30 | virtual QPaintEngine* paintEngine() const override { return NULL; } 31 | 32 | void showEvent(QShowEvent* showEvent) override; 33 | 34 | void resizeEvent(QResizeEvent* resizeEvent) override; 35 | 36 | private: 37 | void Resize(float width, float height); 38 | }; 39 | 40 | #endif // INNOVIEWPORT_H 41 | -------------------------------------------------------------------------------- /Source/Editor/adjustlabel.h: -------------------------------------------------------------------------------- 1 | #ifndef ADJUSTLABEL_H 2 | #define ADJUSTLABEL_H 3 | 4 | #include 5 | #include 6 | 7 | class AdjustLabel : public QLabel 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit AdjustLabel(QWidget* parent = nullptr); 12 | void Initialize(QLineEdit* lineEdit, bool isInt = false); 13 | protected: 14 | virtual void mouseMoveEvent(QMouseEvent* event); 15 | virtual void leaveEvent(QEvent* event); 16 | 17 | private: 18 | void MouseEntered(); 19 | QPoint GetMousePosLocal(); 20 | void RepositionMouseOnScreenEdge(); 21 | void Adjust(); 22 | 23 | QLineEdit* m_lineEdit; 24 | bool m_isMouseHovering; 25 | bool m_isMouseDragged; 26 | float m_lastMousePos; 27 | float m_mouseDelta; 28 | float m_currentTexBoxValue; 29 | bool m_isInt; 30 | 31 | signals: 32 | void Adjusted(); 33 | 34 | public slots: 35 | }; 36 | #endif // ADJUSTLABEL_H 37 | -------------------------------------------------------------------------------- /Source/Test/Common/TestRunner.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Common/STL14.h" 3 | 4 | namespace Inno 5 | { 6 | class TestTimer; 7 | 8 | class TestRunner 9 | { 10 | public: 11 | // Static interface - implementations in .cpp file (v1.1 standard) 12 | static void RunAllTests(); 13 | static void RunUnitTests(); 14 | static void RunPerformanceTests(); 15 | static void RunStressTests(); 16 | 17 | static void StartTestSuite(const char* suiteName); 18 | static void EndTestSuite(); 19 | static void StartTest(const char* testName); 20 | static void EndTest(bool passed = true); 21 | 22 | static void ReportResults(); 23 | 24 | private: 25 | // Static member variables 26 | static size_t m_TotalTests; 27 | static size_t m_PassedTests; 28 | static size_t m_FailedTests; 29 | static std::string m_CurrentSuite; 30 | static std::string m_CurrentTest; 31 | static TestTimer* m_Timer; 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/RadianceCacheMiss.hlsl: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "RayTracingBindings.hlsl" 3 | #include "common/skyResolver.hlsl" 4 | 5 | [shader("miss")] 6 | void MissShader(inout RayPayload payload) 7 | { 8 | // Get the world-space ray origin (where the ray starts) 9 | float3 rayOrigin = WorldRayOrigin(); 10 | float3 rayDirection = WorldRayDirection(); 11 | 12 | // Light and atmosphere properties 13 | float3 lightDir = g_Frame.sun_direction.xyz; 14 | float planetRadius = 6371e3; 15 | float atmosphereHeight = 100e3; 16 | 17 | float3 eyeDir = rayDirection; 18 | float3 eyePosition = rayOrigin + float3(0.0, planetRadius, 0.0); 19 | 20 | float3 skyRadiance = getSkyColor( 21 | eyeDir, 22 | eyePosition, 23 | lightDir, 24 | g_Frame.sun_illuminance.xyz, 25 | planetRadius, 26 | atmosphereHeight 27 | ); 28 | 29 | payload.radiance = skyRadiance; 30 | } 31 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/GIResolveTestProbePass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct ProbeMeshData 5 | { 6 | matrix m; 7 | float4 index; 8 | float4 padding[3]; 9 | }; 10 | 11 | [[vk::binding(0, 1)]] 12 | StructuredBuffer probeMeshSBuffer : register(t0); 13 | 14 | struct PixelInputType 15 | { 16 | float4 posCS : SV_POSITION; 17 | float4 posWS : POSITION_WS; 18 | float4 probeIndex : PROBE_INDEX; 19 | float4 normalWS : NORMAL; 20 | }; 21 | 22 | PixelInputType main(VertexInputType input) 23 | { 24 | PixelInputType output; 25 | 26 | output.probeIndex = probeMeshSBuffer[input.instanceId].index; 27 | output.normalWS = float4(input.normalLS, 0.0f); 28 | 29 | output.posWS = mul(float4(input.posLS, 1.0f), probeMeshSBuffer[input.instanceId].m); 30 | output.posCS = mul(output.posWS, perFrameCBuffer.v); 31 | output.posCS = mul(output.posCS, perFrameCBuffer.p_original); 32 | 33 | return output; 34 | } -------------------------------------------------------------------------------- /Source/Editor/combolabeltext.h: -------------------------------------------------------------------------------- 1 | #ifndef COMBOLABELTEXT_H 2 | #define COMBOLABELTEXT_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "adjustlabel.h" 9 | 10 | class ComboLabelText : public QWidget 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit ComboLabelText(QWidget *parent = nullptr); 15 | 16 | void Initialize(QString labelText); 17 | void AlignLabelToTheLeft(); 18 | void AlignLabelToTheRight(); 19 | 20 | AdjustLabel* GetLabelWidget(); 21 | QLineEdit* GetTextWidget(); 22 | 23 | float GetAsFloat(); 24 | void SetFromFloat(float value); 25 | 26 | int GetAsInt(); 27 | void SetFromInt(int value); 28 | 29 | private: 30 | AdjustLabel* m_label; 31 | QLineEdit* m_text; 32 | QValidator* m_validator; 33 | 34 | signals: 35 | void ValueChanged(); 36 | 37 | public slots: 38 | void TextGotEdited(); 39 | }; 40 | 41 | #endif // COMBOLABELTEXT_H 42 | -------------------------------------------------------------------------------- /Source/Engine/Platform/WinWindow/DXWindowSurface/WinDXWindowSurface.cpp: -------------------------------------------------------------------------------- 1 | #include "WinDXWindowSurface.h" 2 | #include "../WinWindowSystem.h" 3 | #include "../../../Common/LogService.h" 4 | #include "../../../Services/RenderingConfigurationService.h" 5 | #include "../../../Services/RenderingContextService.h" 6 | 7 | #include "../../../Engine.h" 8 | using namespace Inno; 9 | 10 | bool WinDXWindowSurface::Setup(ISystemConfig* systemConfig) 11 | { 12 | m_ObjectStatus = ObjectStatus::Created; 13 | 14 | return true; 15 | } 16 | 17 | bool WinDXWindowSurface::Initialize() 18 | { 19 | m_ObjectStatus = ObjectStatus::Activated; 20 | 21 | return true; 22 | } 23 | 24 | bool WinDXWindowSurface::Update() 25 | { 26 | return true; 27 | } 28 | 29 | bool WinDXWindowSurface::Terminate() 30 | { 31 | m_ObjectStatus = ObjectStatus::Terminated; 32 | 33 | return true; 34 | } 35 | 36 | ObjectStatus WinDXWindowSurface::GetStatus() 37 | { 38 | return m_ObjectStatus; 39 | } -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/DX12/DX12Helper_Common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Common/LogService.h" 3 | #include "../../Common/Object.h" 4 | 5 | #include "DX12Headers.h" 6 | 7 | namespace Inno 8 | { 9 | namespace DX12Helper 10 | { 11 | template 12 | bool SetObjectName(const wchar_t* name, ComPtr rhs, const char* objectType) 13 | { 14 | auto l_HResult = rhs->SetName(name); 15 | if (FAILED(l_HResult)) 16 | { 17 | Log(Warning, "Can't name ", objectType, " with ", name); 18 | return false; 19 | } 20 | return true; 21 | } 22 | 23 | template 24 | bool SetObjectName(Object* owner, ComPtr rhs, const char* objectType) 25 | { 26 | auto l_Name = std::string(owner->m_InstanceName.c_str()); 27 | l_Name += "_"; 28 | l_Name += objectType; 29 | auto l_NameW = std::wstring(l_Name.begin(), l_Name.end()); 30 | return SetObjectName(l_NameW.c_str(), rhs, objectType); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Source/Test/Common/TestData.cpp: -------------------------------------------------------------------------------- 1 | #include "TestData.h" 2 | 3 | using namespace Inno; 4 | 5 | std::vector TestDataGenerator::GenerateIntSequence(size_t count) 6 | { 7 | std::vector l_Data; 8 | l_Data.reserve(count); 9 | for (size_t i = 0; i < count; i++) 10 | { 11 | l_Data.emplace_back(static_cast(i)); 12 | } 13 | return l_Data; 14 | } 15 | 16 | std::vector TestDataGenerator::GenerateFloatSequence(size_t count) 17 | { 18 | std::vector l_Data; 19 | l_Data.reserve(count); 20 | for (size_t i = 0; i < count; i++) 21 | { 22 | l_Data.emplace_back(static_cast(i)); 23 | } 24 | return l_Data; 25 | } 26 | 27 | std::vector TestDataGenerator::GenerateStringData(size_t count) 28 | { 29 | std::vector l_Data; 30 | l_Data.reserve(count); 31 | for (size_t i = 0; i < count; i++) 32 | { 33 | l_Data.emplace_back("TestString_" + std::to_string(i)); 34 | } 35 | return l_Data; 36 | } 37 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/BillboardPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class BillboardPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(BillboardPass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent *GetRenderPassComp() override; 18 | 19 | GPUResourceComponent *GetResult(); 20 | 21 | private: 22 | ObjectStatus m_ObjectStatus; 23 | RenderPassComponent *m_RenderPassComp; 24 | ShaderProgramComponent *m_ShaderProgramComp; 25 | SamplerComponent *m_SamplerComp; 26 | 27 | bool DepthStencilRenderTargetsReservationFunc(); 28 | bool DepthStencilRenderTargetsCreationFunc(); 29 | }; 30 | } // namespace Inno 31 | -------------------------------------------------------------------------------- /Source/Engine/Component/SamplerComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GPUResourceComponent.h" 3 | 4 | namespace Inno 5 | { 6 | struct SamplerDesc 7 | { 8 | TextureFilterMethod m_MinFilterMethod = TextureFilterMethod::Linear; 9 | TextureFilterMethod m_MagFilterMethod = TextureFilterMethod::Linear; 10 | TextureWrapMethod m_WrapMethodU = TextureWrapMethod::Edge; 11 | TextureWrapMethod m_WrapMethodV = TextureWrapMethod::Edge; 12 | TextureWrapMethod m_WrapMethodW = TextureWrapMethod::Edge; 13 | bool m_UseMipMap = false; 14 | float m_BorderColor[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; 15 | float m_MinLOD = 0.0f; 16 | float m_MaxLOD = 3.402823466e+38f; 17 | uint32_t m_MaxAnisotropy = 1; 18 | }; 19 | 20 | class SamplerComponent : public GPUResourceComponent 21 | { 22 | public: 23 | static uint32_t GetTypeID() { return 13; }; 24 | static const char* GetTypeName() { return "SamplerComponent"; }; 25 | 26 | SamplerDesc m_SamplerDesc = {}; 27 | }; 28 | } -------------------------------------------------------------------------------- /Source/Client/RenderingClient/RadianceCacheRaytracingPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class RadianceCacheRaytracingPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(RadianceCacheRaytracingPass) 10 | 11 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent* GetRenderPassComp() override; 18 | 19 | private: 20 | const uint32_t TILE_SIZE = 8; 21 | 22 | ObjectStatus m_ObjectStatus; 23 | RenderPassComponent* m_RenderPassComp; 24 | ShaderProgramComponent* m_ShaderProgramComp; 25 | SamplerComponent* m_SamplerComp; 26 | 27 | ShaderStage m_ShaderStage; 28 | 29 | bool RenderTargetsCreationFunc(); 30 | }; 31 | } // namespace Inno 32 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/TransparentBlendPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class TransparentBlendPassRenderingContext : public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent *m_output; 10 | }; 11 | 12 | class TransparentBlendPass : IRenderPass 13 | { 14 | public: 15 | INNO_CLASS_SINGLETON(TransparentBlendPass) 16 | 17 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 18 | bool Initialize() override; 19 | bool Terminate() override; 20 | ObjectStatus GetStatus() override; 21 | 22 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 23 | RenderPassComponent *GetRenderPassComp() override; 24 | 25 | GPUResourceComponent *GetResult(); 26 | 27 | private: 28 | ObjectStatus m_ObjectStatus; 29 | RenderPassComponent *m_RenderPassComp; 30 | ShaderProgramComponent *m_ShaderProgramComp; 31 | }; 32 | } // namespace Inno 33 | -------------------------------------------------------------------------------- /Source/Editor/propertyeditor.h: -------------------------------------------------------------------------------- 1 | #ifndef INNOPROPERTYEDITOR_H 2 | #define INNOPROPERTYEDITOR_H 3 | 4 | #include 5 | #include "transformcomponentpropertyeditor.h" 6 | #include "visiblecomponentpropertyeditor.h" 7 | #include "lightcomponentpropertyeditor.h" 8 | #include "cameracomponentpropertyeditor.h" 9 | 10 | class PropertyEditor : public QWidget 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit PropertyEditor(QWidget *parent = nullptr); 15 | void initialize(); 16 | void clear(); 17 | 18 | void editComponent(int componentType, void* componentPtr); 19 | void remove(); 20 | 21 | private: 22 | TransformComponentPropertyEditor* m_transformComponentPropertyEditor; 23 | VisibleComponentPropertyEditor* m_visibleComponentPropertyEditor; 24 | LightComponentPropertyEditor* m_lightComponentPropertyEditor; 25 | CameraComponentPropertyEditor* m_cameraComponentPropertyEditor; 26 | signals: 27 | 28 | public slots: 29 | }; 30 | 31 | #endif // INNOPROPERTYEDITOR_H 32 | -------------------------------------------------------------------------------- /Source/Tool/Baker/BrickGenerator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Common.h" 3 | #include "../../Engine/Engine.h" 4 | 5 | namespace Inno 6 | { 7 | namespace Baker 8 | { 9 | class BrickGenerator 10 | { 11 | INNO_CLASS_SINGLETON(BrickGenerator) 12 | 13 | void setup(); 14 | bool generateBrickCaches(std::vector& surfelCaches); 15 | bool generateBricks(const std::vector& brickCaches); 16 | bool assignBrickFactorToProbesByGPU(const std::vector& bricks, std::vector& probes); 17 | bool drawBricks(Vec4 pos, uint32_t bricksCount, const Mat4& p, const std::vector& v); 18 | bool readBackBrickFactors(Probe& probe, std::vector& brickFactors, const std::vector& bricks); 19 | 20 | RenderPassComponent* m_RenderPassComp_BrickFactor; 21 | ShaderProgramComponent* m_SPC_BrickFactor; 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/MotionBlurPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class MotionBlurPassRenderingContext : public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent *m_input; 10 | }; 11 | 12 | class MotionBlurPass : IRenderPass 13 | { 14 | public: 15 | INNO_CLASS_SINGLETON(MotionBlurPass) 16 | 17 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 18 | bool Initialize() override; 19 | bool Terminate() override; 20 | ObjectStatus GetStatus() override; 21 | 22 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 23 | RenderPassComponent *GetRenderPassComp() override; 24 | 25 | GPUResourceComponent *GetResult(); 26 | 27 | private: 28 | ObjectStatus m_ObjectStatus; 29 | RenderPassComponent *m_RenderPassComp; 30 | ShaderProgramComponent *m_ShaderProgramComp; 31 | SamplerComponent *m_SamplerComp; 32 | }; 33 | } // namespace Inno 34 | -------------------------------------------------------------------------------- /Source/Engine/Component/TransformComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/Object.h" 3 | #include "../Common/MathHelper.h" 4 | #include "../Interface/ISystem.h" 5 | 6 | namespace Inno 7 | { 8 | class TransformComponent : public Component 9 | { 10 | public: 11 | static uint32_t GetTypeID() { return 1; }; 12 | static const char* GetTypeName() { return "TransformComponent"; }; 13 | 14 | TransformVector m_localTransformVector; 15 | TransformVector m_localTransformVector_target; 16 | TransformVector m_globalTransformVector; 17 | TransformMatrix m_globalTransformMatrix; 18 | 19 | TransformMatrix m_globalTransformMatrix_prev; 20 | 21 | uint32_t m_transformHierarchyLevel = 0; 22 | TransformComponent* m_parentTransformComponent = 0; 23 | }; 24 | 25 | class ITransformSystem : public ISystem 26 | { 27 | public: 28 | INNO_CLASS_INTERFACE_NON_COPYABLE(ITransformSystem); 29 | 30 | virtual const TransformComponent* GetRootTransformComponent() = 0; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/voxelVisualizationPass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct GeometryInputType 5 | { 6 | float4 posCS : SV_POSITION; 7 | float4 color : COLOR; 8 | }; 9 | 10 | [[vk::binding(0, 1)]] 11 | Texture3D in_volume : register(t0); 12 | 13 | GeometryInputType main(VertexInputType input) 14 | { 15 | GeometryInputType output; 16 | 17 | float3 position = float3 18 | ( 19 | input.instanceId % (int)voxelizationPassCBuffer.volumeResolution, 20 | (input.instanceId / (int)voxelizationPassCBuffer.volumeResolution) % (int)voxelizationPassCBuffer.volumeResolution, 21 | input.instanceId / ((int)voxelizationPassCBuffer.volumeResolution * (int)voxelizationPassCBuffer.volumeResolution) 22 | ); 23 | 24 | int3 texPos = int3(position); 25 | output.posCS = float4(position * voxelizationPassCBuffer.volumeResolutionRcp, 1.0f); 26 | output.posCS.xyz = output.posCS.xyz * 2.0 - 1.0; 27 | output.color = in_volume[texPos]; 28 | return output; 29 | } -------------------------------------------------------------------------------- /Source/Client/RenderingClient/AnimationPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class AnimationPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(AnimationPass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent *GetRenderPassComp() override; 18 | 19 | private: 20 | ObjectStatus m_ObjectStatus; 21 | RenderPassComponent *m_RenderPassComp; 22 | ShaderProgramComponent *m_ShaderProgramComp; 23 | SamplerComponent *m_SamplerComp; 24 | 25 | bool RenderTargetsReservationFunc(); 26 | bool RenderTargetsCreationFunc(); 27 | bool DepthStencilRenderTargetsReservationFunc(); 28 | bool DepthStencilRenderTargetsCreationFunc(); 29 | }; 30 | } // namespace Inno 31 | -------------------------------------------------------------------------------- /Source/Test/Common/TestData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Common/STL14.h" 3 | 4 | namespace Inno 5 | { 6 | // Common test data structures and utilities 7 | struct TestConfig 8 | { 9 | static constexpr size_t SmallDataSize = 1024; 10 | static constexpr size_t MediumDataSize = 8192; 11 | static constexpr size_t LargeDataSize = 65536; 12 | static constexpr size_t StressTestSize = 262144; 13 | 14 | static constexpr size_t ConcurrencyTestThreads = 128; 15 | static constexpr size_t PerformanceIterations = 10000; 16 | }; 17 | 18 | // Test data for memory allocations 19 | struct TestStruct 20 | { 21 | uint32_t m_Data[256]; 22 | }; 23 | 24 | // Utility functions for test data generation (no engine APIs) 25 | class TestDataGenerator 26 | { 27 | public: 28 | static std::vector GenerateIntSequence(size_t count); 29 | static std::vector GenerateFloatSequence(size_t count); 30 | static std::vector GenerateStringData(size_t count); 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /Scripts/HLSL2SPIR-V.ps1: -------------------------------------------------------------------------------- 1 | mkdir ..\Res\Shaders\SPIRV 2 | Set-Location ../Res/Shaders/SPIRV 3 | Remove-Item *.spv 4 | 5 | Set-Location ../HLSL 6 | 7 | $files = Get-ChildItem 8 | foreach ($file in $files) { 9 | $name=$file.Name 10 | $extension=$file.Extension 11 | $target_profile="lib_5_0" 12 | if ($extension -match ".vert") { 13 | $target_profile="vs_5_0" 14 | } elseif ($extension -match ".tesc") { 15 | $target_profile="hs_5_0" 16 | } elseif ($extension -match ".tese") { 17 | $target_profile="ds_5_0" 18 | } elseif ($extension -match ".geom") { 19 | $target_profile="gs_5_0" 20 | } elseif ($extension -match ".frag") { 21 | $target_profile="ps_5_0" 22 | } elseif ($extension -match ".comp") { 23 | $target_profile="cs_5_0" 24 | } 25 | 26 | $genCall = "../../../build/Tools/dxc/bin/x64/dxc.exe -Wno-ignored-attributes -spirv -T $target_profile -E main -Fo ../SPIRV/$name.spv $file" 27 | Invoke-Expression $genCall 28 | } 29 | pause -------------------------------------------------------------------------------- /Source/Client/RenderingClient/VXGIVisualizationPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class VXGIVisualizationPassRenderingContext: public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent* m_input; 10 | uint32_t m_resolution; 11 | }; 12 | 13 | class VXGIVisualizationPass: public IRenderPass 14 | { 15 | public: 16 | INNO_CLASS_SINGLETON(VXGIVisualizationPass) 17 | 18 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 19 | bool Initialize() override; 20 | bool Terminate() override; 21 | ObjectStatus GetStatus() override; 22 | 23 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 24 | RenderPassComponent *GetRenderPassComp() override; 25 | 26 | GPUResourceComponent *GetResult(); 27 | 28 | private: 29 | ObjectStatus m_ObjectStatus; 30 | RenderPassComponent *m_RenderPassComp; 31 | ShaderProgramComponent *m_ShaderProgramComp; 32 | }; 33 | } // namespace Inno 34 | -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/CommonFunctionDefinationMacro.inl: -------------------------------------------------------------------------------- 1 | #define AddComponent(renderingServer, component) \ 2 | component##Component * renderingServer##RenderingServer::Add##component##Component(const char * name) \ 3 | { \ 4 | static std::atomic l_count = 0; \ 5 | l_count++; \ 6 | std::string l_name; \ 7 | if (strcmp(name, "")) \ 8 | { \ 9 | l_name = name; \ 10 | } \ 11 | else \ 12 | { \ 13 | l_name = (std::string(#component) + "_" + std::to_string(l_count) + "/"); \ 14 | } \ 15 | auto l_result = m_##component##ComponentPool->Spawn(); \ 16 | l_result->m_UUID = Randomizer::GenerateUUID(); \ 17 | l_result->m_ObjectStatus = ObjectStatus::Created; \ 18 | l_result->m_Serializable = false; \ 19 | l_result->m_ObjectLifespan = ObjectLifespan::Persistence; \ 20 | auto l_parentEntity = g_Engine->Get()->Spawn(false, ObjectLifespan::Persistence, l_name.c_str()); \ 21 | l_result->m_Owner = l_parentEntity; \ 22 | l_result->m_InstanceName = l_name.c_str(); \ 23 | \ 24 | return l_result; \ 25 | } -------------------------------------------------------------------------------- /Source/Client/RenderingClient/PostTAAPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class PostTAAPassRenderingContext : public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent* m_input; 10 | }; 11 | 12 | class PostTAAPass : IRenderPass 13 | { 14 | public: 15 | INNO_CLASS_SINGLETON(PostTAAPass) 16 | 17 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 18 | bool Initialize() override; 19 | bool Terminate() override; 20 | ObjectStatus GetStatus() override; 21 | 22 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 23 | RenderPassComponent* GetRenderPassComp() override; 24 | 25 | GPUResourceComponent* GetResult(); 26 | 27 | private: 28 | ObjectStatus m_ObjectStatus; 29 | RenderPassComponent* m_RenderPassComp; 30 | ShaderProgramComponent* m_ShaderProgramComp; 31 | TextureComponent* m_Result; 32 | 33 | bool RenderTargetsCreationFunc(); 34 | }; 35 | } // namespace Inno 36 | -------------------------------------------------------------------------------- /Source/Client/LogicClient/DefaultLogicClient.cpp: -------------------------------------------------------------------------------- 1 | #include "DefaultLogicClient.h" 2 | 3 | #include "DefaultLogicClientImpl.inl" 4 | 5 | bool DefaultLogicClient::Setup(ISystemConfig* systemConfig) 6 | { 7 | return GetImpl()->Setup(systemConfig); 8 | } 9 | 10 | bool DefaultLogicClient::Initialize() 11 | { 12 | return GetImpl()->Initialize(); 13 | } 14 | 15 | bool DefaultLogicClient::Update() 16 | { 17 | return GetImpl()->Update(); 18 | } 19 | 20 | bool DefaultLogicClient::Terminate() 21 | { 22 | if (GetImpl()->Terminate()) 23 | { 24 | delete m_Impl; 25 | return true; 26 | } 27 | 28 | return false; 29 | } 30 | 31 | ObjectStatus DefaultLogicClient::GetStatus() 32 | { 33 | return GetImpl()->GetStatus(); 34 | } 35 | 36 | const char* Inno::DefaultLogicClient::GetApplicationName() 37 | { 38 | return GetImpl()->GetApplicationName(); 39 | } 40 | 41 | DefaultLogicClientImpl* Inno::DefaultLogicClient::GetImpl() 42 | { 43 | if (!m_Impl) 44 | m_Impl = new DefaultLogicClientImpl(); 45 | 46 | return m_Impl; 47 | } 48 | -------------------------------------------------------------------------------- /Scripts/ai-main.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # AI Agent Team Main Launch Script 4 | # Replicates VS Code F5 launch for Main configuration 5 | # Equivalent to: VS Code -> Run and Debug -> (Windows) Launch Main 6 | 7 | set -e 8 | 9 | echo "=== AI Agent Team Main Launch ===" 10 | echo "Replicating VS Code F5 main launch..." 11 | 12 | # Check if Main.exe exists 13 | if [ ! -f "Bin/RelWithDebInfo/Main.exe" ]; then 14 | echo "❌ Main.exe not found at Bin/RelWithDebInfo/Main.exe" 15 | echo "Run ai-build.sh first to build the project" 16 | exit 1 17 | fi 18 | 19 | echo "✅ Main.exe found" 20 | echo "" 21 | 22 | # Change to correct working directory (matching VS Code launch.json cwd) 23 | cd Bin 24 | 25 | echo "Working directory: $(pwd)" 26 | echo "Launching Main.exe with arguments from VS Code launch.json..." 27 | echo "" 28 | 29 | # Launch Main.exe with exact arguments from VS Code launch.json 30 | ./RelWithDebInfo/Main.exe -mode 0 -renderer 0 -loglevel 0 -headless 31 | 32 | echo "" 33 | echo "=== Main execution complete ===" 34 | -------------------------------------------------------------------------------- /Source/Engine/Component/RenderPassComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/GraphicsPrimitive.h" 3 | #include "../Component/TextureComponent.h" 4 | #include "../Component/ShaderProgramComponent.h" 5 | 6 | namespace Inno 7 | { 8 | class RenderPassComponent : public Component 9 | { 10 | public: 11 | static uint32_t GetTypeID() { return 11; }; 12 | static const char* GetTypeName() { return "RenderPassComponent"; }; 13 | 14 | ShaderProgramComponent* m_ShaderProgram = 0; 15 | 16 | RenderPassDesc m_RenderPassDesc = {}; 17 | std::vector m_ResourceBindingLayoutDescs; 18 | 19 | size_t m_CurrentFrame = 0; 20 | 21 | std::function m_OnResize; 22 | std::function m_CustomCommandsFunc; 23 | 24 | IOutputMergerTarget* m_OutputMergerTarget = 0; 25 | IPipelineStateObject* m_PipelineStateObject = 0; 26 | std::vector m_ShaderBindingTables; 27 | std::vector m_CommandLists; 28 | std::vector m_Semaphores; 29 | }; 30 | } -------------------------------------------------------------------------------- /Scripts/ai-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # AI Agent Team Test Launch Script 4 | # Replicates VS Code F5 launch for Test configuration 5 | # Equivalent to: VS Code -> Run and Debug -> (Windows) Launch Test 6 | 7 | set -e 8 | 9 | echo "=== AI Agent Team Test Launch ===" 10 | echo "Replicating VS Code F5 test launch..." 11 | 12 | # Check if Test.exe exists 13 | if [ ! -f "Bin/RelWithDebInfo/Test.exe" ]; then 14 | echo "❌ Test.exe not found at Bin/RelWithDebInfo/Test.exe" 15 | echo "Run ai-build.sh first to build the project" 16 | exit 1 17 | fi 18 | 19 | echo "✅ Test.exe found" 20 | echo "" 21 | 22 | # Change to correct working directory (matching VS Code launch.json cwd) 23 | cd Bin 24 | 25 | echo "Working directory: $(pwd)" 26 | echo "Launching Test.exe with headless engine..." 27 | echo "" 28 | 29 | # Launch Test.exe (matching VS Code launch configuration) 30 | # Note: Test.exe already configured with "headless" argument internally 31 | ./RelWithDebInfo/Test.exe 32 | 33 | echo "" 34 | echo "=== Test execution complete ===" 35 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/FinalBlendPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class FinalBlendPassRenderingContext : public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent *m_input; 10 | }; 11 | 12 | class FinalBlendPass : IRenderPass 13 | { 14 | public: 15 | INNO_CLASS_SINGLETON(FinalBlendPass) 16 | 17 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 18 | bool Initialize() override; 19 | bool Terminate() override; 20 | ObjectStatus GetStatus() override; 21 | 22 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 23 | RenderPassComponent *GetRenderPassComp() override; 24 | 25 | GPUResourceComponent *GetResult(); 26 | 27 | private: 28 | ObjectStatus m_ObjectStatus; 29 | RenderPassComponent *m_RenderPassComp; 30 | ShaderProgramComponent *m_ShaderProgramComp; 31 | 32 | TextureComponent* m_Result; 33 | 34 | bool RenderTargetsCreationFunc(); 35 | }; 36 | } // namespace Inno 37 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/LuminanceHistogramPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class LuminanceHistogramPassRenderingContext : public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent *m_input; 10 | }; 11 | 12 | class LuminanceHistogramPass : IRenderPass 13 | { 14 | public: 15 | INNO_CLASS_SINGLETON(LuminanceHistogramPass) 16 | 17 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 18 | bool Initialize() override; 19 | bool Terminate() override; 20 | ObjectStatus GetStatus() override; 21 | 22 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 23 | RenderPassComponent *GetRenderPassComp() override; 24 | 25 | GPUResourceComponent *GetResult(); 26 | 27 | private: 28 | ObjectStatus m_ObjectStatus; 29 | RenderPassComponent *m_RenderPassComp; 30 | ShaderProgramComponent *m_ShaderProgramComp; 31 | 32 | GPUBufferComponent *m_luminanceHistogram = 0; 33 | }; 34 | } // namespace Inno 35 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/VXGIScreenSpaceFeedbackPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class VXGIScreenSpaceFeedbackPassRenderingContext : public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent *m_output; 10 | }; 11 | 12 | class VXGIScreenSpaceFeedbackPass : IRenderPass 13 | { 14 | public: 15 | INNO_CLASS_SINGLETON(VXGIScreenSpaceFeedbackPass) 16 | 17 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 18 | bool Initialize() override; 19 | bool Terminate() override; 20 | ObjectStatus GetStatus() override; 21 | 22 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 23 | RenderPassComponent *GetRenderPassComp() override; 24 | 25 | GPUResourceComponent *GetResult(); 26 | 27 | private: 28 | ObjectStatus m_ObjectStatus; 29 | RenderPassComponent *m_RenderPassComp; 30 | ShaderProgramComponent *m_ShaderProgramComp; 31 | TextureComponent *m_TextureComp; 32 | }; 33 | } // namespace Inno 34 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/RadianceCacheIntegrationPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class RadianceCacheIntegrationPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(RadianceCacheIntegrationPass) 10 | 11 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent* GetRenderPassComp() override; 18 | 19 | GPUResourceComponent* GetResult(); 20 | 21 | private: 22 | const uint32_t TILE_SIZE = 8; 23 | const uint32_t SH_TILE_SIZE = 2; 24 | 25 | ObjectStatus m_ObjectStatus; 26 | RenderPassComponent* m_RenderPassComp; 27 | ShaderProgramComponent* m_ShaderProgramComp; 28 | TextureComponent* m_Result; 29 | 30 | ShaderStage m_ShaderStage; 31 | 32 | bool RenderTargetsCreationFunc(); 33 | }; 34 | } // namespace Inno 35 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/SunShadowGeometryProcessPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class SunShadowGeometryProcessPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(SunShadowGeometryProcessPass) 10 | 11 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Update() override; 14 | bool Terminate() override; 15 | ObjectStatus GetStatus() override; 16 | 17 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 18 | RenderPassComponent* GetRenderPassComp() override; 19 | 20 | uint32_t GetShadowMapResolution(); 21 | GPUResourceComponent* GetResult(); 22 | 23 | private: 24 | ObjectStatus m_ObjectStatus; 25 | RenderPassComponent* m_RenderPassComp; 26 | ShaderProgramComponent* m_ShaderProgramComp; 27 | SamplerComponent* m_SamplerComp; 28 | GPUBufferComponent* m_IndirectDrawCommand; 29 | 30 | uint32_t m_shadowMapResolution = 1024; 31 | }; 32 | } // namespace Inno 33 | -------------------------------------------------------------------------------- /Source/Test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(TEST_SOURCES 2 | Test.cpp 3 | # Common test infrastructure 4 | Common/TestRunner.cpp 5 | Common/TestTimer.cpp 6 | Common/TestData.cpp 7 | # Unit tests 8 | UnitTests/ObjectPoolTests.cpp 9 | UnitTests/ArrayTests.cpp 10 | UnitTests/AtomicTests.cpp 11 | UnitTests/RingBufferTests.cpp 12 | # Performance tests 13 | PerformanceTests/StringConversionPerf.cpp 14 | PerformanceTests/ContainerPerf.cpp 15 | PerformanceTests/MemoryPerf.cpp 16 | # Stress tests 17 | StressTests/ConcurrencyStress.cpp 18 | StressTests/MemoryStress.cpp 19 | StressTests/TaskSystemStressTests.cpp 20 | # Concurrency tests 21 | ConcurrencyTests/TaskSystemTests.cpp 22 | ) 23 | 24 | add_executable(Test ${TEST_SOURCES}) 25 | target_link_libraries(Test Engine) 26 | set_target_properties(Test PROPERTIES FOLDER Test) 27 | 28 | if (INNO_PLATFORM_LINUX) 29 | target_link_libraries(Test -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl -lm -lpthread -lstdc++fs) 30 | endif (INNO_PLATFORM_LINUX) 31 | -------------------------------------------------------------------------------- /Scripts/BakeScene.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [string]$sceneName 3 | ) 4 | 5 | Write-Output "Start to bake scene..." 6 | 7 | Set-Location ../Bin/ 8 | 9 | Write-Output "Generate probe cache and surfel cache for $sceneName scene..." 10 | Start-Process Debug/InnoBaker.exe -ArgumentList "-renderer 1 -mode 0 -loglevel 1 -bakestage probe ..//Res//Scenes//$sceneName.InnoScene" -Wait 11 | 12 | Write-Output "Generate brick cache for $sceneName scene..." 13 | Start-Process Debug/InnoBaker.exe -ArgumentList "-renderer 1 -mode 0 -loglevel 1 -bakestage brickcache ..//Res//Intermediate//$sceneName.InnoSurfelCache" -Wait 14 | 15 | Write-Output "Generate brick for $sceneName scene..." 16 | Start-Process Debug/InnoBaker.exe -ArgumentList "-renderer 1 -mode 0 -loglevel 1 -bakestage brick ..//Res//Intermediate//$sceneName.InnoBrickCacheSummary" -Wait 17 | 18 | Write-Output "Generate brick factor and probe for $sceneName scene..." 19 | Start-Process Debug/InnoBaker.exe -ArgumentList "-renderer 1 -mode 0 -loglevel 1 -bakestage brickfactor ..//Res//Scenes//$sceneName.InnoBrick" -Wait 20 | pause -------------------------------------------------------------------------------- /Res/Shaders/HLSL/RayTracingCommon.hlsl: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | [[vk::binding(0, 0)]] 5 | cbuffer PerFrameConstantBuffer : register(b0) 6 | { 7 | PerFrame_CB g_Frame; 8 | } 9 | 10 | // Global acceleration structure (your TLAS), bound in the global RS (e.g., at t0). 11 | [[vk::binding(0, 1)]] 12 | RaytracingAccelerationStructure SceneAS : register(t0); 13 | 14 | [[vk::binding(1, 1)]] 15 | Texture2D in_opaquePassRT0 : register(t1); // World Space Position (RGB) 16 | [[vk::binding(2, 1)]] 17 | Texture2D in_opaquePassRT1 : register(t2); // World Space Normal (RGB) and Metallic (A) 18 | [[vk::binding(3, 1)]] 19 | Texture2D in_opaquePassRT2 : register(t3); // Albedo (RGB) and Roughness (A) 20 | [[vk::binding(4, 1)]] 21 | Texture2D in_opaquePassRT3 : register(t4); // Motion Vector (RG), AO (B), Transparency (A) 22 | [[vk::binding(5, 1)]] 23 | Texture2D in_lightPassRT0 : register(t5); // Direct Illumination (RGB) 24 | 25 | // RW texture to store computed radiance for each cache entry. 26 | RWTexture2D RadianceCacheResults : register(u0); -------------------------------------------------------------------------------- /Source/Client/RenderingClient/LightPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class LightPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(LightPass) 10 | 11 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent* GetRenderPassComp() override; 18 | 19 | TextureComponent* GetLuminanceResult(); 20 | TextureComponent* GetIlluminanceResult(); 21 | 22 | private: 23 | ObjectStatus m_ObjectStatus; 24 | RenderPassComponent* m_RenderPassComp; 25 | ShaderProgramComponent* m_ShaderProgramComp; 26 | SamplerComponent* m_SamplerComp_Linear; 27 | SamplerComponent* m_SamplerComp_Point; 28 | 29 | TextureComponent* m_LuminanceResult; 30 | TextureComponent* m_IlluminanceResult; 31 | 32 | bool RenderTargetsCreationFunc(); 33 | }; 34 | } // namespace Inno 35 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/GIBakeBrickFactorPass.geom: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct GeometryInputType 5 | { 6 | float4 posWS : SV_POSITION; 7 | float UUID : ID; 8 | }; 9 | 10 | struct PixelInputType 11 | { 12 | float4 posCS : SV_POSITION; 13 | float distanceVS : DISTANCE; 14 | float UUID : ID; 15 | uint rtvId : SV_RenderTargetArrayIndex; 16 | }; 17 | 18 | [maxvertexcount(18)] 19 | void main(triangle GeometryInputType input[3], inout TriangleStream outStream) 20 | { 21 | [unroll(6)] 22 | for (int face = 0; face < 6; face++) 23 | { 24 | PixelInputType output = (PixelInputType)0; 25 | output.rtvId = face; 26 | 27 | [unroll(3)] 28 | for (int i = 0; i < 3; ++i) 29 | { 30 | output.posCS = mul(input[i].posWS, GICBuffer.t); 31 | output.posCS = mul(output.posCS, GICBuffer.r[face]); 32 | output.distanceVS = length(output.posCS.xyz); 33 | output.posCS = mul(output.posCS, GICBuffer.p); 34 | output.UUID = input[i].UUID; 35 | outStream.Append(output); 36 | } 37 | 38 | outStream.RestartStrip(); 39 | } 40 | } -------------------------------------------------------------------------------- /Source/Client/RenderingClient/BSDFTestPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | #include "../../Engine/Common/GPUDataStructure.h" 4 | 5 | namespace Inno 6 | { 7 | class BSDFTestPass : IRenderPass 8 | { 9 | public: 10 | INNO_CLASS_SINGLETON(BSDFTestPass) 11 | 12 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 13 | bool Initialize() override; 14 | bool Terminate() override; 15 | ObjectStatus GetStatus() override; 16 | 17 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 18 | RenderPassComponent *GetRenderPassComp() override; 19 | 20 | GPUResourceComponent *GetResult(); 21 | 22 | private: 23 | ObjectStatus m_ObjectStatus; 24 | RenderPassComponent *m_RenderPassComp; 25 | ShaderProgramComponent *m_ShaderProgramComp; 26 | SamplerComponent *m_SamplerComp; 27 | 28 | std::vector m_meshConstantBuffer; 29 | std::vector m_materialConstantBuffer; 30 | 31 | const size_t m_shpereCount = 10; 32 | }; 33 | } // namespace Inno 34 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/VXGILightPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class VXGILightPassRenderingContext: public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent* m_AlbedoVolume; 10 | GPUResourceComponent* m_NormalVolume; 11 | uint32_t m_resolution; 12 | }; 13 | 14 | class VXGILightPass: IRenderPass 15 | { 16 | public: 17 | INNO_CLASS_SINGLETON(VXGILightPass) 18 | 19 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 20 | bool Initialize() override; 21 | bool Terminate() override; 22 | ObjectStatus GetStatus() override; 23 | 24 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 25 | RenderPassComponent *GetRenderPassComp() override; 26 | 27 | GPUResourceComponent *GetIlluminanceVolume(); 28 | 29 | private: 30 | ObjectStatus m_ObjectStatus; 31 | RenderPassComponent *m_RenderPassComp; 32 | ShaderProgramComponent *m_ShaderProgramComp; 33 | TextureComponent *m_IlluminanceVolume; 34 | }; 35 | } // namespace Inno 36 | -------------------------------------------------------------------------------- /Source/Engine/Platform/HeadlessWindow/HeadlessWindowSystem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Interface/IWindowSystem.h" 3 | #include "../../Common/Object.h" 4 | 5 | namespace Inno 6 | { 7 | class IWindowSurface; 8 | 9 | class HeadlessWindowSystem : public IWindowSystem 10 | { 11 | public: 12 | INNO_CLASS_CONCRETE_NON_COPYABLE(HeadlessWindowSystem); 13 | 14 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 15 | bool Initialize() override; 16 | bool Update() override; 17 | bool Terminate() override; 18 | ObjectStatus GetStatus() override; 19 | std::vector GetDependencies() override; 20 | 21 | IWindowSurface* GetWindowSurface() override; 22 | bool SendEvent(void* windowHook, uint32_t uMsg, uint32_t wParam, int32_t lParam) override; 23 | void ConsumeEvents(const WindowEventProcessCallback& p_Callback) override; 24 | bool AddEventCallback(WindowEventCallback* callback) override; 25 | 26 | private: 27 | ObjectStatus m_ObjectStatus = ObjectStatus::Terminated; 28 | IWindowSurface* m_dummySurface = nullptr; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /Source/Engine/Services/PhysicsSimulationService.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Component/CollisionComponent.h" 3 | #include "../Common/GPUDataStructure.h" 4 | #include "CullingResult.h" 5 | 6 | namespace Inno 7 | { 8 | struct PhysicsSimulationServiceImpl; 9 | class PhysicsSimulationService : public ISystem 10 | { 11 | public: 12 | INNO_CLASS_CONCRETE_NON_COPYABLE(PhysicsSimulationService); 13 | 14 | bool Setup(ISystemConfig* systemConfig) override; 15 | bool Initialize() override; 16 | bool Update() override; 17 | bool Terminate() override; 18 | 19 | ObjectStatus GetStatus(); 20 | 21 | bool CreateCollisionPrimitive(MeshComponent* meshComponent); 22 | bool CreateCollisionComponents(ModelComponent* modelComponent); 23 | 24 | void RunCulling(); 25 | const std::vector& GetCullingResult(); 26 | AABB GetVisibleSceneAABB(); 27 | AABB GetStaticSceneAABB(); 28 | AABB GetTotalSceneAABB(); 29 | 30 | bool AddForce(ModelComponent* modelComponent, Vec4 force); 31 | 32 | private: 33 | PhysicsSimulationServiceImpl* m_Impl; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/VXGIMultiBouncePass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class VXGIMultiBouncePassRenderingContext : public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent *m_input; 10 | GPUResourceComponent *m_output; 11 | }; 12 | 13 | class VXGIMultiBouncePass : IRenderPass 14 | { 15 | public: 16 | INNO_CLASS_SINGLETON(VXGIMultiBouncePass) 17 | 18 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 19 | bool Initialize() override; 20 | bool Terminate() override; 21 | ObjectStatus GetStatus() override; 22 | 23 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 24 | RenderPassComponent *GetRenderPassComp() override; 25 | 26 | GPUResourceComponent *GetResult(); 27 | 28 | private: 29 | ObjectStatus m_ObjectStatus; 30 | RenderPassComponent *m_RenderPassComp; 31 | ShaderProgramComponent *m_ShaderProgramComp; 32 | SamplerComponent *m_SamplerComp; 33 | TextureComponent *m_TextureComp; 34 | }; 35 | } // namespace Inno 36 | -------------------------------------------------------------------------------- /Source/Test/Common/TestTimer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Common/STL14.h" 3 | #include "../../Engine/Common/Timer.h" 4 | 5 | namespace Inno 6 | { 7 | class TestTimer 8 | { 9 | public: 10 | TestTimer() = default; 11 | ~TestTimer() = default; 12 | 13 | void Start(); 14 | void Stop(); 15 | 16 | double GetDurationMs() const; 17 | uint64_t GetDurationMicroseconds() const; 18 | 19 | // Static utility functions 20 | static double MeasureFunction(const std::function& func); 21 | 22 | template 23 | static double MeasurePerformance(size_t iterations, Func&& func); 24 | 25 | private: 26 | uint64_t m_StartTime = 0; 27 | uint64_t m_EndTime = 0; 28 | }; 29 | 30 | // Template implementation (no engine APIs used) 31 | template 32 | double TestTimer::MeasurePerformance(size_t iterations, Func&& func) 33 | { 34 | TestTimer l_Timer; 35 | l_Timer.Start(); 36 | for (size_t i = 0; i < iterations; i++) 37 | { 38 | func(); 39 | } 40 | l_Timer.Stop(); 41 | return l_Timer.GetDurationMs(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/TAAPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class TAAPassRenderingContext : public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent* m_input; 10 | GPUResourceComponent* m_motionVector; 11 | }; 12 | 13 | class TAAPass : IRenderPass 14 | { 15 | public: 16 | INNO_CLASS_SINGLETON(TAAPass) 17 | 18 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 19 | bool Initialize() override; 20 | bool Terminate() override; 21 | ObjectStatus GetStatus() override; 22 | 23 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 24 | RenderPassComponent* GetRenderPassComp() override; 25 | 26 | GPUResourceComponent* GetResult(); 27 | 28 | private: 29 | ObjectStatus m_ObjectStatus; 30 | RenderPassComponent* m_RenderPassComp; 31 | ShaderProgramComponent* m_ShaderProgramComp; 32 | 33 | TextureComponent* m_OddTextureComp; 34 | TextureComponent* m_EvenTextureComp; 35 | 36 | bool RenderTargetsCreationFunc(); 37 | }; 38 | } // namespace Inno 39 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/postTAAPass.comp: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct ComputeInputType 5 | { 6 | uint3 groupID : SV_GroupID; // 3D index of the thread group in the dispatch. 7 | uint3 groupThreadID : SV_GroupThreadID; // 3D index of local thread ID in a thread group. 8 | uint3 dispatchThreadID : SV_DispatchThreadID; // 3D index of global thread ID in the dispatch. 9 | uint groupIndex : SV_GroupIndex; // Flattened local index of the thread within a thread group. 10 | }; 11 | 12 | [[vk::binding(0, 1)]] 13 | Texture2D in_TAAPassRT0 : register(t0); 14 | [[vk::binding(0, 2)]] 15 | RWTexture2D out_postTAAPassRT0 : register(u0); 16 | 17 | #include "common/Tonemapping.hlsl" 18 | 19 | [numthreads(8, 8, 1)] 20 | void main(ComputeInputType input) 21 | { 22 | float4 TAAResult = in_TAAPassRT0[input.dispatchThreadID.xy]; 23 | float3 currentColor = TAAResult.rgb; 24 | 25 | // Undo tone mapping 26 | float3 finalColor = TonemapInvertReinhardLuma(currentColor); 27 | 28 | out_postTAAPassRT0[input.dispatchThreadID.xy] = float4(currentColor, 1.0); 29 | } -------------------------------------------------------------------------------- /Source/Client/RenderingClient/VXGIConvertPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class VXGIConvertPassRenderingContext: public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent* m_input; 10 | uint32_t m_resolution; 11 | }; 12 | 13 | class VXGIConvertPass: IRenderPass 14 | { 15 | public: 16 | INNO_CLASS_SINGLETON(VXGIConvertPass) 17 | 18 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 19 | bool Initialize() override; 20 | bool Terminate() override; 21 | ObjectStatus GetStatus() override; 22 | 23 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 24 | RenderPassComponent *GetRenderPassComp() override; 25 | 26 | GPUResourceComponent *GetAlbedoVolume(); 27 | GPUResourceComponent *GetNormalVolume(); 28 | 29 | private: 30 | ObjectStatus m_ObjectStatus; 31 | RenderPassComponent *m_RenderPassComp; 32 | ShaderProgramComponent *m_ShaderProgramComp; 33 | TextureComponent *m_AlbedoVolume; 34 | TextureComponent *m_NormalVolume; 35 | }; 36 | } // namespace Inno 37 | -------------------------------------------------------------------------------- /Source/Tool/Baker/ProbeGenerator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Common.h" 3 | #include "../../Engine/Engine.h" 4 | 5 | namespace Inno 6 | { 7 | namespace Baker 8 | { 9 | class ProbeGenerator 10 | { 11 | INNO_CLASS_SINGLETON(ProbeGenerator) 12 | 13 | void setup(); 14 | bool gatherStaticMeshData(); 15 | bool generateProbeCaches(std::vector& probes); 16 | ProbeInfo generateProbes(std::vector& probes, const std::vector& heightMap, uint32_t probeMapSamplingInterval); 17 | bool generateProbesAlongTheSurface(std::vector& probes, const std::vector& heightMap, uint32_t probeMapSamplingInterval); 18 | uint32_t generateProbesAlongTheWall(std::vector& probes, const std::vector& heightMap, uint32_t probeMapSamplingInterval); 19 | bool assignBrickFactorToProbesByGPU(const std::vector& bricks, std::vector& probes); 20 | 21 | RenderPassComponent* m_RenderPassComp_Probe; 22 | ShaderProgramComponent* m_SPC_Probe; 23 | }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Source/Engine/Component/DX12ShaderProgramComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ShaderProgramComponent.h" 3 | #include "../RenderingServer/DX12/DX12Headers.h" 4 | 5 | namespace Inno 6 | { 7 | class DX12ShaderProgramComponent : public ShaderProgramComponent 8 | { 9 | public: 10 | #ifdef USE_DXIL 11 | std::vector m_VSBuffer; 12 | std::vector m_HSBuffer; 13 | std::vector m_DSBuffer; 14 | std::vector m_GSBuffer; 15 | std::vector m_PSBuffer; 16 | std::vector m_CSBuffer; 17 | std::vector m_RayGenBuffer; 18 | std::vector m_AnyHitBuffer; 19 | std::vector m_ClosestHitBuffer; 20 | std::vector m_MissBuffer; 21 | #else 22 | ComPtr m_VSBuffer = 0; 23 | ComPtr m_HSBuffer = 0; 24 | ComPtr m_DSBuffer = 0; 25 | ComPtr m_GSBuffer = 0; 26 | ComPtr m_PSBuffer = 0; 27 | ComPtr m_CSBuffer = 0; 28 | ComPtr m_RayGenBuffer = 0; 29 | ComPtr m_AnyHitBuffer = 0; 30 | ComPtr m_ClosestHitBuffer = 0; 31 | ComPtr m_MissBuffer = 0; 32 | #endif 33 | }; 34 | } // namespace Inno -------------------------------------------------------------------------------- /Source/Client/RenderingClient/SSAOPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class SSAOPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(SSAOPass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent *GetRenderPassComp() override; 18 | 19 | GPUResourceComponent *GetResult(); 20 | 21 | private: 22 | ObjectStatus m_ObjectStatus; 23 | RenderPassComponent *m_RenderPassComp; 24 | ShaderProgramComponent *m_ShaderProgramComp; 25 | SamplerComponent *m_SamplerComp; 26 | SamplerComponent *m_SamplerComp_RandomRot; 27 | 28 | uint32_t m_kernelSize = 64; 29 | std::vector m_Kernel; 30 | std::vector m_Noise; 31 | 32 | GPUBufferComponent *m_KernelGPUBuffer; 33 | TextureComponent *m_NoiseTexture; 34 | TextureComponent* m_Result; 35 | 36 | bool RenderTargetsCreationFunc(); 37 | }; 38 | } // namespace Inno 39 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/TiledFrustumGenerationPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class TiledFrustumGenerationPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(TiledFrustumGenerationPass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Update() override; 14 | bool Terminate() override; 15 | ObjectStatus GetStatus() override; 16 | 17 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 18 | RenderPassComponent *GetRenderPassComp() override; 19 | 20 | GPUResourceComponent *GetTiledFrustum(); 21 | 22 | private: 23 | ObjectStatus m_ObjectStatus; 24 | RenderPassComponent *m_RenderPassComp; 25 | ShaderProgramComponent *m_ShaderProgramComp; 26 | GPUBufferComponent* m_TiledFrustum; 27 | const uint32_t m_tileSize = 16; 28 | const uint32_t m_numThreadPerGroup = 16; 29 | Math::TVec4 m_numThreads; 30 | Math::TVec4 m_numThreadGroups; 31 | 32 | bool CreateResources(); 33 | bool RenderTargetsCreationFunc(); 34 | }; 35 | } // namespace Inno 36 | -------------------------------------------------------------------------------- /Source/Engine/Services/BVHService.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Component/CollisionComponent.h" 3 | #include "../Common/GPUDataStructure.h" 4 | 5 | namespace Inno 6 | { 7 | struct BVHNode 8 | { 9 | AABB m_AABB; 10 | 11 | std::vector::iterator m_Parent; 12 | std::vector::iterator m_LeftChild; 13 | std::vector::iterator m_RightChild; 14 | size_t m_Depth = 0; 15 | 16 | CollisionComponent* CollisionComponent = 0; 17 | 18 | bool operator==(const BVHNode& other) const 19 | { 20 | return ( 21 | m_Parent == other.m_Parent 22 | && m_LeftChild == other.m_LeftChild 23 | && m_RightChild == other.m_RightChild 24 | ); 25 | } 26 | }; 27 | 28 | struct BVHServiceImpl; 29 | class BVHService 30 | { 31 | public: 32 | BVHService(); 33 | 34 | void Update(); 35 | void AddNode(CollisionComponent* CollisionComponent); 36 | void ClearNodes(); 37 | const std::vector& GetNodes(); 38 | 39 | private: 40 | BVHServiceImpl* m_Impl; 41 | }; 42 | } -------------------------------------------------------------------------------- /Source/Client/RenderingClient/SurfelGITestPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | struct ProbePos 7 | { 8 | Math::Vec4 pos; 9 | Math::Vec4 index; 10 | }; 11 | 12 | struct ProbeMeshData 13 | { 14 | Math::Mat4 m; 15 | Math::Vec4 index; 16 | float padding[12]; 17 | }; 18 | 19 | class SurfelGITestPass : IRenderPass 20 | { 21 | public: 22 | INNO_CLASS_SINGLETON(SurfelGITestPass) 23 | 24 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 25 | bool Initialize() override; 26 | bool Terminate() override; 27 | ObjectStatus GetStatus() override; 28 | 29 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 30 | RenderPassComponent *GetRenderPassComp() override; 31 | 32 | GPUResourceComponent *GetResult(); 33 | 34 | private: 35 | ObjectStatus m_ObjectStatus; 36 | RenderPassComponent *m_RenderPassComp; 37 | ShaderProgramComponent *m_ShaderProgramComp; 38 | SamplerComponent *m_SamplerComp; 39 | 40 | GPUBufferComponent* m_probeSphereMeshGPUBufferComp = 0; 41 | std::vector m_probeSphereMeshData; 42 | }; 43 | } // namespace Inno 44 | -------------------------------------------------------------------------------- /Source/Editor/directorytreeviewer.cpp: -------------------------------------------------------------------------------- 1 | #include "directorytreeviewer.h" 2 | #include 3 | 4 | #include "../Engine/Engine.h" 5 | 6 | using namespace Inno; 7 | Engine *g_Engine; 8 | 9 | DirectoryTreeViewer::DirectoryTreeViewer(QWidget *parent) : QTreeView(parent) 10 | { 11 | m_dirModel = new QFileSystemModel(this); 12 | m_dirModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs); 13 | this->setModel(m_dirModel); 14 | this->setColumnHidden(1, true); 15 | this->setColumnHidden(2, true); 16 | this->setColumnHidden(3, true); 17 | } 18 | 19 | void DirectoryTreeViewer::Initialize() 20 | { 21 | } 22 | 23 | QString DirectoryTreeViewer::GetRootPath() 24 | { 25 | return m_dirModel->filePath(rootIndex()); 26 | } 27 | 28 | void DirectoryTreeViewer::SetRootPath(QString path) 29 | { 30 | this->setRootIndex(m_dirModel->setRootPath(path)); 31 | } 32 | 33 | void DirectoryTreeViewer::SetActivePath(QString path) 34 | { 35 | this->scrollTo(m_dirModel->index(path), QAbstractItemView::PositionAtBottom); 36 | } 37 | 38 | QString DirectoryTreeViewer::GetFilePath(QModelIndex index) 39 | { 40 | return m_dirModel->fileInfo(index).absoluteFilePath(); 41 | } 42 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/GIBakeSurfelPass.geom: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct GeometryInputType 5 | { 6 | float4 posWS : SV_POSITION; 7 | float2 texCoord : TEXCOORD; 8 | float4 normalWS : NORMAL; 9 | }; 10 | 11 | struct PixelInputType 12 | { 13 | float4 posCS : SV_POSITION; 14 | float4 posWS : POSITION; 15 | float2 texCoord : TEXCOORD; 16 | float4 normalWS : NORMAL; 17 | uint rtvId : SV_RenderTargetArrayIndex; 18 | }; 19 | 20 | [maxvertexcount(18)] 21 | void main(triangle GeometryInputType input[3], inout TriangleStream outStream) 22 | { 23 | [unroll(6)] 24 | for (int face = 0; face < 6; face++) 25 | { 26 | PixelInputType output = (PixelInputType)0; 27 | output.rtvId = face; 28 | 29 | [unroll(3)] 30 | for (int i = 0; i < 3; ++i) 31 | { 32 | output.posWS = input[i].posWS; 33 | output.posCS = mul(output.posWS, GICBuffer.t); 34 | output.posCS = mul(output.posCS, GICBuffer.r[face]); 35 | output.posCS = mul(output.posCS, GICBuffer.p); 36 | output.texCoord = input[i].texCoord; 37 | output.normalWS = input[i].normalWS; 38 | outStream.Append(output); 39 | } 40 | 41 | outStream.RestartStrip(); 42 | } 43 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/GIResolveSkyIrradiancePass.comp: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct ComputeInputType 5 | { 6 | uint3 groupID : SV_GroupID; // 3D index of the thread group in the dispatch. 7 | uint3 groupThreadID : SV_GroupThreadID; // 3D index of local thread ID in a thread group. 8 | uint3 dispatchThreadID : SV_DispatchThreadID; // 3D index of global thread ID in the dispatch. 9 | uint groupIndex : SV_GroupIndex; // Flattened local index of the thread within a thread group. 10 | }; 11 | 12 | [[vk::binding(0, 0)]] 13 | RWTexture3D in_skyRadiance : register(u0); 14 | [[vk::binding(1, 0)]] 15 | RWStructuredBuffer out_skyIrradiance : register(u1); 16 | 17 | [numthreads(8, 8, 8)] 18 | void main(ComputeInputType input) 19 | { 20 | if (input.dispatchThreadID.x < 6) 21 | { 22 | float3 color = float3(0.0, 0.0, 0.0); 23 | 24 | for (int i = 0; i < 8; i++) 25 | { 26 | for (int j = 0; j < 8; j++) 27 | { 28 | color += in_skyRadiance[int3(i, j, input.dispatchThreadID.x)].rgb; 29 | } 30 | } 31 | 32 | color /= 32.0; 33 | 34 | out_skyIrradiance[input.dispatchThreadID.x] = float4(color, 1.0); 35 | } 36 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/sunShadowGeometryProcessPass.geom: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct GeometryInputType 5 | { 6 | float4 posWS : SV_POSITION; 7 | float2 texCoord : TEXCOORD; 8 | }; 9 | 10 | struct PixelInputType 11 | { 12 | float4 posCS : SV_POSITION; 13 | float2 texCoord : TEXCOORD; 14 | uint rtvId : SV_RenderTargetArrayIndex; 15 | }; 16 | 17 | [[vk::binding(1, 0)]] 18 | cbuffer CSMCBuffer : register(b1) 19 | { 20 | CSM_CB CSMs[NR_CSM_SPLITS]; 21 | }; 22 | 23 | [maxvertexcount(3 * NR_CSM_SPLITS)] 24 | void main(triangle GeometryInputType input[3], inout TriangleStream outStream) 25 | { 26 | [unroll(NR_CSM_SPLITS)] 27 | for (int CSMSplitIndex = 0; CSMSplitIndex < NR_CSM_SPLITS; CSMSplitIndex++) 28 | { 29 | [unroll(3)] 30 | for (int i = 0; i < 3; ++i) 31 | { 32 | PixelInputType output; 33 | output.rtvId = CSMSplitIndex; 34 | output.posCS = mul(input[i].posWS, CSMs[CSMSplitIndex].v); 35 | output.posCS = mul(output.posCS, CSMs[CSMSplitIndex].p); 36 | output.posCS /= output.posCS.w; 37 | output.texCoord = input[i].texCoord; 38 | outStream.Append(output); 39 | } 40 | 41 | outStream.RestartStrip(); 42 | } 43 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/MacMain/MacWindowSystemBridgeImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // MacWindowSystemBridgeImpl.h 3 | // Main 4 | // 5 | // Created by zhangdoa on 14/04/2019. 6 | // Copyright © 2019 InnocenceEngine. All rights reserved. 7 | // 8 | 9 | #ifndef MacWindowSystemBridgeImpl_h 10 | #define MacWindowSystemBridgeImpl_h 11 | 12 | #import "../MacWindow/MacWindowSystemBridge.h" 13 | #import "MacWindowDelegate.h" 14 | #import "MetalDelegate.h" 15 | 16 | namespace Inno 17 | { 18 | class MacWindowSystemBridgeImpl : public MacWindowSystemBridge 19 | { 20 | public: 21 | explicit MacWindowSystemBridgeImpl(MacWindowDelegate *macWindowDelegate, MetalDelegate *metalDelegate); 22 | ~MacWindowSystemBridgeImpl(); 23 | 24 | bool Setup(uint32_t sizeX, uint32_t sizeY) override; 25 | bool Initialize() override; 26 | bool Update() override; 27 | bool Terminate() override; 28 | 29 | ObjectStatus GetStatus() override; 30 | 31 | private: 32 | ObjectStatus m_ObjectStatus = ObjectStatus::Terminated; 33 | MacWindowDelegate *m_macWindowDelegate = nullptr; 34 | MetalDelegate *m_metalDelegate = nullptr; 35 | NSApplication *app; 36 | }; 37 | } // namespace Inno 38 | #endif /* MacWindowSystemBridgeImpl_h */ 39 | -------------------------------------------------------------------------------- /Source/Engine/Component/CameraComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/Object.h" 3 | #include "../Common/MathHelper.h" 4 | #include "../Interface/ISystem.h" 5 | 6 | namespace Inno 7 | { 8 | class CameraComponent : public Component 9 | { 10 | public: 11 | static uint32_t GetTypeID() { return 4; }; 12 | static const char* GetTypeName() { return "CameraComponent"; }; 13 | 14 | Mat4 m_projectionMatrix; 15 | Frustum m_frustum; 16 | Ray m_rayOfEye; 17 | float m_FOVX = 0.0f; 18 | float m_widthScale = 0.0f; 19 | float m_heightScale = 0.0f; 20 | float m_zNear = 0.0f; 21 | float m_zFar = 0.0f; 22 | float m_WHRatio = 0.0f; 23 | float m_aperture = 2.2f; 24 | float m_shutterTime = 1.0f / 2000.0f; 25 | float m_ISO = 100.0f; 26 | 27 | std::vector m_splitFrustumVerticesWS; 28 | }; 29 | 30 | class ICameraSystem : public ISystem 31 | { 32 | public: 33 | INNO_CLASS_INTERFACE_NON_COPYABLE(ICameraSystem); 34 | 35 | virtual void SetMainCamera(CameraComponent* cameraComponent) = 0; 36 | virtual CameraComponent* GetMainCamera() = 0; 37 | virtual void SetActiveCamera(CameraComponent* cameraComponent) = 0; 38 | virtual CameraComponent* GetActiveCamera() = 0; 39 | }; 40 | } -------------------------------------------------------------------------------- /Source/Tool/Reflector/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_program(LLVM_BIN llvm-ar HINTS ENV PATH) 2 | if(LLVM_BIN) 3 | get_filename_component(LLVM_BIN_DIR ${LLVM_BIN} DIRECTORY) 4 | message(STATUS "Found LLVM ${LLVM_BIN_DIR}") 5 | if (NOT INNO_PLATFORM_MAC) 6 | add_executable(Reflector Reflector.cpp) 7 | set_target_properties(Reflector PROPERTIES FOLDER Tool) 8 | target_link_libraries(Reflector Common) 9 | target_include_directories(Reflector PRIVATE "${INNO_SUBMODULE_DIRECTORIES}/json/include") 10 | target_include_directories(Reflector PRIVATE ${LLVM_BIN_DIR}/../include) 11 | target_link_libraries(Reflector ${LLVM_BIN_DIR}/../lib/libclang.lib) 12 | if (INNO_PLATFORM_WIN) 13 | if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") 14 | set_target_properties(Reflector PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") 15 | endif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") 16 | endif (INNO_PLATFORM_WIN) 17 | if (INNO_PLATFORM_LINUX) 18 | target_link_libraries(Reflector -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor -ldl -lm -lpthread -lstdc++fs) 19 | endif (INNO_PLATFORM_LINUX) 20 | endif (NOT INNO_PLATFORM_MAC) 21 | # Add LLVM bin folder to system path 22 | list(APPEND CMAKE_SYSTEM_PATH ${LLVM_BIN_DIR}) 23 | endif() 24 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/TransparentGeometryProcessPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class TransparentGeometryProcessPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(TransparentGeometryProcessPass) 10 | 11 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Terminate() override; 14 | ObjectStatus GetStatus() override; 15 | 16 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 17 | RenderPassComponent *GetRenderPassComp() override; 18 | 19 | GPUBufferComponent *GetResultChannel0(); 20 | GPUBufferComponent *GetResultChannel1(); 21 | TextureComponent *GetHeadPtrTexture(); 22 | 23 | private: 24 | ObjectStatus m_ObjectStatus; 25 | RenderPassComponent *m_RenderPassComp; 26 | ShaderProgramComponent *m_ShaderProgramComp; 27 | 28 | GPUBufferComponent* m_atomicCounterGPUBufferComp; 29 | GPUBufferComponent* m_RT0; 30 | GPUBufferComponent* m_RT1; 31 | TextureComponent* m_HeadPtr; 32 | 33 | bool DepthStencilRenderTargetsReservationFunc(); 34 | bool DepthStencilRenderTargetsCreationFunc(); 35 | }; 36 | } // namespace Inno 37 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/billboardPass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct billboardMeshData 5 | { 6 | matrix m; 7 | matrix m_prev; 8 | matrix normalMat; 9 | float UUID; 10 | float padding[15]; 11 | }; 12 | 13 | [[vk::binding(12, 0)]] 14 | StructuredBuffer billboardSBuffer : register(t12); 15 | 16 | struct PixelInputType 17 | { 18 | float4 posCS : SV_POSITION; 19 | float2 texCoord : TEXCOORD; 20 | }; 21 | 22 | PixelInputType main(VertexInputType input) 23 | { 24 | PixelInputType output; 25 | 26 | float4 posWS = float4(billboardSBuffer[input.instanceId].m[3][0], billboardSBuffer[input.instanceId].m[3][1], billboardSBuffer[input.instanceId].m[3][2], 1.0); 27 | float distance = length(posWS.xyz - perFrameCBuffer.camera_posWS.xyz); 28 | output.posCS = mul(posWS, perFrameCBuffer.v); 29 | output.posCS = mul(output.posCS, perFrameCBuffer.p_original); 30 | output.posCS /= output.posCS.w; 31 | float denom = distance; 32 | float2 shearingRatio = float2(perFrameCBuffer.viewportSize.y / perFrameCBuffer.viewportSize.x, 1.0) / clamp(denom, 1.0, distance); 33 | output.posCS.xy += input.posLS.xy * shearingRatio; 34 | output.texCoord = input.texCoord; 35 | 36 | return output; 37 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/common/CBuffers.hlsl: -------------------------------------------------------------------------------- 1 | cbuffer RootConstants : register(b0) 2 | { 3 | uint m_ObjectIndex; 4 | }; 5 | 6 | [[vk::binding(2, 0)]] 7 | cbuffer pointLightCBuffer : register(b2) 8 | { 9 | PointLight_CB pointLights[NR_POINT_LIGHTS]; 10 | }; 11 | 12 | [[vk::binding(3, 0)]] 13 | cbuffer sphereLightCBuffer : register(b3) 14 | { 15 | SphereLight_CB sphereLights[NR_SPHERE_LIGHTS]; 16 | }; 17 | 18 | cbuffer RootConstants : register(b0) 19 | { 20 | uint m_ObjectIndex; 21 | }; 22 | 23 | StructuredBuffer g_Objects : register(t0); 24 | StructuredBuffer g_Materials : register(t1); 25 | Texture2D g_2DTextures[] : register(t2); 26 | SamplerState g_Samplers[] : register(s0); 27 | 28 | [[vk::binding(6, 0)]] 29 | cbuffer dispatchParamsCBuffer : register(b6) 30 | { 31 | DispatchParams_CB dispatchParams[8]; 32 | } 33 | 34 | [[vk::binding(8, 0)]] 35 | cbuffer GICBuffer : register(b8) 36 | { 37 | GI_CB GICBuffer; 38 | }; 39 | 40 | [[vk::binding(9, 0)]] 41 | cbuffer voxelizationPassCBuffer : register(b9) 42 | { 43 | VoxelizationPass_CB voxelizationPassCBuffer; 44 | }; 45 | 46 | [[vk::binding(10, 0)]] 47 | cbuffer animationPassCBuffer : register(b10) 48 | { 49 | AnimationPass_CB animationPassCBuffer; 50 | }; -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/ImGuiWrapper/ImGuiRendererVK.cpp: -------------------------------------------------------------------------------- 1 | #include "ImGuiRendererVK.h" 2 | 3 | #include "../../Engine.h" 4 | using namespace Inno; 5 | ; 6 | 7 | namespace ImGuiRendererVKNS 8 | { 9 | ObjectStatus m_ObjectStatus = ObjectStatus::Terminated; 10 | } 11 | 12 | bool ImGuiRendererVK::Setup(ISystemConfig* systemConfig) 13 | { 14 | ImGuiRendererVKNS::m_ObjectStatus = ObjectStatus::Activated; 15 | Log(Success, "ImGuiRendererVK Setup finished."); 16 | 17 | return true; 18 | } 19 | 20 | bool ImGuiRendererVK::Initialize() 21 | { 22 | Log(Success, "ImGuiRendererVK has been initialized."); 23 | 24 | return true; 25 | } 26 | 27 | bool ImGuiRendererVK::NewFrame() 28 | { 29 | return true; 30 | } 31 | 32 | bool ImGuiRendererVK::Prepare() 33 | { 34 | return true; 35 | } 36 | 37 | bool ImGuiRendererVK::ExecuteCommands() 38 | { 39 | return true; 40 | } 41 | 42 | bool ImGuiRendererVK::Terminate() 43 | { 44 | ImGuiRendererVKNS::m_ObjectStatus = ObjectStatus::Terminated; 45 | Log(Success, "ImGuiRendererVK has been terminated."); 46 | 47 | return true; 48 | } 49 | 50 | ObjectStatus ImGuiRendererVK::GetStatus() 51 | { 52 | return ImGuiRendererVKNS::m_ObjectStatus; 53 | } 54 | 55 | void ImGuiRendererVK::ShowRenderResult(RenderPassType renderPassType) 56 | { 57 | } -------------------------------------------------------------------------------- /Source/Engine/Common/LogServiceSpecialization.h: -------------------------------------------------------------------------------- 1 | #include "LogService.h" 2 | #include "Enum.h" 3 | #include "MathHelper.h" 4 | #include "Object.h" 5 | 6 | namespace Inno 7 | { 8 | template <> 9 | inline void LogService::LogContent(const Vec2& values) 10 | { 11 | LogContent("Vec2(x: ", values.x, ", y: ", values.y, ")"); 12 | } 13 | 14 | template <> 15 | inline void LogService::LogContent(const Vec4& values) 16 | { 17 | LogContent("Vec4(x: ", values.x, ", y: ", values.y, ", z: ", values.z, ", w: ", values.w, ")"); 18 | } 19 | 20 | template <> 21 | inline void LogService::LogContent(const Mat4& values) 22 | { 23 | LogContent( 24 | "Mat4: \n|", 25 | values.m00, "", values.m10, "", values.m20, "", values.m30, "|\n|", 26 | values.m01, "", values.m11, "", values.m21, "", values.m31, "|\n|", 27 | values.m02, "", values.m12, "", values.m22, "", values.m32, "|\n|", 28 | values.m03, "", values.m13, "", values.m23, "", values.m33, "|\n"); 29 | } 30 | 31 | template <> 32 | inline void LogService::LogContent(ObjectName& values) 33 | { 34 | LogContent("[Object Name: ", values.c_str(), "]"); 35 | } 36 | 37 | template <> 38 | inline void LogService::LogContent(const ObjectName& values) 39 | { 40 | LogContent(const_cast(values)); 41 | } 42 | } -------------------------------------------------------------------------------- /Source/Editor/transformcomponentpropertyeditor.h: -------------------------------------------------------------------------------- 1 | #ifndef TRANSFORMCOMPONENTPROPERTYEDITOR_H 2 | #define TRANSFORMCOMPONENTPROPERTYEDITOR_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "icomponentpropertyeditor.h" 8 | #include "combolabeltext.h" 9 | #include "../Engine/Component/TransformComponent.h" 10 | 11 | class TransformComponentPropertyEditor : public IComponentPropertyEditor 12 | { 13 | Q_OBJECT 14 | public: 15 | TransformComponentPropertyEditor(); 16 | 17 | void initialize() override; 18 | void edit(void* component) override; 19 | 20 | void GetPosition(); 21 | void GetRotation(); 22 | void GetScale(); 23 | 24 | private: 25 | QLabel* m_posLabel; 26 | ComboLabelText* m_posX; 27 | ComboLabelText* m_posY; 28 | ComboLabelText* m_posZ; 29 | 30 | QLabel* m_rotLabel; 31 | ComboLabelText* m_rotX; 32 | ComboLabelText* m_rotY; 33 | ComboLabelText* m_rotZ; 34 | 35 | QLabel* m_scaleLabel; 36 | ComboLabelText* m_scaleX; 37 | ComboLabelText* m_scaleY; 38 | ComboLabelText* m_scaleZ; 39 | 40 | Inno::TransformComponent* m_component; 41 | 42 | public slots: 43 | void SetPosition(); 44 | void SetRotation(); 45 | void SetScale(); 46 | void remove() override; 47 | }; 48 | 49 | #endif // TRANSFORMCOMPONENTPROPERTYEDITOR_H 50 | -------------------------------------------------------------------------------- /Source/Editor/materialcomponentpropertyeditor.h: -------------------------------------------------------------------------------- 1 | #ifndef MATERIALCOMPONENTPROPERTYEDITOR_H 2 | #define MATERIALCOMPONENTPROPERTYEDITOR_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "icomponentpropertyeditor.h" 9 | #include "combolabeltext.h" 10 | #include "../Engine/Component/MaterialComponent.h" 11 | 12 | class MaterialComponentPropertyEditor : public IComponentPropertyEditor 13 | { 14 | Q_OBJECT 15 | public: 16 | MaterialComponentPropertyEditor(); 17 | 18 | void initialize() override; 19 | void edit(void* component) override; 20 | 21 | void GetMaterialAttributes(); 22 | 23 | private: 24 | QLabel* m_albedoLabel; 25 | ComboLabelText* m_albedoR; 26 | ComboLabelText* m_albedoG; 27 | ComboLabelText* m_albedoB; 28 | ComboLabelText* m_alpha; 29 | 30 | QLabel* m_MRATLabel; 31 | ComboLabelText* m_metallic; 32 | ComboLabelText* m_roughness; 33 | ComboLabelText* m_AO; 34 | ComboLabelText* m_thickness; 35 | 36 | ComboLabelText* m_shaderModel; 37 | 38 | Inno::MaterialComponent* m_component; 39 | 40 | public slots: 41 | void SetMaterialAttributes(); 42 | 43 | void remove() override; 44 | }; 45 | 46 | #endif // MATERIALCOMPONENTPROPERTYEDITOR_H 47 | -------------------------------------------------------------------------------- /Source/Engine/Services/GUISystem.cpp: -------------------------------------------------------------------------------- 1 | #include "GUISystem.h" 2 | #include "../ThirdParty/ImGuiWrapper/ImGuiWrapper.h" 3 | #include "HIDService.h" 4 | 5 | #include "../Engine.h" 6 | using namespace Inno; 7 | 8 | namespace GUISystemNS 9 | { 10 | bool m_showImGui = false; 11 | std::function f_toggleshowImGui; 12 | } 13 | 14 | using namespace GUISystemNS; 15 | 16 | bool GUISystem::Setup(ISystemConfig* systemConfig) 17 | { 18 | f_toggleshowImGui = [&]() { 19 | m_showImGui = !m_showImGui; 20 | }; 21 | g_Engine->Get()->AddButtonStateCallback(ButtonState{ INNO_KEY_I, true }, ButtonEvent{ EventLifeTime::OneShot, &f_toggleshowImGui }); 22 | 23 | return ImGuiWrapper::Get().Setup(); 24 | } 25 | 26 | bool GUISystem::Initialize() 27 | { 28 | return ImGuiWrapper::Get().Initialize(); 29 | } 30 | 31 | bool GUISystem::Update() 32 | { 33 | if (m_showImGui) 34 | { 35 | ImGuiWrapper::Get().Prepare(); 36 | } 37 | 38 | return true; 39 | } 40 | 41 | bool GUISystem::ExecuteCommands() 42 | { 43 | if (m_showImGui) 44 | { 45 | ImGuiWrapper::Get().ExecuteCommands(); 46 | } 47 | 48 | return true; 49 | } 50 | 51 | bool GUISystem::Terminate() 52 | { 53 | return ImGuiWrapper::Get().Terminate(); 54 | } 55 | 56 | ObjectStatus GUISystem::GetStatus() 57 | { 58 | return ObjectStatus(); 59 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/preTAAPass.comp: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct ComputeInputType 5 | { 6 | uint3 groupID : SV_GroupID; // 3D index of the thread group in the dispatch. 7 | uint3 groupThreadID : SV_GroupThreadID; // 3D index of local thread ID in a thread group. 8 | uint3 dispatchThreadID : SV_DispatchThreadID; // 3D index of global thread ID in the dispatch. 9 | uint groupIndex : SV_GroupIndex; // Flattened local index of the thread within a thread group. 10 | }; 11 | 12 | [[vk::binding(0, 1)]] 13 | Texture2D in_lightPassRT0 : register(t0); 14 | [[vk::binding(1, 1)]] 15 | Texture2D in_skyPassRT0 : register(t1); 16 | [[vk::binding(0, 2)]] 17 | RWTexture2D out_preTAAPassRT0 : register(u0); 18 | 19 | [numthreads(8, 8, 1)] 20 | void main(ComputeInputType input) 21 | { 22 | float2 flipYTexCoord = input.dispatchThreadID.xy; 23 | 24 | float4 lightPassRT0 = in_lightPassRT0[input.dispatchThreadID.xy]; 25 | float4 skyPassRT0 = in_skyPassRT0[input.dispatchThreadID.xy]; 26 | 27 | float3 finalColor = float3(0.0, 0.0, 0.0); 28 | 29 | if (lightPassRT0.a == 0.0) 30 | { 31 | finalColor += skyPassRT0.rgb; 32 | } 33 | else 34 | { 35 | finalColor += lightPassRT0.rgb; 36 | } 37 | 38 | out_preTAAPassRT0[input.dispatchThreadID.xy] = float4(finalColor, 1.0); 39 | } -------------------------------------------------------------------------------- /Source/Engine/Common/Object.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "FixedSizeString.h" 3 | #include "Config.h" 4 | 5 | namespace Inno 6 | { 7 | enum class ObjectStatus 8 | { 9 | Invalid, 10 | Created, 11 | Activated, 12 | Suspended, 13 | Terminated, 14 | }; 15 | 16 | enum class ObjectLifespan 17 | { 18 | Invalid, 19 | Persistence, 20 | Scene, 21 | Frame, 22 | }; 23 | 24 | using ObjectName = FixedSizeString<128>; 25 | 26 | class Object 27 | { 28 | public: 29 | Object() = default; 30 | ~Object() = default; 31 | 32 | uint64_t m_UUID = 0; 33 | bool m_Serializable = false; 34 | ObjectLifespan m_ObjectLifespan = ObjectLifespan::Invalid; 35 | ObjectStatus m_ObjectStatus = ObjectStatus::Invalid; 36 | 37 | #ifdef INNO_DEBUG 38 | ObjectName m_InstanceName; 39 | #endif 40 | }; 41 | 42 | const uint32_t MaxComponentType = 512; 43 | 44 | class Entity : public Object 45 | { 46 | public: 47 | Entity() = default; 48 | ~Entity() = default; 49 | 50 | static uint32_t GetTypeID() { return 0; } 51 | static const char* GetTypeName() { return "Entity"; } 52 | 53 | std::bitset m_ComponentsMask; 54 | }; 55 | 56 | class Component : public Object 57 | { 58 | public: 59 | Component() = default; 60 | ~Component() = default; 61 | 62 | Entity* m_Owner = 0; 63 | }; 64 | } 65 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/opaqueGeometryProcessPass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct PixelInputType 5 | { 6 | float4 posCS : SV_POSITION; 7 | float4 posCS_orig : POSITION_ORIG; 8 | float3 posWS : POSITION; 9 | float2 texCoord : TEXCOORD; 10 | float3 normalWS : NORMAL; 11 | float3 tangentWS : TANGENT; 12 | }; 13 | 14 | [[vk::binding(0, 0)]] 15 | cbuffer RootConstants : register(b0) 16 | { 17 | uint m_ObjectIndex; 18 | }; 19 | 20 | [[vk::binding(1, 0)]] 21 | cbuffer PerFrameConstantBuffer : register(b1) 22 | { 23 | PerFrame_CB g_Frame; 24 | } 25 | 26 | [[vk::binding(0, 1)]] 27 | StructuredBuffer g_Objects : register(t0); 28 | 29 | PixelInputType main(VertexInputType input) 30 | { 31 | PixelInputType output; 32 | 33 | PerObject_CB perObjectCB = g_Objects[m_ObjectIndex]; 34 | 35 | float4 posLS = float4(input.posLS.xyz, 1.0f); 36 | float4 posWS = mul(posLS, perObjectCB.m); 37 | float4 posVS = mul(posWS, g_Frame.v); 38 | output.posCS_orig = mul(posVS, g_Frame.p_original); 39 | 40 | output.posCS = mul(posVS, g_Frame.p_jittered); 41 | 42 | output.posWS = posWS.xyz; 43 | output.texCoord = input.texCoord; 44 | output.normalWS = mul(float4(input.normalLS, 0.0f), perObjectCB.normalMat).xyz; 45 | output.tangentWS = mul(float4(input.tangentLS, 0.0f), perObjectCB.normalMat).xyz; 46 | 47 | return output; 48 | } -------------------------------------------------------------------------------- /Source/Engine/Common/Metadata.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Inno 4 | { 5 | namespace Metadata 6 | { 7 | enum class DeclType 8 | { 9 | Invalid, 10 | Namespace, 11 | Struct, 12 | Union, 13 | Class, 14 | Enum, 15 | EnumConstant, 16 | Var, 17 | Function, 18 | Parm, 19 | Ctor, 20 | Dtor, 21 | ClassTemplate, 22 | FunctionTemplate 23 | }; 24 | 25 | enum class AccessType 26 | { 27 | Invalid, 28 | Public, 29 | Protected, 30 | Private 31 | }; 32 | 33 | enum class TypeKind 34 | { 35 | Invalid, 36 | Custom, 37 | Void, 38 | Bool, 39 | UChar, 40 | SChar, 41 | WChar, 42 | Char16, 43 | Char32, 44 | UShort, 45 | UInt, 46 | ULong, 47 | ULongLong, 48 | SShort, 49 | SInt, 50 | SLong, 51 | SLongLong, 52 | Float, 53 | Double, 54 | 55 | Pointer, 56 | Enum, 57 | EnumConstant, 58 | TemplateParm 59 | }; 60 | 61 | struct TypeInfo 62 | { 63 | const char* Name; 64 | DeclType DeclType; 65 | AccessType AccessType; 66 | TypeKind TypeKind; 67 | const char* TypeName; 68 | TypeInfo* TypeRef; 69 | bool IsPtr; 70 | TypeInfo* Base; 71 | }; 72 | 73 | template 74 | TypeInfo Get() 75 | { 76 | using orig_type = std::remove_const_t>; 77 | return Get(); 78 | }; 79 | } 80 | } -------------------------------------------------------------------------------- /Source/Engine/Common/Thread.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #include "Task.h" 7 | #include "Handle.h" 8 | #include "ThreadSafeVector.h" 9 | #include "RingBuffer.h" 10 | 11 | namespace Inno 12 | { 13 | struct TaskReport 14 | { 15 | uint64_t m_StartTime; 16 | uint64_t m_FinishTime; 17 | uint32_t m_ThreadID; 18 | const char* m_TaskName; 19 | }; 20 | 21 | class Thread 22 | { 23 | public: 24 | using ID = std::pair; 25 | 26 | enum class State 27 | { 28 | Idle 29 | , Waiting 30 | , Busy 31 | , Released 32 | }; 33 | 34 | explicit Thread(uint32_t ThreadIndex); 35 | 36 | ~Thread(void); 37 | 38 | Thread(const Thread& rhs) = delete; 39 | Thread& operator=(const Thread& rhs) = delete; 40 | 41 | State GetState() const; 42 | void Freeze(); 43 | void Unfreeze(); 44 | 45 | const RingBuffer& GetTaskReport(); 46 | 47 | void AddTask(Handle task); 48 | 49 | private: 50 | void Worker(uint32_t ThreadIndex); 51 | 52 | inline bool ExecuteTask(Handle task); 53 | 54 | std::thread* m_ThreadHandle; 55 | ID m_ID; 56 | std::atomic m_State = State::Idle; 57 | std::atomic_bool m_Done = false; 58 | 59 | std::vector> m_TaskList; 60 | RingBuffer m_TaskReport; 61 | }; 62 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/voxelLightPass.comp: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct ComputeInputType 5 | { 6 | uint3 groupID : SV_GroupID; // 3D index of the thread group in the dispatch. 7 | uint3 groupThreadID : SV_GroupThreadID; // 3D index of local thread ID in a thread group. 8 | uint3 dispatchThreadID : SV_DispatchThreadID; // 3D index of global thread ID in the dispatch. 9 | uint groupIndex : SV_GroupIndex; // Flattened local index of the thread within a thread group. 10 | }; 11 | 12 | [[vk::binding(0, 1)]] 13 | Texture3D in_albedoVolume : register(t0); 14 | [[vk::binding(1, 1)]] 15 | Texture3D in_normalVolume : register(t1); 16 | [[vk::binding(0, 2)]] 17 | RWTexture3D out_illuminanceVolume : register(u0); 18 | 19 | [numthreads(8, 8, 8)] 20 | void main(ComputeInputType input) 21 | { 22 | out_illuminanceVolume[input.dispatchThreadID] = float4(0.0f, 0.0f, 0.0f, 0.0f); 23 | 24 | float4 albedo = in_albedoVolume[input.dispatchThreadID]; 25 | if(albedo.a) 26 | { 27 | float4 normal = in_normalVolume[input.dispatchThreadID]; 28 | float3 L = normalize(-perFrameCBuffer.sun_direction.xyz); 29 | float NdotL = max(dot(normal.xyz, L), 0.0); 30 | float3 sunLo = perFrameCBuffer.sun_illuminance.xyz * NdotL; 31 | 32 | out_illuminanceVolume[input.dispatchThreadID] = float4(albedo.xyz * sunLo, 1.0); 33 | } 34 | } -------------------------------------------------------------------------------- /Source/Client/RenderingClient/VXGIRayTracingPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class VXGIRayTracingPassRenderingContext : public IRenderingContext 7 | { 8 | public: 9 | GPUResourceComponent *m_input; 10 | GPUResourceComponent *m_output; 11 | }; 12 | 13 | class VXGIRayTracingPass : IRenderPass 14 | { 15 | public: 16 | INNO_CLASS_SINGLETON(VXGIRayTracingPass) 17 | 18 | bool Setup(ISystemConfig *systemConfig = nullptr) override; 19 | bool Initialize() override; 20 | bool Terminate() override; 21 | ObjectStatus GetStatus() override; 22 | 23 | bool PrepareCommandList(IRenderingContext *renderingContext) override; 24 | RenderPassComponent *GetRenderPassComp() override; 25 | 26 | GPUResourceComponent *GetResult(); 27 | 28 | private: 29 | ObjectStatus m_ObjectStatus; 30 | RenderPassComponent *m_RenderPassComp; 31 | ShaderProgramComponent *m_ShaderProgramComp; 32 | SamplerComponent *m_SamplerComp; 33 | TextureComponent *m_TextureComp; 34 | 35 | GPUBufferComponent *m_RaySBufferGPUBufferComp; 36 | GPUBufferComponent *m_ProbeIndexSBufferGPUBufferComp; 37 | 38 | std::vector m_Ray; 39 | std::vector> m_ProbeIndex; 40 | std::default_random_engine m_generator; 41 | std::uniform_int_distribution m_randomInt; 42 | }; 43 | } // namespace Inno 44 | -------------------------------------------------------------------------------- /Scripts/ai-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # AI Agent Team Build Script 4 | # Replicates VS Code build button functionality 5 | # Equivalent to: VS Code Build Button -> CMake Configure -> Build 6 | 7 | set -e 8 | 9 | echo "=== AI Agent Team Build Script ===" 10 | echo "Replicating VS Code build workflow..." 11 | 12 | # Step 1: CMake Configure (equivalent to VS Code CMake extension) 13 | echo "" 14 | echo "Step 1: CMake Configure..." 15 | 16 | cmake -S . -B build \ 17 | -DPREPARE_ENV=ON \ 18 | -DBUILD_THIRD_PARTY=ON \ 19 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ 20 | -DFORCE_REBUILD_THIRD_PARTY=OFF \ 21 | -G "Visual Studio 17 2022" \ 22 | -A x64 23 | 24 | echo "✅ CMake configuration complete" 25 | 26 | # Step 2: Build (equivalent to VS Code build task) 27 | echo "" 28 | echo "Step 2: Building engine..." 29 | 30 | cmake --build build --config RelWithDebInfo --parallel 4 31 | 32 | echo "✅ Build complete" 33 | 34 | # Step 3: Check outputs 35 | echo "" 36 | echo "Step 3: Verifying build outputs..." 37 | 38 | if [ -f "Bin/RelWithDebInfo/Main.exe" ]; then 39 | echo "✅ Main.exe found" 40 | else 41 | echo "❌ Main.exe not found" 42 | fi 43 | 44 | if [ -f "Bin/RelWithDebInfo/Test.exe" ]; then 45 | echo "✅ Test.exe found" 46 | else 47 | echo "❌ Test.exe not found" 48 | fi 49 | 50 | echo "" 51 | echo "=== Build script complete ===" 52 | echo "Ready for launch scripts!" 53 | -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/volumetricGeometryProcessPass.vert: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct GeometryInputType 5 | { 6 | float4 posCS : SV_POSITION; 7 | float4 posCS_orig : POSITION_ORIG; 8 | float4 posCS_prev : POSITION_PREV; 9 | float2 texCoord : TEXCOORD; 10 | }; 11 | 12 | GeometryInputType main(VertexInputType input) 13 | { 14 | GeometryInputType output; 15 | 16 | float4 posWS = mul(float4(input.posLS, 1.0f), perObjectCBuffer.m); 17 | float4 posVS = mul(posWS, perFrameCBuffer.v); 18 | output.posCS_orig = mul(posVS, perFrameCBuffer.p_original); 19 | output.posCS_orig /= output.posCS_orig.w; 20 | 21 | float4 posWS_prev = mul(float4(input.posLS, 1.0f), perObjectCBuffer.m_prev); 22 | float4 posVS_prev = mul(posWS_prev, perFrameCBuffer.v_prev); 23 | output.posCS_prev = mul(posVS_prev, perFrameCBuffer.p_original); 24 | output.posCS_prev /= output.posCS_prev.w; 25 | 26 | output.posCS = mul(posVS, perFrameCBuffer.p_jittered); 27 | 28 | float expDepth = -posVS.z / (perFrameCBuffer.zFar - perFrameCBuffer.zNear); 29 | expDepth = 1.0 - exp(-expDepth * 8); 30 | 31 | float expDepth_prev = -posVS_prev.z / (perFrameCBuffer.zFar - perFrameCBuffer.zNear); 32 | expDepth_prev = 1.0 - exp(-expDepth_prev * 8); 33 | 34 | output.posCS_orig.w = expDepth; 35 | output.posCS_prev.w = expDepth_prev; 36 | 37 | output.texCoord = input.texCoord; 38 | 39 | return output; 40 | } -------------------------------------------------------------------------------- /Res/Shaders/HLSL/WIP/volumetricGeometryProcessPass.frag: -------------------------------------------------------------------------------- 1 | // shadertype=hlsl 2 | #include "common/common.hlsl" 3 | 4 | struct PixelInputType 5 | { 6 | float4 posCS : SV_POSITION; 7 | float4 posCS_orig : POSITION_ORIG; 8 | float4 posCS_prev : POSITION_PREV; 9 | nointerpolation float4 AABB : AABB; 10 | float2 texCoord : TEXCOORD; 11 | }; 12 | 13 | [[vk::binding(0, 1)]] 14 | RWTexture3D out_froxelizationPassRT0 : register(u0); 15 | [[vk::binding(1, 1)]] 16 | RWTexture3D out_froxelizationPassRT1 : register(u1); 17 | 18 | void main(PixelInputType input) 19 | { 20 | float3 writeCoord = input.posCS_orig.xyz; 21 | 22 | if (writeCoord.x < -1.0 || writeCoord.x > 1.0 || writeCoord.y < -1.0 || writeCoord.y > 1.0 || writeCoord.z < 0.0 || writeCoord.z > 1.0) 23 | { 24 | return; 25 | } 26 | else 27 | { 28 | writeCoord.xy = (writeCoord.xy * 0.5 + 0.5) * perFrameCBuffer.viewportSize.xy / 8; 29 | writeCoord.z = input.posCS_orig.w; 30 | writeCoord.z *= 64; 31 | 32 | int3 writeCoordInt = int3(writeCoord); 33 | float3 motionVector = float3((input.posCS_orig.xy - input.posCS_prev.xy) * 0.5, input.posCS_orig.w - input.posCS_prev.w); 34 | 35 | // scattering RGB + extinction A 36 | out_froxelizationPassRT0[writeCoordInt] = materialCBuffer.albedo; 37 | // motion vector + phase function 38 | out_froxelizationPassRT1[writeCoordInt] = float4(motionVector, materialCBuffer.MRAT.x); 39 | } 40 | } -------------------------------------------------------------------------------- /Source/Engine/Platform/MacMain/MTRenderingServerBridgeImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // MTRenderingServerBridgeImpl.h 3 | // Main 4 | // 5 | // Created by zhangdoa on 14/04/2019. 6 | // Copyright © 2019 InnocenceEngine. All rights reserved. 7 | // 8 | 9 | #ifndef MTRenderingServerBridgeImpl_h 10 | #define MTRenderingServerBridgeImpl_h 11 | 12 | #import "../../RenderingServer/MT/MTRenderingServerBridge.h" 13 | #import "MacWindowDelegate.h" 14 | #import "MetalDelegate.h" 15 | 16 | namespace Inno 17 | { 18 | class MTRenderingServerBridgeImpl : public MTRenderingServerBridge 19 | { 20 | public: 21 | explicit MTRenderingServerBridgeImpl(MacWindowDelegate* macWindowDelegate, MetalDelegate* metalDelegate); 22 | ~MTRenderingServerBridgeImpl(); 23 | 24 | bool Setup() override; 25 | bool Initialize() override; 26 | bool Update() override; 27 | bool render() override; 28 | bool present() override; 29 | bool Terminate() override; 30 | 31 | ObjectStatus GetStatus() override; 32 | 33 | bool resize() override; 34 | 35 | bool initializeMTMeshComponent(MTMeshComponent* rhs) override; 36 | bool initializeMTTextureComponent(MTTextureComponent* rhs) override; 37 | 38 | private: 39 | ObjectStatus m_ObjectStatus = ObjectStatus::Terminated; 40 | MacWindowDelegate* m_macWindowDelegate = nullptr; 41 | MetalDelegate* m_metalDelegate = nullptr; 42 | }; 43 | } 44 | #endif /* MTRenderingServerBridgeImpl_h */ 45 | -------------------------------------------------------------------------------- /Source/Client/RenderingClient/RadianceCacheFilterPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Engine/Interface/IRenderPass.h" 3 | 4 | namespace Inno 5 | { 6 | class RadianceCacheFilterPass : IRenderPass 7 | { 8 | public: 9 | INNO_CLASS_SINGLETON(RadianceCacheFilterPass) 10 | 11 | bool Setup(ISystemConfig* systemConfig = nullptr) override; 12 | bool Initialize() override; 13 | bool Update() override; 14 | bool Terminate() override; 15 | ObjectStatus GetStatus() override; 16 | 17 | bool PrepareCommandList(IRenderingContext* renderingContext = nullptr) override; 18 | RenderPassComponent* GetRenderPassComp() override; 19 | RenderPassComponent* GetHorizontalRenderPassComp(); 20 | RenderPassComponent* GetVerticalRenderPassComp(); 21 | 22 | TextureComponent* GetFilteredResult(); 23 | 24 | private: 25 | const uint32_t TILE_SIZE = 8; 26 | 27 | ObjectStatus m_ObjectStatus; 28 | 29 | // Horizontal pass components 30 | RenderPassComponent* m_HorizontalRenderPassComp; 31 | ShaderProgramComponent* m_HorizontalShaderProgramComp; 32 | TextureComponent* m_HorizontalFilteredCache; 33 | 34 | // Vertical pass components 35 | RenderPassComponent* m_VerticalRenderPassComp; 36 | ShaderProgramComponent* m_VerticalShaderProgramComp; 37 | TextureComponent* m_FilteredRadianceCache; 38 | 39 | ShaderStage m_ShaderStage; 40 | 41 | bool RenderTargetsCreationFunc(); 42 | }; 43 | } // namespace Inno 44 | -------------------------------------------------------------------------------- /Source/Engine/RenderingServer/VK/VKHelper_Texture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../Common/STL17.h" 3 | #include "../../Common/LogService.h" 4 | #include "../../Component/VKTextureComponent.h" 5 | #include "../../Component/VKRenderPassComponent.h" 6 | #include "../../Component/VKShaderProgramComponent.h" 7 | #include "../IRenderingServer.h" 8 | 9 | namespace Inno 10 | { 11 | namespace VKHelper 12 | { 13 | VKTextureDesc GetVKTextureDesc(TextureDesc textureDesc); 14 | VkImageType GetImageType(TextureSampler textureSampler); 15 | VkImageViewType GetImageViewType(TextureSampler textureSampler); 16 | VkImageUsageFlags GetImageUsageFlags(TextureUsage textureUsage); 17 | VkSamplerAddressMode GetSamplerAddressMode(TextureWrapMethod textureWrapMethod); 18 | VkFilter GetFilter(TextureFilterMethod textureFilterMethod); 19 | VkSamplerMipmapMode GetSamplerMipmapMode(TextureFilterMethod minFilterMethod); 20 | VkFormat GetTextureFormat(TextureDesc textureDesc); 21 | VkDeviceSize GetImageSize(TextureDesc textureDesc); 22 | VkImageAspectFlagBits GetImageAspectFlags(TextureUsage textureUsage); 23 | VkImageCreateInfo GetImageCreateInfo(TextureDesc textureDesc, VKTextureDesc vKTextureDesc); 24 | 25 | VkImageLayout GetTextureWriteImageLayout(TextureDesc textureDesc); 26 | VkImageLayout GetTextureReadImageLayout(TextureDesc textureDesc); 27 | VkAccessFlagBits GetAccessMask(const VkImageLayout& imageLayout); 28 | } 29 | } -------------------------------------------------------------------------------- /Source/Test/PerformanceTests/StringConversionPerf.cpp: -------------------------------------------------------------------------------- 1 | #include "../Common/TestRunner.h" 2 | #include "../Common/TestTimer.h" 3 | #include "../Common/TestData.h" 4 | #include "../../Engine/Common/LogService.h" 5 | #include "../../Engine/Engine.h" 6 | 7 | using namespace Inno; 8 | 9 | void TestStringConversionPerformance() 10 | { 11 | TestRunner::StartTest("String Conversion Performance"); 12 | 13 | const size_t l_TestCount = TestConfig::PerformanceIterations; 14 | int64_t l_Int64 = std::numeric_limits::max(); 15 | int32_t l_Int32 = std::numeric_limits::max(); 16 | 17 | // Test std::to_string with int32 18 | auto l_Int32Time = TestTimer::MeasurePerformance(l_TestCount, [&]() 19 | { 20 | auto l_StringFromInt32 = std::to_string(l_Int32); 21 | }); 22 | 23 | // Test std::to_string with int64 24 | auto l_Int64Time = TestTimer::MeasurePerformance(l_TestCount, [&]() 25 | { 26 | auto l_StringFromInt64 = std::to_string(l_Int64); 27 | }); 28 | 29 | auto l_SpeedRatio = l_Int64Time / l_Int32Time; 30 | Log(Success, "Int64 vs Int32 string conversion speed ratio: ", l_SpeedRatio); 31 | Log(Success, "Int32 time: ", l_Int32Time, "ms, Int64 time: ", l_Int64Time, "ms"); 32 | 33 | TestRunner::EndTest(true); 34 | } 35 | 36 | void RunStringConversionPerformanceTests() 37 | { 38 | TestRunner::StartTestSuite("String Conversion Performance Tests"); 39 | 40 | TestStringConversionPerformance(); 41 | 42 | TestRunner::EndTestSuite(); 43 | } 44 | -------------------------------------------------------------------------------- /Source/Engine/Services/TemplateAssetService.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Interface/ISystem.h" 3 | 4 | #include "../RenderingServer/IRenderingServer.h" 5 | 6 | #include "../Component/MeshComponent.h" 7 | #include "../Component/TextureComponent.h" 8 | #include "../Component/MaterialComponent.h" 9 | #include "../Component/SkeletonComponent.h" 10 | #include "../Component/AnimationComponent.h" 11 | 12 | #include "../Common/GPUDataStructure.h" 13 | 14 | namespace Inno 15 | { 16 | enum class WorldEditorIconType { DIRECTIONAL_LIGHT, POINT_LIGHT, SPHERE_LIGHT, UNKNOWN }; 17 | 18 | struct TemplateAssetServiceImpl; 19 | class TemplateAssetService : public ISystem 20 | { 21 | public: 22 | INNO_CLASS_CONCRETE_NON_COPYABLE(TemplateAssetService); 23 | 24 | bool Setup(ISystemConfig* systemConfig) override; 25 | bool Initialize() override; 26 | bool Update() override; 27 | bool Terminate() override; 28 | 29 | ObjectStatus GetStatus() override; 30 | 31 | MeshComponent* GetMeshComponent(MeshShape shape); 32 | TextureComponent* GetTextureComponent(WorldEditorIconType iconType); 33 | MaterialComponent* GetDefaultMaterialComponent(); 34 | 35 | bool GenerateMesh(MeshShape shape, MeshComponent* meshComponent); 36 | void FulfillVerticesAndIndices(MeshComponent* meshComponent, const std::vector& indices, const std::vector& vertices, uint32_t verticesPerFace); 37 | 38 | private: 39 | TemplateAssetServiceImpl* m_Impl; 40 | }; 41 | } -------------------------------------------------------------------------------- /Source/Editor/cameracomponentpropertyeditor.h: -------------------------------------------------------------------------------- 1 | #ifndef CAMERACOMPONENTPROPERTYEDITOR_H 2 | #define CAMERACOMPONENTPROPERTYEDITOR_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "icomponentpropertyeditor.h" 8 | #include "combolabeltext.h" 9 | #include "../Engine/Component/CameraComponent.h" 10 | 11 | class CameraComponentPropertyEditor : public IComponentPropertyEditor 12 | { 13 | Q_OBJECT 14 | public: 15 | CameraComponentPropertyEditor(); 16 | 17 | void initialize() override; 18 | void edit(void* component) override; 19 | 20 | void GetFOV(); 21 | void GetWidthScale(); 22 | void GetHeightScale(); 23 | void GetZNear(); 24 | void GetZFar(); 25 | void GetAperture(); 26 | void GetShutterTime(); 27 | void GetISO(); 28 | 29 | private: 30 | ComboLabelText* m_FOV; 31 | ComboLabelText* m_widthScale; 32 | ComboLabelText* m_heightScale; 33 | ComboLabelText* m_zNear; 34 | ComboLabelText* m_zFar; 35 | ComboLabelText* m_aperture; 36 | ComboLabelText* m_shutterTime; 37 | ComboLabelText* m_ISO; 38 | 39 | Inno::CameraComponent* m_component; 40 | 41 | public slots: 42 | void SetFOV(); 43 | void SetWidthScale(); 44 | void SetHeightScale(); 45 | void SetZNear(); 46 | void SetZFar(); 47 | void SetAperture(); 48 | void SetShutterTime(); 49 | void SetISO(); 50 | 51 | void remove() override; 52 | }; 53 | 54 | #endif // CAMERACOMPONENTPROPERTYEDITOR_H 55 | -------------------------------------------------------------------------------- /Source/Editor/worldexplorer.h: -------------------------------------------------------------------------------- 1 | #ifndef INNOWORLDEXPLORER_H 2 | #define INNOWORLDEXPLORER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "propertyeditor.h" 8 | 9 | class WorldExplorer : public QTreeWidget 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit WorldExplorer(QWidget *parent = nullptr); 14 | 15 | void initialize(PropertyEditor* propertyEditor); 16 | 17 | protected: 18 | virtual void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected); 19 | 20 | private slots: 21 | void onCustomContextMenuRequested(const QPoint& pos); 22 | void showContextMenu(QTreeWidgetItem* item, const QPoint& globalPos); 23 | void showGeneralMenu(const QPoint& globalPos); 24 | 25 | void startRename(); 26 | void endRename(); 27 | 28 | void addEntity(); 29 | void deleteEntity(); 30 | 31 | void addTransformComponent(); 32 | void addVisibleComponent(); 33 | void addLightComponent(); 34 | void addCameraComponent(); 35 | 36 | void deleteComponent(); 37 | 38 | private: 39 | template 40 | T* addComponent(); 41 | 42 | void addChild(QTreeWidgetItem* parent, QTreeWidgetItem* child); 43 | void destroyComponent(Inno::Component* component); 44 | 45 | PropertyEditor* m_propertyEditor; 46 | 47 | QTreeWidgetItem* m_rootItem; 48 | QTreeWidgetItem* m_currentEditingItem; 49 | std::function f_sceneLoadingFinishCallback; 50 | void buildTree(); 51 | }; 52 | 53 | #endif // INNOWORLDEXPLORER_H 54 | -------------------------------------------------------------------------------- /Source/Engine/Common/Timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/STL14.h" 3 | 4 | #ifdef GetCurrentTime 5 | #undef GetCurrentTime 6 | #endif 7 | 8 | namespace Inno 9 | { 10 | using HRClock = std::chrono::high_resolution_clock; 11 | using Days = std::chrono::duration>::type>; 12 | using Months = std::chrono::duration>::type>; 13 | using Years = std::chrono::duration>::type>; 14 | 15 | enum class TimeUnit { Microsecond, Millisecond, Second, Minute, Hour, Day, Month, Year }; 16 | 17 | struct Timestamp 18 | { 19 | uint32_t Year; 20 | uint32_t Month; 21 | uint32_t Day; 22 | uint32_t Hour; 23 | uint32_t Minute; 24 | uint32_t Second; 25 | uint32_t Millisecond; 26 | uint32_t Microsecond; 27 | }; 28 | 29 | class Timer 30 | { 31 | public: 32 | Timer(); 33 | void Tick(); 34 | 35 | static uint64_t GetCurrentTimeFromEpoch(TimeUnit time_unit = TimeUnit::Millisecond); 36 | static Timestamp GetCurrentTime(uint32_t time_zone_adjustment = 0); 37 | 38 | static bool Measure(const std::string& functorName, const std::function& functor); 39 | 40 | private: 41 | double m_FrameLength; 42 | HRClock::time_point m_EngineStartTime; 43 | HRClock::time_point m_UpdateStartTime; 44 | double m_DeltaTime; 45 | double m_UnprocessedTime; 46 | }; 47 | } -------------------------------------------------------------------------------- /Source/Engine/Component/LightComponent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Common/Object.h" 3 | #include "../Common/MathHelper.h" 4 | 5 | namespace Inno 6 | { 7 | enum class LightType { Directional, Point, Spot, Sphere, Disk, Tube, Rectangle }; 8 | 9 | class LightComponent : public Component 10 | { 11 | public: 12 | static uint32_t GetTypeID() { return 3; }; 13 | static const char* GetTypeName() { return "LightComponent"; }; 14 | 15 | // Unitless: use clamped range from 0.0 to 1.0 16 | // CIE 1931 RGB color space 17 | Vec4 m_RGBColor = Vec4(1.0f, 1.0f, 1.0f, 1.0f); 18 | 19 | // Unit: Meter (m) 20 | // For Directional light it's useless 21 | // For Point light, x is the auto-calculated attenuation radius 22 | // For Spot light, x is the cut-off angle 23 | // For Sphere light, x is the sphere radius 24 | // For Disk light, x is the disk radius 25 | // For Tube light, x is the tube length, y is the tube radius 26 | // For Rectangle light, x is the width, y is the height 27 | Vec4 m_Shape = Vec4(1.0f, 1.0f, 1.0f, 1.0f); 28 | 29 | LightType m_LightType = LightType::Directional; 30 | 31 | // Unit: Kelvin (K) 32 | float m_ColorTemperature = 5780.0f; 33 | 34 | // Unit: Lumen (lm) 35 | float m_LuminousFlux = 1.0f; 36 | 37 | bool m_UseColorTemperature = true; 38 | 39 | std::vector m_LitRegion_WorldSpace; 40 | std::vector m_LitRegion_LightSpace; 41 | std::vector m_ViewMatrices; 42 | std::vector m_ProjectionMatrices; 43 | }; 44 | } -------------------------------------------------------------------------------- /Source/Engine/ThirdParty/JSONWrapper/JSONWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "nlohmann/json.hpp" 3 | using json = nlohmann::ordered_json; 4 | 5 | #include "../../Common/ComponentHeaders.h" 6 | #include "../../Component/RenderPassComponent.h" 7 | 8 | namespace Inno 9 | { 10 | namespace JSONWrapper 11 | { 12 | bool Load(const char* fileName, json& data); 13 | bool Save(const char* fileName, const json& data); 14 | 15 | void to_json(json& j, const Entity& p); 16 | void to_json(json& j, const Vec4& p); 17 | void to_json(json& j, const Mat4& p); 18 | 19 | void to_json(json& j, const TransformComponent& p); 20 | void to_json(json& j, const TransformVector& p); 21 | void to_json(json& j, const ModelComponent& p); 22 | void to_json(json& j, const LightComponent& p); 23 | void to_json(json& j, const CameraComponent& p); 24 | void to_json(json& j, const RenderPassComponent& p); 25 | 26 | void from_json(const json& j, Vec4& p); 27 | void from_json(const json& j, Mat4& p); 28 | 29 | void from_json(const json& j, TransformComponent& p); 30 | void from_json(const json& j, TransformVector& p); 31 | void from_json(const json& j, ModelComponent& p); 32 | void from_json(const json& j, LightComponent& p); 33 | void from_json(const json& j, CameraComponent& p); 34 | void from_json(const json& j, RenderPassComponent& p); 35 | 36 | Model* LoadModel(const char* fileName); 37 | 38 | bool Save(const char* fileName); 39 | bool Load(const char* fileName); 40 | } 41 | } --------------------------------------------------------------------------------