diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 2aa4868..77107a0 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -11,11 +11,9 @@ "UNICODE", "_UNICODE" ], - "windowsSdkVersion": "10.0.18362.0", - "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe", - "intelliSenseMode": "msvc-x64", + "intelliSenseMode": "clang-x64", "configurationProvider": "ms-vscode.cmake-tools", - "cppStandard": "c++17", + "cppStandard": "c++20", "browse": { "path": [ "${VULKAN_SDK}/**" diff --git a/.vscode/settings.json b/.vscode/settings.json index f963757..7fea7f4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -104,7 +104,9 @@ "hash_map": "cpp", "hash_set": "cpp", "scoped_allocator": "cpp", - "stack": "cpp" + "stack": "cpp", + "coroutine": "cpp", + "*.tcc": "cpp" }, "cmake.skipConfigureIfCachePresent": false, "cmake.configureArgs": [ diff --git a/CMakeLists.txt b/CMakeLists.txt index 076fc8c..9ec6f2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,10 +16,11 @@ set(GLFW_ROOT ${EXTERNAL_ROOT}/glfw) set(JSON_ROOT ${EXTERNAL_ROOT}/json) set(STB_ROOT ${EXTERNAL_ROOT}/stb) set(SPIRV_ROOT ${EXTERNAL_ROOT}/SPIRV-Cross) +set(Boost_DEBUG ON) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/) -set(Boost_USE_STATIC_LIBS ON) +set(Boost_USE_STATIC_LIBS OFF) set(Boost_LIB_PREFIX lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}) @@ -43,13 +44,13 @@ endif() find_package(Vulkan REQUIRED) find_package(Boost REQUIRED COMPONENTS serialization) find_package(Threads REQUIRED) -find_package(assimp REQUIRED) +find_package(Assimp REQUIRED) find_package(JSON REQUIRED) find_package(GLFW REQUIRED) #find_package(SPIRV REQUIRED) find_package(GLM REQUIRED) find_package(STB REQUIRED) -find_package(SLang REQUIRED) +find_package(SLANG REQUIRED) include_directories(${GLM_INCLUDE_DIRS}) include_directories(${STB_INCLUDE_DIRS}) @@ -80,22 +81,23 @@ target_link_libraries(SeeleEngine ${ASSIMP_LIBRARIES}) target_link_libraries(SeeleEngine ${JSON_LIBRARY}) #target_link_libraries(SeeleEngine ${SPIRV_LIBRARIES}) -#target_precompile_headers(SeeleEngine -# PRIVATE -# -# -# -# -# -# -# -# -# -# -# -# -# -# ) +target_precompile_headers(SeeleEngine + PRIVATE + + + + + + + + + + + + + + + ) add_subdirectory(src/) @@ -103,7 +105,7 @@ if(MSVC) set(_CRT_SECURE_NO_WARNINGS) # target_compile_options(SeeleEngine PRIVATE /DEBUG:FASTLINK /Zi) else() - target_compile_options(SeeleEngine PRIVATE -Wall -Wextra -pedantic) + target_compile_options(SeeleEngine PRIVATE -Wall -Wextra -Wno-delete-incomplete -pedantic -fcoroutines) endif() add_executable(Seele_unit_tests "") diff --git a/cmake/FindAssimp.cmake b/cmake/FindAssimp.cmake index b987e3a..fe0705d 100644 --- a/cmake/FindAssimp.cmake +++ b/cmake/FindAssimp.cmake @@ -48,12 +48,13 @@ else() /usr/local/include /sw/include /opt/local/include + ${ASSIMP_ROOT}/include DOC "The directory where assimp/scene.h resides") # Find library files find_library( ASSIMP_LIBRARY - NAMES assimp + NAMES libassimp${CMAKE_DEBUG_POSTFIX}.so PATHS /usr/lib64 /usr/lib @@ -61,12 +62,12 @@ else() /usr/local/lib /sw/lib /opt/local/lib - ${ASSIMP_ROOT}/lib + ${ASSIMP_ROOT}/bin DOC "The Assimp library") endif() # Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(assimp DEFAULT_MSG ASSIMP_INCLUDE_DIR ASSIMP_LIBRARY ASSIMP_BINARY) +find_package_handle_standard_args(assimp DEFAULT_MSG ASSIMP_INCLUDE_DIR ASSIMP_LIBRARY) # Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS if (ASSIMP_FOUND) diff --git a/cmake/FindGLFW.cmake b/cmake/FindGLFW.cmake index 2472452..73a4d2f 100644 --- a/cmake/FindGLFW.cmake +++ b/cmake/FindGLFW.cmake @@ -60,7 +60,7 @@ else() # Find include files find_path( GLFW_INCLUDE_DIR - NAMES GLFW/glfw.h + NAMES GLFW/glfw3.h PATHS /usr/include /usr/local/include @@ -70,22 +70,23 @@ else() # Find library files # Try to use static libraries - find_library( - GLFW_LIBRARY - NAMES glfw3 - PATHS - /usr/lib64 - /usr/lib - /usr/local/lib64 - /usr/local/lib - /sw/lib - /opt/local/lib - ${GLFW_ROOT}/lib - DOC "The GLFW library") - + #find_library( + # GLFW_LIBRARY + # NAMES glfw3 + # PATHS + # /usr/lib64 + # /usr/lib + # /usr/local/lib64 + # /usr/local/lib + # /sw/lib + # /opt/local/lib + # ${GLFW_ROOT}/lib + # DOC "The GLFW library") + set(GLFW_LIBRARY "") + find_file( GLFW_BINARY - NAMES glfw3.so + NAMES libglfw${CMAKE_DEBUG_POSTFIX}.so PATHS /usr/lib64 /usr/lib @@ -93,12 +94,12 @@ else() /usr/local/lib /sw/lib /opt/local/lib - ${GLFW_ROOT}/lib + ${GLFW_ROOT}/src ) endif() # Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(GLFW DEFAULT_MSG GLFW_INCLUDE_DIR GLFW_LIBRARY GLFW_BINARY) +find_package_handle_standard_args(GLFW DEFAULT_MSG GLFW_INCLUDE_DIR GLFW_BINARY) # Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS if (GLFW_FOUND) diff --git a/cmake/FindGLM.cmake b/cmake/FindGLM.cmake index d69f294..dfcfcad 100644 --- a/cmake/FindGLM.cmake +++ b/cmake/FindGLM.cmake @@ -32,12 +32,13 @@ else() # Find include files find_path( GLM_INCLUDE_DIR - NAMES GLM/glfw.h + NAMES glm/glm.hpp PATHS /usr/include /usr/local/include /sw/include /opt/local/include + ${GLM_ROOT} DOC "The directory where GLM/glm.h resides") endif() diff --git a/cmake/FindSLANG.cmake b/cmake/FindSLANG.cmake index e381421..f25e21d 100644 --- a/cmake/FindSLANG.cmake +++ b/cmake/FindSLANG.cmake @@ -49,6 +49,7 @@ if (WIN32) PATHS ${SLANG_BINARY_PATH}) else() + set(SLANG_BINARY_PATH ${SLANG_ROOT}/bin/linux-${CMAKE_PLATFORM}/release/) # Find include files find_path( SLANG_INCLUDE_DIR @@ -58,13 +59,15 @@ else() /usr/local/include /sw/include /opt/local/include + ${SLANG_ROOT} DOC "The directory where GL/glfw.h resides") # Find library files # Try to use static libraries + set(SLANG_LIBRARY "") find_library( - SLANG_LIBRARY - NAMES slang.a + SLANG_BINARY + NAMES libslang.so PATHS /usr/lib64 /usr/lib @@ -72,12 +75,12 @@ else() /usr/local/lib /sw/lib /opt/local/lib - ${SLANG_ROOT}/lib + ${SLANG_BINARY_PATH} DOC "The SLANG library") find_file( - SLANG_BINARY - NAMES slang.so + SLANG_GLSLANG + NAMES libslang-glslang.so PATHS /usr/lib64 /usr/lib @@ -85,12 +88,12 @@ else() /usr/local/lib /sw/lib /opt/local/lib - ${SLANG_ROOT}/lib + ${SLANG_BINARY_PATH} ) endif() # Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(SLANG DEFAULT_MSG SLANG_INCLUDE_DIR SLANG_LIBRARY SLANG_BINARY SLANG_GLSLANG) +find_package_handle_standard_args(SLANG DEFAULT_MSG SLANG_INCLUDE_DIR SLANG_BINARY SLANG_GLSLANG) # Define SLANG_LIBRARIES and SLANG_INCLUDE_DIRS if (SLANG_FOUND) diff --git a/cmake/FindSTB.cmake b/cmake/FindSTB.cmake index 21260a9..0d9f471 100644 --- a/cmake/FindSTB.cmake +++ b/cmake/FindSTB.cmake @@ -38,6 +38,7 @@ else() /usr/local/include /sw/include /opt/local/include + ${STB_ROOT} DOC "The directory where STB/stb.h resides") endif() diff --git a/cmake/SuperBuild.cmake b/cmake/SuperBuild.cmake index 04cb460..486f080 100644 --- a/cmake/SuperBuild.cmake +++ b/cmake/SuperBuild.cmake @@ -14,6 +14,7 @@ set(BUILD_SHARED_LIBS ON CACHE INTERNAL "") add_subdirectory(${ASSIMP_ROOT} ${ASSIMP_ROOT}) target_compile_definitions(assimp PRIVATE _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING) +target_compile_options(assimp PRIVATE -Wno-error) #-------------BOOST---------------- list(APPEND DEPENDENCIES boost) @@ -31,7 +32,7 @@ ExternalProject_Add(boost INSTALL_COMMAND "") list (APPEND EXTRA_CMAKE_ARGS - -DBoost_NO_SYSTEM_PATHS=ON) + -DBoost_NO_SYSTEM_PATHS=OFF) #--------------------JSON------------------ list(APPEND DEPENDENCIES nlohmann_json) diff --git a/premake5 b/premake5 old mode 100644 new mode 100755 diff --git a/src/Engine/Arch/CMakeLists.txt b/src/Engine/Arch/CMakeLists.txt deleted file mode 100644 index d44f6af..0000000 --- a/src/Engine/Arch/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(x64/) \ No newline at end of file diff --git a/src/Engine/Asset/Asset.h b/src/Engine/Asset/Asset.h index ccfcc35..5fa86bb 100644 --- a/src/Engine/Asset/Asset.h +++ b/src/Engine/Asset/Asset.h @@ -1,7 +1,5 @@ #pragma once #include "MinimalEngine.h" -#include -#include namespace Seele { @@ -43,15 +41,15 @@ protected: std::ifstream& getReadStream(); std::ofstream& getWriteStream(); private: - Status status; // Path relative to the project root std::filesystem::path fullPath; - std::filesystem::path parentDir; std::filesystem::path name; + std::filesystem::path parentDir; std::filesystem::path extension; + Status status; uint32 byteSize; std::ifstream inStream; std::ofstream outStream; }; -DEFINE_REF(Asset); +DEFINE_REF(Asset) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Asset/AssetRegistry.cpp b/src/Engine/Asset/AssetRegistry.cpp index a2347a9..4360ceb 100644 --- a/src/Engine/Asset/AssetRegistry.cpp +++ b/src/Engine/Asset/AssetRegistry.cpp @@ -7,6 +7,7 @@ #include "Material/Material.h" #include "Graphics/Graphics.h" #include "Window/WindowManager.h" +#include "MeshAsset.h" #include using namespace Seele; diff --git a/src/Engine/Asset/AssetRegistry.h b/src/Engine/Asset/AssetRegistry.h index 6893a7f..e87c866 100644 --- a/src/Engine/Asset/AssetRegistry.h +++ b/src/Engine/Asset/AssetRegistry.h @@ -5,13 +5,13 @@ namespace Seele { -DECLARE_REF(TextureLoader); -DECLARE_REF(MeshLoader); -DECLARE_REF(MaterialLoader); -DECLARE_REF(TextureAsset); -DECLARE_REF(MeshAsset); -DECLARE_REF(MaterialAsset); -DECLARE_NAME_REF(Gfx, Graphics); +DECLARE_REF(TextureLoader) +DECLARE_REF(MeshLoader) +DECLARE_REF(MaterialLoader) +DECLARE_REF(TextureAsset) +DECLARE_REF(MeshAsset) +DECLARE_REF(MaterialAsset) +DECLARE_NAME_REF(Gfx, Graphics) class AssetRegistry { public: @@ -26,8 +26,8 @@ public: static PTextureAsset findTexture(const std::string& filePath); static PMaterialAsset findMaterial(const std::string& filePath); - static std::ofstream createWriteStream(const std::string& relativePath, std::ios_base::openmode openmode = 0); - static std::ifstream createReadStream(const std::string& relativePath, std::ios_base::openmode openmode = 0); + static std::ofstream createWriteStream(const std::string& relativePath, std::ios_base::openmode openmode = std::ios::out); + static std::ifstream createReadStream(const std::string& relativePath, std::ios_base::openmode openmode = std::ios::in); private: static AssetRegistry& get(); @@ -42,8 +42,8 @@ private: void registerTexture(PTextureAsset texture); void registerMaterial(PMaterialAsset material); - std::ofstream internalCreateWriteStream(const std::string& relativePath, std::ios_base::openmode openmode = 0); - std::ifstream internalCreateReadStream(const std::string& relaitvePath, std::ios_base::openmode openmode = 0); + std::ofstream internalCreateWriteStream(const std::string& relativePath, std::ios_base::openmode openmode = std::ios::out); + std::ifstream internalCreateReadStream(const std::string& relaitvePath, std::ios_base::openmode openmode = std::ios::in); std::filesystem::path rootFolder; Map textures; diff --git a/src/Engine/Asset/MaterialLoader.h b/src/Engine/Asset/MaterialLoader.h index 771b846..7aeff56 100644 --- a/src/Engine/Asset/MaterialLoader.h +++ b/src/Engine/Asset/MaterialLoader.h @@ -8,7 +8,7 @@ namespace Seele { DECLARE_REF(Material) -DECLARE_NAME_REF(Gfx, Graphics); +DECLARE_NAME_REF(Gfx, Graphics) class MaterialLoader { public: @@ -21,5 +21,5 @@ private: List> futures; PMaterial placeholderMaterial; }; -DEFINE_REF(MaterialLoader); +DEFINE_REF(MaterialLoader) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Asset/MeshAsset.h b/src/Engine/Asset/MeshAsset.h index 34c6714..e76c668 100644 --- a/src/Engine/Asset/MeshAsset.h +++ b/src/Engine/Asset/MeshAsset.h @@ -3,8 +3,8 @@ namespace Seele { -DECLARE_REF(Mesh); -DECLARE_REF(MaterialAsset); +DECLARE_REF(Mesh) +DECLARE_REF(MaterialAsset) class MeshAsset : public Asset { public: @@ -20,5 +20,5 @@ private: Array meshes; Array referencedMaterials; }; -DEFINE_REF(MeshAsset); +DEFINE_REF(MeshAsset) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Asset/MeshLoader.cpp b/src/Engine/Asset/MeshLoader.cpp index f46cc2d..589d980 100644 --- a/src/Engine/Asset/MeshLoader.cpp +++ b/src/Engine/Asset/MeshLoader.cpp @@ -197,7 +197,7 @@ void MeshLoader::convertAssimpARGB(unsigned char* dst, aiTexel* src, uint32 numP dst[i * 4 + 3] = src[i].a; } } -void MeshLoader::loadTextures(const aiScene* scene, Gfx::PGraphics graphics, const std::filesystem::path& meshDirectory) +void MeshLoader::loadTextures(const aiScene* scene, const std::filesystem::path& meshDirectory) { for (uint32 i = 0; i < scene->mNumTextures; ++i) { @@ -237,7 +237,7 @@ void MeshLoader::import(const std::filesystem::path &path) const aiScene *scene = importer.ApplyPostProcessing(aiProcess_CalcTangentSpace); Array globalMaterials(scene->mNumMaterials); - loadTextures(scene, graphics, path.parent_path()); + loadTextures(scene, path.parent_path()); loadMaterials(scene, globalMaterials, graphics); Array globalMeshes(scene->mNumMeshes); diff --git a/src/Engine/Asset/MeshLoader.h b/src/Engine/Asset/MeshLoader.h index dff334c..e0cd3d7 100644 --- a/src/Engine/Asset/MeshLoader.h +++ b/src/Engine/Asset/MeshLoader.h @@ -9,10 +9,10 @@ struct aiScene; struct aiTexel; namespace Seele { -DECLARE_REF(Mesh); -DECLARE_REF(MeshAsset); -DECLARE_REF(MaterialAsset); -DECLARE_NAME_REF(Gfx, Graphics); +DECLARE_REF(Mesh) +DECLARE_REF(MeshAsset) +DECLARE_REF(MaterialAsset) +DECLARE_NAME_REF(Gfx, Graphics) class MeshLoader { public: @@ -21,7 +21,7 @@ public: void importAsset(const std::filesystem::path& filePath); private: void loadMaterials(const aiScene* scene, Array& globalMaterials, Gfx::PGraphics graphics); - void loadTextures(const aiScene* scene, Gfx::PGraphics graphics, const std::filesystem::path& meshPath); + void loadTextures(const aiScene* scene, const std::filesystem::path& meshPath); void loadGlobalMeshes(const aiScene* scene, Array& globalMeshes, const Array& materials, Gfx::PGraphics graphics); void convertAssimpARGB(unsigned char* dst, aiTexel* src, uint32 numPixels); @@ -29,5 +29,5 @@ private: List> futures; Gfx::PGraphics graphics; }; -DEFINE_REF(MeshLoader); +DEFINE_REF(MeshLoader) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Asset/TextureAsset.h b/src/Engine/Asset/TextureAsset.h index 9edf7a3..bbaabf3 100644 --- a/src/Engine/Asset/TextureAsset.h +++ b/src/Engine/Asset/TextureAsset.h @@ -2,7 +2,7 @@ namespace Seele { -DECLARE_NAME_REF(Gfx, Texture); +DECLARE_NAME_REF(Gfx, Texture) class TextureAsset : public Asset { public: @@ -25,5 +25,5 @@ private: Gfx::PTexture texture; friend class TextureLoader; }; -DEFINE_REF(TextureAsset); +DEFINE_REF(TextureAsset) } // namespace Seele diff --git a/src/Engine/Asset/TextureLoader.h b/src/Engine/Asset/TextureLoader.h index 04cd5df..b2f73f4 100644 --- a/src/Engine/Asset/TextureLoader.h +++ b/src/Engine/Asset/TextureLoader.h @@ -7,9 +7,9 @@ namespace Seele { -DECLARE_REF(TextureAsset); -DECLARE_NAME_REF(Gfx, Graphics); -DECLARE_NAME_REF(Gfx, Texture2D); +DECLARE_REF(TextureAsset) +DECLARE_NAME_REF(Gfx, Graphics) +DECLARE_NAME_REF(Gfx, Texture2D) class TextureLoader { public: @@ -24,5 +24,5 @@ private: Gfx::PTexture2D placeholderTexture; PTextureAsset placeholderAsset; }; -DEFINE_REF(TextureLoader); +DEFINE_REF(TextureLoader) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/CMakeLists.txt b/src/Engine/CMakeLists.txt index 9702511..edaf15c 100644 --- a/src/Engine/CMakeLists.txt +++ b/src/Engine/CMakeLists.txt @@ -5,9 +5,8 @@ target_sources(SeeleEngine main.cpp) add_subdirectory(Asset/) -add_subdirectory(Arch/) add_subdirectory(Containers/) -add_subdirectory(Fibers/) +#add_subdirectory(Fibers/) add_subdirectory(Graphics/) add_subdirectory(Material/) add_subdirectory(Math/) diff --git a/src/Engine/Containers/Array.h b/src/Engine/Containers/Array.h index 3a83e19..5c11eab 100644 --- a/src/Engine/Containers/Array.h +++ b/src/Engine/Containers/Array.h @@ -17,8 +17,8 @@ namespace Seele { public: Array() - : allocated(DEFAULT_ALLOC_SIZE) - , arraySize(0) + : arraySize(0) + , allocated(DEFAULT_ALLOC_SIZE) { _data = new T[DEFAULT_ALLOC_SIZE]; assert(_data != nullptr); @@ -26,7 +26,8 @@ namespace Seele refreshIterators(); } Array(size_t size, T value = T()) - : allocated(size), arraySize(size) + : arraySize(size) + , allocated(size) { _data = new T[size]; assert(_data != nullptr); @@ -38,7 +39,8 @@ namespace Seele refreshIterators(); } Array(std::initializer_list init) - : allocated(init.size()), arraySize(init.size()) + : arraySize(init.size()) + , allocated(init.size()) { _data = new T[init.size()]; auto it = init.begin(); @@ -50,7 +52,8 @@ namespace Seele refreshIterators(); } Array(const Array &other) - : allocated(other.allocated), arraySize(other.arraySize) + : arraySize(other.arraySize) + , allocated(other.allocated) { _data = new T[other.allocated]; assert(_data != nullptr); @@ -58,7 +61,8 @@ namespace Seele std::copy(other.begin(), other.end(), beginIt); } Array(Array &&other) noexcept - : allocated(std::move(other.allocated)), arraySize(std::move(other.arraySize)) + : arraySize(std::move(other.arraySize)) + , allocated(std::move(other.allocated)) { _data = other._data; other._data = nullptr; @@ -110,20 +114,16 @@ namespace Seele class IteratorBase { public: - typedef std::forward_iterator_tag iterator_category; - typedef X value_type; - typedef std::ptrdiff_t difference_type; - typedef X &reference; - typedef X *pointer; + using iterator_category = std::random_access_iterator_tag; + using value_type = X; + using difference_type = std::ptrdiff_t; + using reference = X&; + using pointer = X*; IteratorBase(X *x = nullptr) : p(x) { } - IteratorBase(const IteratorBase &i) - : p(i.p) - { - } reference operator*() const { return *p; @@ -263,7 +263,7 @@ namespace Seele T &addUnique(const T &item = T()) { Iterator it; - if((it = find(item)) != endIt) + if((it = std::move(find(item))) != endIt) { return *it; } @@ -297,7 +297,10 @@ namespace Seele { if (keepOrder) { - std::memcpy(&_data[index], &_data[index + 1], sizeof(T) * (arraySize - index)); + for(uint32 i = index; i < arraySize-1; ++i) + { + _data[i] = std::move(_data[i+1]); + } } else { @@ -324,7 +327,10 @@ namespace Seele T *newData = new T[newSize]; assert(newData != nullptr); allocated = newSize; - std::memcpy(newData, _data, sizeof(T) * arraySize); + for(uint32 i = 0; i < arraySize; ++i) + { + newData[i] = std::move(_data[i]); + } arraySize = newSize; delete _data; _data = newData; @@ -410,8 +416,9 @@ namespace Seele template void serialize(Archive& ar, const unsigned int version) { + ar & version; ar & arraySize; - ar & allocated; + resize(arraySize); for(size_t i = 0; i < arraySize; ++i) ar & _data[i]; refreshIterators(); @@ -431,7 +438,7 @@ namespace Seele class IteratorBase { public: - using iterator_category = std::forward_iterator_tag; + using iterator_category = std::random_access_iterator_tag; using value_type = X; using difference_type = std::ptrdiff_t; using reference = X&; @@ -441,10 +448,6 @@ namespace Seele : p(x) { } - IteratorBase(const IteratorBase &i) - : p(i.p) - { - } reference operator*() const { return *p; @@ -472,6 +475,18 @@ namespace Seele ++*this; return tmp; } + IteratorBase &operator--() + { + p--; + return *this; + } + IteratorBase operator--(int) + { + IteratorBase tmp(*this); + --*this; + return tmp; + } + private: X *p; @@ -522,12 +537,12 @@ namespace Seele } constexpr reference operator[](size_type index) noexcept { - assert(index >= 0 && index < N); + assert(index < N); return _data[index]; } constexpr const_reference operator[](size_type index) const noexcept { - assert(index >= 0 && index < N); + assert(index < N); return _data[index]; } iterator begin() @@ -554,6 +569,7 @@ namespace Seele template void serialize(Archive& ar, const unsigned int version) { + ar & version; ar & N; ar & _data; } diff --git a/src/Engine/Containers/Map.h b/src/Engine/Containers/Map.h index 3ee75e2..937b707 100644 --- a/src/Engine/Containers/Map.h +++ b/src/Engine/Containers/Map.h @@ -28,9 +28,9 @@ struct Map private: struct Node { - Pair pair; Node *leftChild; Node *rightChild; + Pair pair; Node() : leftChild(nullptr), rightChild(nullptr), pair() { diff --git a/src/Engine/Fibers/CMakeLists.txt b/src/Engine/Fibers/CMakeLists.txt index 5fcd8d5..bea480a 100644 --- a/src/Engine/Fibers/CMakeLists.txt +++ b/src/Engine/Fibers/CMakeLists.txt @@ -1,6 +1,6 @@ -target_sources(SeeleEngine - PRIVATE - Fibers.h - Fibers.cpp - JobQueue.h - JobQueue.cpp) \ No newline at end of file +#target_sources(SeeleEngine +# PRIVATE +# Fibers.h +# Fibers.cpp +# JobQueue.h +# JobQueue.cpp) \ No newline at end of file diff --git a/src/Engine/Fibers/Fibers.h b/src/Engine/Fibers/Fibers.h index f96d74d..86fa656 100644 --- a/src/Engine/Fibers/Fibers.h +++ b/src/Engine/Fibers/Fibers.h @@ -1,8 +1,6 @@ #pragma once #include "MinimalEngine.h" #include "JobQueue.h" -#include -#include namespace Seele { @@ -67,14 +65,14 @@ public: private: std::atomic_uint64_t count; }; -DEFINE_REF(Counter); +DEFINE_REF(Counter) struct AwaitCounter { PCounter counter; uint64 target; JobPriority priority = JobPriority::MEDIUM; bool await_ready() { return counter->greaterEqual(target); } - void await_suspend(std::coroutine_handle<> h) { + void await_suspend(std::coroutine_handle<>) { } void await_resume() {} }; diff --git a/src/Engine/Fibers/JobQueue.h b/src/Engine/Fibers/JobQueue.h index 9e0130a..83d21b5 100644 --- a/src/Engine/Fibers/JobQueue.h +++ b/src/Engine/Fibers/JobQueue.h @@ -1,13 +1,12 @@ #pragma once #include "MinimalEngine.h" #include "Containers/List.h" -#include namespace Seele { namespace Fibers { class FiberJob; -DECLARE_REF(Counter); +DECLARE_REF(Counter) enum class JobPriority : size_t { HIGH = 0, diff --git a/src/Engine/Graphics/Graphics.h b/src/Engine/Graphics/Graphics.h index a2489df..42ffe1e 100644 --- a/src/Engine/Graphics/Graphics.h +++ b/src/Engine/Graphics/Graphics.h @@ -61,6 +61,6 @@ protected: PShaderCompiler shaderCompiler; friend class Window; }; -DEFINE_REF(Graphics); +DEFINE_REF(Graphics) } // namespace Gfx } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/GraphicsInitializer.h b/src/Engine/Graphics/GraphicsInitializer.h index 8605b89..60a5ae3 100644 --- a/src/Engine/Graphics/GraphicsInitializer.h +++ b/src/Engine/Graphics/GraphicsInitializer.h @@ -6,10 +6,9 @@ namespace Seele struct GraphicsInitializer { - const char *windowLayoutFile; const char *applicationName; const char *engineName; - void *windowHandle; + const char *windowLayoutFile; /** * layers defines the enabled Vulkan layers used in the instance, * if ENABLE_VALIDATION is defined, standard validation is already enabled @@ -18,12 +17,23 @@ struct GraphicsInitializer Array layers; Array instanceExtensions; Array deviceExtensions; + + void *windowHandle; GraphicsInitializer() - : applicationName("SeeleEngine"), engineName("SeeleEngine"), layers{"VK_LAYER_KHRONOS_validation"}, instanceExtensions{}, deviceExtensions{"VK_KHR_swapchain"}, windowHandle(nullptr) + : applicationName("SeeleEngine") + , engineName("SeeleEngine") + , layers{"VK_LAYER_KHRONOS_validation"} + , instanceExtensions{} + , deviceExtensions{"VK_KHR_swapchain"} + , windowHandle(nullptr) { } GraphicsInitializer(const GraphicsInitializer &other) - : applicationName(other.applicationName), engineName(other.engineName), layers(other.layers), instanceExtensions(other.instanceExtensions), deviceExtensions(other.deviceExtensions) + : applicationName(other.applicationName) + , engineName(other.engineName) + , layers(other.layers) + , instanceExtensions(other.instanceExtensions) + , deviceExtensions(other.deviceExtensions) { } }; @@ -191,14 +201,14 @@ struct ColorBlendState float blendConstants[4]; }; } // namespace Gfx -DECLARE_NAME_REF(Gfx, VertexDeclaration); -DECLARE_NAME_REF(Gfx, VertexShader); -DECLARE_NAME_REF(Gfx, ControlShader); -DECLARE_NAME_REF(Gfx, EvaluationShader); -DECLARE_NAME_REF(Gfx, GeometryShader); -DECLARE_NAME_REF(Gfx, FragmentShader); -DECLARE_NAME_REF(Gfx, PipelineLayout); -DECLARE_NAME_REF(Gfx, RenderPass); +DECLARE_NAME_REF(Gfx, VertexDeclaration) +DECLARE_NAME_REF(Gfx, VertexShader) +DECLARE_NAME_REF(Gfx, ControlShader) +DECLARE_NAME_REF(Gfx, EvaluationShader) +DECLARE_NAME_REF(Gfx, GeometryShader) +DECLARE_NAME_REF(Gfx, FragmentShader) +DECLARE_NAME_REF(Gfx, PipelineLayout) +DECLARE_NAME_REF(Gfx, RenderPass) struct GraphicsPipelineCreateInfo { Gfx::PVertexDeclaration vertexDeclaration; @@ -216,7 +226,7 @@ struct GraphicsPipelineCreateInfo Gfx::ColorBlendState colorBlend; GraphicsPipelineCreateInfo() { - std::memset(this, 0, sizeof(*this)); + std::memset((void*)this, 0, sizeof(*this)); topology = Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; rasterizationState.cullMode = Gfx::SE_CULL_MODE_BACK_BIT; rasterizationState.polygonMode = Gfx::SE_POLYGON_MODE_FILL; diff --git a/src/Engine/Graphics/GraphicsResources.cpp b/src/Engine/Graphics/GraphicsResources.cpp index de7393f..8ef5607 100644 --- a/src/Engine/Graphics/GraphicsResources.cpp +++ b/src/Engine/Graphics/GraphicsResources.cpp @@ -43,7 +43,7 @@ ShaderCollection& ShaderMap::createShaders( RenderPassType renderPass, PMaterial material, VertexInputType* vertexInput, - bool bPositionOnly) + bool /*bPositionOnly*/) { ShaderCollection& collection = shaders.add(); //collection.vertexDeclaration = bPositionOnly ? vertexInput->getPositionDeclaration() : vertexInput->getDeclaration(); @@ -139,8 +139,8 @@ void PipelineLayout::addPushConstants(const SePushConstantRange &pushConstant) } QueueOwnedResource::QueueOwnedResource(QueueFamilyMapping mapping, QueueType startQueueType) - : mapping(mapping) - , currentOwner(startQueueType) + : currentOwner(startQueueType) + , mapping(mapping) { } @@ -224,7 +224,9 @@ IndexBuffer::~IndexBuffer() VertexStream::VertexStream() {} VertexStream::VertexStream(uint32 stride, uint32 offset, uint8 instanced) - : stride(stride), instanced(instanced), offset(offset) + : stride(stride) + , offset(offset) + , instanced(instanced) { } VertexStream::~VertexStream() @@ -294,31 +296,53 @@ RenderCommand::~RenderCommand() } RenderTargetLayout::RenderTargetLayout() - : inputAttachments(), colorAttachments(), depthAttachment() + : inputAttachments() + , colorAttachments() + , depthAttachment() { } RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment depthAttachment) - : inputAttachments(), colorAttachments(), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY()) + : inputAttachments() + , colorAttachments() + , depthAttachment(depthAttachment) + , width(depthAttachment->getTexture()->getSizeX()) + , height(depthAttachment->getTexture()->getSizeY()) { } RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment colorAttachment, PRenderTargetAttachment depthAttachment) - : inputAttachments(), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY()) + : inputAttachments() + , depthAttachment(depthAttachment) + , width(depthAttachment->getTexture()->getSizeX()) + , height(depthAttachment->getTexture()->getSizeY()) { colorAttachments.add(colorAttachment); } -RenderTargetLayout::RenderTargetLayout(Array colorAttachments, PRenderTargetAttachment depthAttachmet) - : inputAttachments(), colorAttachments(colorAttachments), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY()) +RenderTargetLayout::RenderTargetLayout(Array colorAttachments, PRenderTargetAttachment depthAttachment) + : inputAttachments() + , colorAttachments(colorAttachments) + , depthAttachment(depthAttachment) + , width(depthAttachment->getTexture()->getSizeX()) + , height(depthAttachment->getTexture()->getSizeY()) { } RenderTargetLayout::RenderTargetLayout(Array inputAttachments, Array colorAttachments, PRenderTargetAttachment depthAttachment) - : inputAttachments(inputAttachments), colorAttachments(colorAttachments), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY()) + : inputAttachments(inputAttachments) + , colorAttachments(colorAttachments) + , depthAttachment(depthAttachment) + , width(depthAttachment->getTexture()->getSizeX()) + , height(depthAttachment->getTexture()->getSizeY()) { } Window::Window(const WindowCreateInfo &createInfo) - : sizeX(createInfo.width), sizeY(createInfo.height), bFullscreen(createInfo.bFullscreen), title(createInfo.title), pixelFormat(createInfo.pixelFormat), samples(createInfo.numSamples) + : sizeX(createInfo.width) + , sizeY(createInfo.height) + , bFullscreen(createInfo.bFullscreen) + , title(createInfo.title) + , pixelFormat(createInfo.pixelFormat) + , samples(createInfo.numSamples) { } @@ -327,7 +351,11 @@ Window::~Window() } Viewport::Viewport(PWindow owner, const ViewportCreateInfo &viewportInfo) - : sizeX(viewportInfo.sizeX), sizeY(viewportInfo.sizeY), offsetX(viewportInfo.offsetX), offsetY(viewportInfo.offsetY), owner(owner) + : sizeX(viewportInfo.sizeX) + , sizeY(viewportInfo.sizeY) + , offsetX(viewportInfo.offsetX) + , offsetY(viewportInfo.offsetY) + , owner(owner) { } diff --git a/src/Engine/Graphics/GraphicsResources.h b/src/Engine/Graphics/GraphicsResources.h index 6a5171a..89430b3 100644 --- a/src/Engine/Graphics/GraphicsResources.h +++ b/src/Engine/Graphics/GraphicsResources.h @@ -20,7 +20,7 @@ class VertexInputType; DECLARE_REF(Material) namespace Gfx { -DECLARE_REF(Graphics); +DECLARE_REF(Graphics) class SamplerState { @@ -29,11 +29,11 @@ public: { } }; -DEFINE_REF(SamplerState); +DEFINE_REF(SamplerState) class Shader {}; -DEFINE_REF(Shader); +DEFINE_REF(Shader) class VertexShader { @@ -41,7 +41,7 @@ public: VertexShader() {} virtual ~VertexShader() {} }; -DEFINE_REF(VertexShader); +DEFINE_REF(VertexShader) class ControlShader { public: @@ -52,28 +52,28 @@ public: protected: uint32 numPatchPoints; }; -DEFINE_REF(ControlShader); +DEFINE_REF(ControlShader) class EvaluationShader { public: EvaluationShader() {} virtual ~EvaluationShader() {} }; -DEFINE_REF(EvaluationShader); +DEFINE_REF(EvaluationShader) class GeometryShader { public: GeometryShader() {} virtual ~GeometryShader() {} }; -DEFINE_REF(GeometryShader); +DEFINE_REF(GeometryShader) class FragmentShader { public: FragmentShader() {} virtual ~FragmentShader() {} }; -DEFINE_REF(FragmentShader); +DEFINE_REF(FragmentShader) //Uniquely identifies a permutation of shaders //using the type parameters used to generate it @@ -138,7 +138,7 @@ public: private: Array shaders; }; -DEFINE_REF(ShaderMap); +DEFINE_REF(ShaderMap) class ComputeShader { @@ -146,7 +146,7 @@ public: ComputeShader() {} virtual ~ComputeShader() {} }; -DEFINE_REF(ComputeShader); +DEFINE_REF(ComputeShader) class DescriptorBinding { @@ -171,9 +171,9 @@ public: uint32_t descriptorCount; SeShaderStageFlags shaderStages; }; -DEFINE_REF(DescriptorBinding); +DEFINE_REF(DescriptorBinding) -DECLARE_REF(DescriptorSet); +DECLARE_REF(DescriptorSet) class DescriptorAllocator { public: @@ -182,10 +182,10 @@ public: virtual void allocateDescriptorSet(PDescriptorSet &descriptorSet) = 0; virtual void reset() = 0; }; -DEFINE_REF(DescriptorAllocator); -DECLARE_REF(UniformBuffer); -DECLARE_REF(StructuredBuffer); -DECLARE_REF(Texture); +DEFINE_REF(DescriptorAllocator) +DECLARE_REF(UniformBuffer) +DECLARE_REF(StructuredBuffer) +DECLARE_REF(Texture) class DescriptorSet { public: @@ -199,7 +199,7 @@ public: virtual uint32 getSetIndex() const = 0; }; -DEFINE_REF(DescriptorSet); +DEFINE_REF(DescriptorSet) class DescriptorLayout { @@ -209,10 +209,17 @@ public: { } virtual ~DescriptorLayout() {} - void operator=(const DescriptorLayout &other) + DescriptorLayout& operator=(const DescriptorLayout &other) { - descriptorBindings.resize(other.descriptorBindings.size()); - std::memcpy(descriptorBindings.data(), other.descriptorBindings.data(), sizeof(DescriptorLayout) * descriptorBindings.size()); + if(this != &other) + { + descriptorBindings.resize(other.descriptorBindings.size()); + for(uint32 i = 0; i < descriptorBindings.size(); ++i) + { + descriptorBindings[i] = other.descriptorBindings[i]; + } + } + return *this; } virtual void create() = 0; virtual void addDescriptorBinding(uint32 binding, SeDescriptorType type, uint32 arrayCount = 1); @@ -228,7 +235,7 @@ protected: friend class PipelineLayout; friend class DescriptorAllocator; }; -DEFINE_REF(DescriptorLayout); +DEFINE_REF(DescriptorLayout) class PipelineLayout { public: @@ -244,7 +251,7 @@ protected: Array descriptorSetLayouts; Array pushConstants; }; -DEFINE_REF(PipelineLayout); +DEFINE_REF(PipelineLayout) struct QueueFamilyMapping { @@ -290,7 +297,7 @@ protected: Gfx::QueueType currentOwner; QueueFamilyMapping mapping; }; -DEFINE_REF(QueueOwnedResource); +DEFINE_REF(QueueOwnedResource) // IMPORTANT!! // WHEN DERIVING FROM ANY Gfx:: BASE CLASSES WITH MULTIPLE INHERITANCE @@ -337,7 +344,7 @@ protected: // Inherited via QueueOwnedResource virtual void executeOwnershipBarrier(QueueType newOwner) = 0; }; -DEFINE_REF(UniformBuffer); +DEFINE_REF(UniformBuffer) class VertexBuffer : public Buffer { @@ -360,7 +367,7 @@ protected: uint32 numVertices; uint32 vertexSize; }; -DEFINE_REF(VertexBuffer); +DEFINE_REF(VertexBuffer) class IndexBuffer : public Buffer { @@ -382,7 +389,7 @@ protected: Gfx::SeIndexType indexType; uint32 numIndices; }; -DEFINE_REF(IndexBuffer); +DEFINE_REF(IndexBuffer) class StructuredBuffer : public Buffer { @@ -393,7 +400,7 @@ protected: // Inherited via QueueOwnedResource virtual void executeOwnershipBarrier(QueueType newOwner) = 0; }; -DEFINE_REF(StructuredBuffer); +DEFINE_REF(StructuredBuffer) class VertexStream { @@ -410,7 +417,7 @@ public: Array vertexDescription; uint8 instanced; }; -DEFINE_REF(VertexStream); +DEFINE_REF(VertexStream) class VertexDeclaration { public: @@ -420,7 +427,7 @@ public: static PVertexDeclaration createDeclaration(PGraphics graphics, const Array& elementList); private: }; -DEFINE_REF(VertexDeclaration); +DEFINE_REF(VertexDeclaration) class GraphicsPipeline { public: @@ -429,10 +436,10 @@ public: const GraphicsPipelineCreateInfo& getCreateInfo() const {return createInfo;} PPipelineLayout getPipelineLayout() const { return layout; } protected: - PPipelineLayout layout; GraphicsPipelineCreateInfo createInfo; + PPipelineLayout layout; }; -DEFINE_REF(GraphicsPipeline); +DEFINE_REF(GraphicsPipeline) // IMPORTANT!! // WHEN DERIVING FROM ANY Gfx:: BASE CLASSES WITH MULTIPLE INHERITANCE @@ -455,7 +462,7 @@ protected: // Inherited via QueueOwnedResource virtual void executeOwnershipBarrier(QueueType newOwner) = 0; }; -DEFINE_REF(Texture); +DEFINE_REF(Texture) class Texture2D : public Texture { public: @@ -471,9 +478,9 @@ protected: //Inherited via QueueOwnedResource virtual void executeOwnershipBarrier(QueueType newOwner) = 0; }; -DEFINE_REF(Texture2D); +DEFINE_REF(Texture2D) -DECLARE_REF(Viewport); +DECLARE_REF(Viewport) class RenderCommand { public: @@ -488,7 +495,7 @@ public: virtual void bindIndexBuffer(Gfx::PIndexBuffer indexBuffer) = 0; virtual void draw(const MeshBatchElement& data) = 0; }; -DEFINE_REF(RenderCommand); +DEFINE_REF(RenderCommand) class Window { @@ -521,7 +528,7 @@ protected: SeFormat pixelFormat; uint32 samples; }; -DEFINE_REF(Window); +DEFINE_REF(Window) class Viewport { @@ -542,7 +549,7 @@ protected: uint32 offsetY; PWindow owner; }; -DEFINE_REF(Viewport); +DEFINE_REF(Viewport) class RenderTargetAttachment { @@ -583,7 +590,7 @@ protected: SeAttachmentLoadOp stencilLoadOp; SeAttachmentStoreOp stencilStoreOp; }; -DEFINE_REF(RenderTargetAttachment); +DEFINE_REF(RenderTargetAttachment) class SwapchainAttachment : public RenderTargetAttachment { @@ -617,7 +624,7 @@ public: private: PWindow owner; }; -DEFINE_REF(SwapchainAttachment); +DEFINE_REF(SwapchainAttachment) class RenderTargetLayout { @@ -633,7 +640,7 @@ public: uint32 width; uint32 height; }; -DEFINE_REF(RenderTargetLayout); +DEFINE_REF(RenderTargetLayout) class RenderPass { @@ -645,6 +652,6 @@ public: protected: PRenderTargetLayout layout; }; -DEFINE_REF(RenderPass); +DEFINE_REF(RenderPass) } // namespace Gfx } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/Mesh.cpp b/src/Engine/Graphics/Mesh.cpp index 3e75848..339b6bc 100644 --- a/src/Engine/Graphics/Mesh.cpp +++ b/src/Engine/Graphics/Mesh.cpp @@ -3,8 +3,8 @@ using namespace Seele; Mesh::Mesh(PVertexShaderInput vertexInput, Gfx::PIndexBuffer indexBuffer) - : vertexInput(vertexInput) - , indexBuffer(indexBuffer) + : indexBuffer(indexBuffer) + , vertexInput(vertexInput) { } diff --git a/src/Engine/Graphics/Mesh.h b/src/Engine/Graphics/Mesh.h index 44a2720..67fac48 100644 --- a/src/Engine/Graphics/Mesh.h +++ b/src/Engine/Graphics/Mesh.h @@ -42,7 +42,7 @@ struct MeshDescription //TODO declaration } };*/ -DECLARE_REF(MaterialAsset); +DECLARE_REF(MaterialAsset) class Mesh { public: @@ -55,11 +55,9 @@ public: private: friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int version) + void serialize(Archive&, const unsigned int) { - //ar & referencedMaterial->getFullPath(); - //TODO: - } + } }; -DEFINE_REF(Mesh); +DEFINE_REF(Mesh) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/MeshBatch.h b/src/Engine/Graphics/MeshBatch.h index 26cb8cc..5b2a33f 100644 --- a/src/Engine/Graphics/MeshBatch.h +++ b/src/Engine/Graphics/MeshBatch.h @@ -2,11 +2,11 @@ namespace Seele { -DECLARE_REF(MaterialAsset); -DECLARE_REF(VertexShaderInput); -DECLARE_NAME_REF(Gfx, VertexBuffer); -DECLARE_NAME_REF(Gfx, IndexBuffer); -DECLARE_NAME_REF(Gfx, UniformBuffer); +DECLARE_REF(MaterialAsset) +DECLARE_REF(VertexShaderInput) +DECLARE_NAME_REF(Gfx, VertexBuffer) +DECLARE_NAME_REF(Gfx, IndexBuffer) +DECLARE_NAME_REF(Gfx, UniformBuffer) struct MeshBatchElement { public: @@ -32,13 +32,13 @@ public: MeshBatchElement() : uniformBuffer(nullptr) , indexBuffer(nullptr) - , indirectArgsBuffer(nullptr) , firstIndex(0) , numPrimitives(0) , numInstances(1) , baseVertexIndex(0) , minVertexIndex(0) , maxVertexIndex(0) + , indirectArgsBuffer(nullptr) {} }; struct MeshBatch @@ -81,13 +81,13 @@ struct MeshBatch , isBackfaceCullingDisabled(false) , isCastingShadow(true) , useWireframe(false) + , topology(Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST) , vertexInput(nullptr) , material(nullptr) - , topology(Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST) { } }; -DECLARE_REF(PrimitiveComponent); +DECLARE_REF(PrimitiveComponent) struct StaticMeshBatch : public MeshBatch { uint32 index; diff --git a/src/Engine/Graphics/RenderPass/BasePass.cpp b/src/Engine/Graphics/RenderPass/BasePass.cpp index ef40e38..02713fd 100644 --- a/src/Engine/Graphics/RenderPass/BasePass.cpp +++ b/src/Engine/Graphics/RenderPass/BasePass.cpp @@ -26,10 +26,10 @@ void BasePassMeshProcessor::addMeshBatch( Gfx::PPipelineLayout pipelineLayout, Gfx::PDescriptorLayout primitiveLayout, Array& descriptorSets, - int32 staticMeshId) + int32 /*staticMeshId*/) { const PMaterialAsset material = batch.material; - const Gfx::MaterialShadingModel shadingModel = material->getShadingModel(); + //const Gfx::MaterialShadingModel shadingModel = material->getShadingModel(); const PVertexShaderInput vertexInput = batch.vertexInput; diff --git a/src/Engine/Graphics/RenderPass/BasePass.h b/src/Engine/Graphics/RenderPass/BasePass.h index 307aad3..df67666 100644 --- a/src/Engine/Graphics/RenderPass/BasePass.h +++ b/src/Engine/Graphics/RenderPass/BasePass.h @@ -24,13 +24,13 @@ private: Array renderCommands; Array cachedCommandBuffers; Array cachedPrimitiveSets; - uint32 cachedPrimitiveIndex; Gfx::PViewport target; uint8 translucentBasePass; + uint32 cachedPrimitiveIndex; }; -DEFINE_REF(BasePassMeshProcessor); -DECLARE_REF(CameraActor); -DECLARE_REF(CameraComponent); +DEFINE_REF(BasePassMeshProcessor) +DECLARE_REF(CameraActor) +DECLARE_REF(CameraComponent) class BasePass { public: @@ -54,8 +54,12 @@ private: Gfx::PRenderPass renderPass; Gfx::PTexture2D depthBuffer; - const PScene scene; UPBasePassMeshProcessor processor; + const PScene scene; + Gfx::PGraphics graphics; + Gfx::PViewport viewport; + Array descriptorSets; + PCameraComponent source; Gfx::PPipelineLayout basePassLayout; // Set 0: Light environment Gfx::PDescriptorLayout lightLayout; @@ -68,10 +72,6 @@ private: // Set 3: primitive scene data Gfx::PDescriptorLayout primitiveLayout; Gfx::PUniformBuffer primitiveUniformBuffer; - Array descriptorSets; - Gfx::PGraphics graphics; - PCameraComponent source; - Gfx::PViewport viewport; }; -DEFINE_REF(BasePass); +DEFINE_REF(BasePass) } // namespace Seele diff --git a/src/Engine/Graphics/ShaderCompiler.h b/src/Engine/Graphics/ShaderCompiler.h index 65a5e3c..bc0481b 100644 --- a/src/Engine/Graphics/ShaderCompiler.h +++ b/src/Engine/Graphics/ShaderCompiler.h @@ -3,8 +3,8 @@ namespace Seele { -DECLARE_REF(Material); -DECLARE_NAME_REF(Gfx, Graphics); +DECLARE_REF(Material) +DECLARE_NAME_REF(Gfx, Graphics) namespace Gfx { class ShaderCompiler @@ -17,6 +17,6 @@ private: Array pendingCompiles; PGraphics graphics; }; -DEFINE_REF(ShaderCompiler); +DEFINE_REF(ShaderCompiler) } // namespace Gfx } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/StaticMeshVertexInput.cpp b/src/Engine/Graphics/StaticMeshVertexInput.cpp index e1343d4..348d210 100644 --- a/src/Engine/Graphics/StaticMeshVertexInput.cpp +++ b/src/Engine/Graphics/StaticMeshVertexInput.cpp @@ -66,4 +66,4 @@ void StaticMeshVertexInput::setData(StaticMeshDataType&& data) this->data = std::move(data); } -IMPLEMENT_VERTEX_INPUT_TYPE(StaticMeshVertexInput, "StaticMeshVertexInput"); \ No newline at end of file +IMPLEMENT_VERTEX_INPUT_TYPE(StaticMeshVertexInput, "StaticMeshVertexInput") \ No newline at end of file diff --git a/src/Engine/Graphics/StaticMeshVertexInput.h b/src/Engine/Graphics/StaticMeshVertexInput.h index acfe591..6a85edc 100644 --- a/src/Engine/Graphics/StaticMeshVertexInput.h +++ b/src/Engine/Graphics/StaticMeshVertexInput.h @@ -16,7 +16,7 @@ struct StaticMeshDataType }; class StaticMeshVertexInput : public VertexShaderInput { - DECLARE_VERTEX_INPUT_TYPE(StaticMeshVertexInput); + DECLARE_VERTEX_INPUT_TYPE(StaticMeshVertexInput) public: StaticMeshVertexInput(std::string name); virtual ~StaticMeshVertexInput(); @@ -25,5 +25,5 @@ public: private: StaticMeshDataType data; }; -DEFINE_REF(StaticMeshVertexInput); +DEFINE_REF(StaticMeshVertexInput) } \ No newline at end of file diff --git a/src/Engine/Graphics/VertexShaderInput.h b/src/Engine/Graphics/VertexShaderInput.h index 6445eb4..91c8821 100644 --- a/src/Engine/Graphics/VertexShaderInput.h +++ b/src/Engine/Graphics/VertexShaderInput.h @@ -111,13 +111,13 @@ private: VertexInputType* inputClass::getType() const { return &staticType; } struct MeshDescription; -DECLARE_REF(VertexShaderInput); +DECLARE_REF(VertexShaderInput) class VertexShaderInput { public: VertexShaderInput(std::string name); virtual ~VertexShaderInput(); - virtual void init(Gfx::PGraphics graphics) {}; + virtual void init(Gfx::PGraphics) {} void getStreams(VertexInputStreamArray& outVertexStreams) const; void getPositionOnlyStream(VertexInputStreamArray& outVertexStreams) const; virtual bool supportsTesselation() { return false; } @@ -158,5 +158,5 @@ protected: Gfx::PVertexDeclaration positionDeclaration; std::string name; }; -DEFINE_REF(VertexShaderInput); +DEFINE_REF(VertexShaderInput) } // namespace Seele diff --git a/src/Engine/Graphics/Vulkan/VulkanAllocator.cpp b/src/Engine/Graphics/Vulkan/VulkanAllocator.cpp index 93ff625..51fddc2 100644 --- a/src/Engine/Graphics/Vulkan/VulkanAllocator.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanAllocator.cpp @@ -5,7 +5,11 @@ using namespace Seele::Vulkan; SubAllocation::SubAllocation(Allocation *owner, VkDeviceSize allocatedOffset, VkDeviceSize size, VkDeviceSize alignedOffset, VkDeviceSize allocatedSize) - : owner(owner), size(size), allocatedOffset(allocatedOffset), alignedOffset(alignedOffset), allocatedSize(allocatedSize) + : owner(owner) + , size(size) + , allocatedOffset(allocatedOffset) + , alignedOffset(alignedOffset) + , allocatedSize(allocatedSize) { } @@ -41,7 +45,13 @@ void SubAllocation::invalidateMemory() Allocation::Allocation(PGraphics graphics, Allocator *allocator, VkDeviceSize size, uint8 memoryTypeIndex, VkMemoryPropertyFlags properties, VkMemoryDedicatedAllocateInfo *dedicatedInfo) - : device(graphics->getDevice()), allocator(allocator), bytesAllocated(0), bytesUsed(0), readable(properties & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT), properties(properties), memoryTypeIndex(memoryTypeIndex) + : device(graphics->getDevice()) + , allocator(allocator) + , bytesAllocated(0) + , bytesUsed(0) + , readable(properties & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) + , properties(properties) + , memoryTypeIndex(memoryTypeIndex) { VkMemoryAllocateInfo allocInfo = init::MemoryAllocateInfo(); @@ -224,7 +234,7 @@ PSubAllocation Allocator::allocate(const VkMemoryRequirements2 &memRequirements2 } // no suitable allocations found, allocate new block - PAllocation newAllocation = new Allocation(graphics, this, (requirements.size > MemoryBlockSize) ? requirements.size : MemoryBlockSize, memoryTypeIndex, properties, nullptr); + PAllocation newAllocation = new Allocation(graphics, this, (requirements.size > MemoryBlockSize) ? requirements.size : (VkDeviceSize)MemoryBlockSize, memoryTypeIndex, properties, nullptr); heaps[heapIndex].allocations.add(newAllocation); return newAllocation->getSuballocation(requirements.size, requirements.alignment); } diff --git a/src/Engine/Graphics/Vulkan/VulkanAllocator.h b/src/Engine/Graphics/Vulkan/VulkanAllocator.h index b924cf8..b23eb8d 100644 --- a/src/Engine/Graphics/Vulkan/VulkanAllocator.h +++ b/src/Engine/Graphics/Vulkan/VulkanAllocator.h @@ -9,7 +9,7 @@ namespace Seele { namespace Vulkan { -DECLARE_REF(Graphics); +DECLARE_REF(Graphics) class Allocation; class Allocator; class SubAllocation @@ -33,14 +33,14 @@ public: private: Allocation *owner; - VkDeviceSize allocatedOffset; VkDeviceSize size; + VkDeviceSize allocatedOffset; VkDeviceSize alignedOffset; VkDeviceSize allocatedSize; friend class Allocation; friend class Allocator; }; -DEFINE_REF(SubAllocation); +DEFINE_REF(SubAllocation) class Allocation { public: @@ -94,24 +94,24 @@ public: } private: - Allocator *allocator; VkDevice device; - VkDeviceMemory allocatedMemory; + Allocator *allocator; VkDeviceSize bytesAllocated; VkDeviceSize bytesUsed; - VkMemoryPropertyFlags properties; + VkDeviceMemory allocatedMemory; Map activeAllocations; Map freeRanges; std::mutex lock; void *mappedPointer; - uint8 memoryTypeIndex; uint8 isDedicated : 1; uint8 canMap : 1; uint8 isMapped : 1; uint8 readable : 1; + VkMemoryPropertyFlags properties; + uint8 memoryTypeIndex; friend class Allocator; }; -DEFINE_REF(Allocation); +DEFINE_REF(Allocation) class Allocator { @@ -159,7 +159,7 @@ private: PGraphics graphics; VkPhysicalDeviceMemoryProperties memProperties; }; -DEFINE_REF(Allocator); +DEFINE_REF(Allocator) class StagingBuffer { @@ -207,7 +207,7 @@ private: uint8 bReadable; friend class StagingManager; }; -DEFINE_REF(StagingBuffer); +DEFINE_REF(StagingBuffer) class StagingManager { @@ -225,6 +225,6 @@ private: Array activeBuffers; std::mutex lock; }; -DEFINE_REF(StagingManager); +DEFINE_REF(StagingManager) } // namespace Vulkan } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/VulkanBuffer.cpp b/src/Engine/Graphics/Vulkan/VulkanBuffer.cpp index 16c9f43..67ed2a0 100644 --- a/src/Engine/Graphics/Vulkan/VulkanBuffer.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanBuffer.cpp @@ -17,7 +17,10 @@ struct PendingBuffer static Map pendingBuffers; ShaderBuffer::ShaderBuffer(PGraphics graphics, uint32 size, VkBufferUsageFlags usage, Gfx::QueueType queueType) - : graphics(graphics), currentBuffer(0), size(size), currentOwner(queueType) + : graphics(graphics) + , currentBuffer(0) + , size(size) + , currentOwner(queueType) { if (usage & VK_BUFFER_USAGE_INDEX_BUFFER_BIT || usage & VK_BUFFER_USAGE_VERTEX_BUFFER_BIT || @@ -242,8 +245,8 @@ void ShaderBuffer::unlock() } UniformBuffer::UniformBuffer(PGraphics graphics, const UniformBufferCreateInfo &createInfo) - : Vulkan::ShaderBuffer(graphics, createInfo.resourceData.size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, createInfo.resourceData.owner) - , Gfx::UniformBuffer(graphics->getFamilyMapping(), createInfo.resourceData) + : Gfx::UniformBuffer(graphics->getFamilyMapping(), createInfo.resourceData) + , Vulkan::ShaderBuffer(graphics, createInfo.resourceData.size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, createInfo.resourceData.owner) , dedicatedStagingBuffer(nullptr) { if(createInfo.bDynamic) @@ -313,8 +316,8 @@ VkAccessFlags UniformBuffer::getDestAccessMask() } StructuredBuffer::StructuredBuffer(PGraphics graphics, const BulkResourceData &resourceData) - : Vulkan::ShaderBuffer(graphics, resourceData.size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, resourceData.owner) - , Gfx::StructuredBuffer(graphics->getFamilyMapping(), resourceData.owner) + : Gfx::StructuredBuffer(graphics->getFamilyMapping(), resourceData.owner) + , Vulkan::ShaderBuffer(graphics, resourceData.size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, resourceData.owner) { if (resourceData.data != nullptr) { @@ -349,8 +352,8 @@ VkAccessFlags StructuredBuffer::getDestAccessMask() } VertexBuffer::VertexBuffer(PGraphics graphics, const VertexBufferCreateInfo &resourceData) - : Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, resourceData.resourceData.owner) - , Gfx::VertexBuffer(graphics->getFamilyMapping(), resourceData.numVertices, resourceData.vertexSize, resourceData.resourceData.owner) + : Gfx::VertexBuffer(graphics->getFamilyMapping(), resourceData.numVertices, resourceData.vertexSize, resourceData.resourceData.owner) + , Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, resourceData.resourceData.owner) { if (resourceData.resourceData.data != nullptr) { @@ -385,8 +388,8 @@ VkAccessFlags VertexBuffer::getDestAccessMask() } IndexBuffer::IndexBuffer(PGraphics graphics, const IndexBufferCreateInfo &resourceData) - : Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, resourceData.resourceData.owner) - , Gfx::IndexBuffer(graphics->getFamilyMapping(), resourceData.resourceData.size, resourceData.indexType, resourceData.resourceData.owner) + : Gfx::IndexBuffer(graphics->getFamilyMapping(), resourceData.resourceData.size, resourceData.indexType, resourceData.resourceData.owner) + , Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, resourceData.resourceData.owner) { if (resourceData.resourceData.data != nullptr) { diff --git a/src/Engine/Graphics/Vulkan/VulkanCommandBuffer.cpp b/src/Engine/Graphics/Vulkan/VulkanCommandBuffer.cpp index 42a2768..eec2510 100644 --- a/src/Engine/Graphics/Vulkan/VulkanCommandBuffer.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanCommandBuffer.cpp @@ -23,7 +23,11 @@ CmdBufferBase::~CmdBufferBase() } CmdBuffer::CmdBuffer(PGraphics graphics, VkCommandPool cmdPool, PCommandBufferManager manager) - : CmdBufferBase(graphics, cmdPool), renderPass(nullptr), framebuffer(nullptr), subpassIndex(0), manager(manager) + : CmdBufferBase(graphics, cmdPool) + , manager(manager) + , renderPass(nullptr) + , framebuffer(nullptr) + , subpassIndex(0) { VkCommandBufferAllocateInfo allocInfo = init::CommandBufferAllocateInfo(cmdPool, diff --git a/src/Engine/Graphics/Vulkan/VulkanCommandBuffer.h b/src/Engine/Graphics/Vulkan/VulkanCommandBuffer.h index fced7b2..c198ab8 100644 --- a/src/Engine/Graphics/Vulkan/VulkanCommandBuffer.h +++ b/src/Engine/Graphics/Vulkan/VulkanCommandBuffer.h @@ -7,8 +7,8 @@ namespace Seele struct VertexInputStream; namespace Vulkan { -DECLARE_REF(RenderPass); -DECLARE_REF(Framebuffer); +DECLARE_REF(RenderPass) +DECLARE_REF(Framebuffer) class CmdBufferBase { public: @@ -27,10 +27,10 @@ protected: VkCommandBuffer handle; VkCommandPool owner; }; -DEFINE_REF(CmdBufferBase); +DEFINE_REF(CmdBufferBase) -DECLARE_REF(SecondaryCmdBuffer); -DECLARE_REF(CommandBufferManager); +DECLARE_REF(SecondaryCmdBuffer) +DECLARE_REF(CommandBufferManager) class CmdBuffer : public CmdBufferBase { public: @@ -68,10 +68,10 @@ private: friend class CommandBufferManager; friend class Queue; }; -DEFINE_REF(CmdBuffer); +DEFINE_REF(CmdBuffer) -DECLARE_REF(GraphicsPipeline); -DECLARE_REF(DescriptorSet); +DECLARE_REF(GraphicsPipeline) +DECLARE_REF(DescriptorSet) class SecondaryCmdBuffer : public Gfx::RenderCommand, public CmdBufferBase { public: @@ -94,7 +94,7 @@ private: Array boundDescriptors; friend class CmdBuffer; }; -DEFINE_REF(SecondaryCmdBuffer); +DEFINE_REF(SecondaryCmdBuffer) class CommandBufferManager { @@ -119,6 +119,6 @@ private: std::mutex allocatedBufferLock; Array allocatedBuffers; }; -DEFINE_REF(CommandBufferManager); +DEFINE_REF(CommandBufferManager) } // namespace Vulkan } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.cpp b/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.cpp index 15a677d..73f6cf3 100644 --- a/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.cpp @@ -218,7 +218,9 @@ void DescriptorSet::writeChanges() } DescriptorAllocator::DescriptorAllocator(PGraphics graphics, DescriptorLayout &layout) - : layout(layout), graphics(graphics), currentCachedIndex(0) + : graphics(graphics) + , layout(layout) + , currentCachedIndex(0) { std::memset(&cachedHandles, 0, sizeof(cachedHandles)); diff --git a/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.h b/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.h index f6cac37..5fbc84a 100644 --- a/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.h +++ b/src/Engine/Graphics/Vulkan/VulkanDescriptorSets.h @@ -5,7 +5,7 @@ namespace Seele { namespace Vulkan { -DECLARE_REF(Graphics); +DECLARE_REF(Graphics) class DescriptorLayout : public Gfx::DescriptorLayout { public: @@ -24,12 +24,14 @@ private: VkDescriptorSetLayout layoutHandle; friend class DescriptorAllocator; }; -DEFINE_REF(DescriptorLayout); +DEFINE_REF(DescriptorLayout) class PipelineLayout : public Gfx::PipelineLayout { public: PipelineLayout(PGraphics graphics) - : graphics(graphics), layoutHash(0), layoutHandle(VK_NULL_HANDLE) + : graphics(graphics) + , layoutHash(0) + , layoutHandle(VK_NULL_HANDLE) { } virtual ~PipelineLayout(); @@ -46,11 +48,11 @@ public: private: Array vulkanDescriptorLayouts; + PGraphics graphics; uint32 layoutHash; VkPipelineLayout layoutHandle; - PGraphics graphics; }; -DEFINE_REF(PipelineLayout); +DEFINE_REF(PipelineLayout) class DescriptorAllocator : public Gfx::DescriptorAllocator { @@ -71,13 +73,13 @@ public: private: PGraphics graphics; + DescriptorLayout &layout; + uint32 currentCachedIndex; const static int maxSets = 512; VkDescriptorSet cachedHandles[maxSets]; - uint32 currentCachedIndex; VkDescriptorPool poolHandle; - DescriptorLayout &layout; }; -DEFINE_REF(DescriptorAllocator); +DEFINE_REF(DescriptorAllocator) class DescriptorSet : public Gfx::DescriptorSet { @@ -119,12 +121,12 @@ private: // would not work anyways, so casts should be safe Array cachedData[Gfx::numFramesBuffered]; VkDescriptorSet setHandle[Gfx::numFramesBuffered]; + PGraphics graphics; PDescriptorAllocator owner; PCmdBuffer currentlyBound; - PGraphics graphics; friend class DescriptorAllocator; }; -DEFINE_REF(DescriptorSet); +DEFINE_REF(DescriptorSet) } // namespace Vulkan } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/VulkanFramebuffer.h b/src/Engine/Graphics/Vulkan/VulkanFramebuffer.h index 35b13f8..2a062fa 100644 --- a/src/Engine/Graphics/Vulkan/VulkanFramebuffer.h +++ b/src/Engine/Graphics/Vulkan/VulkanFramebuffer.h @@ -5,7 +5,7 @@ namespace Seele { namespace Vulkan { -DECLARE_REF(RenderPass); +DECLARE_REF(RenderPass) struct FramebufferDescription { VkImageView inputAttachments[16]; @@ -35,6 +35,6 @@ private: Gfx::PRenderTargetLayout layout; PRenderPass renderPass; }; -DEFINE_REF(Framebuffer); +DEFINE_REF(Framebuffer) } // namespace Vulkan } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/VulkanGraphics.cpp b/src/Engine/Graphics/Vulkan/VulkanGraphics.cpp index 1398872..d44d847 100644 --- a/src/Engine/Graphics/Vulkan/VulkanGraphics.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanGraphics.cpp @@ -10,12 +10,15 @@ #include "VulkanDescriptorSets.h" #include "VulkanShader.h" #include "Graphics/GraphicsResources.h" -#include +#include using namespace Seele::Vulkan; Graphics::Graphics() - : callback(VK_NULL_HANDLE), handle(VK_NULL_HANDLE), instance(VK_NULL_HANDLE), physicalDevice(VK_NULL_HANDLE) + : instance(VK_NULL_HANDLE) + , handle(VK_NULL_HANDLE) + , physicalDevice(VK_NULL_HANDLE) + , callback(VK_NULL_HANDLE) { } @@ -161,7 +164,7 @@ Gfx::PGraphicsPipeline Graphics::createGraphicsPipeline(const GraphicsPipelineCr return pipeline; } -Gfx::PSamplerState Graphics::createSamplerState(const SamplerCreateInfo& createInfo) +Gfx::PSamplerState Graphics::createSamplerState(const SamplerCreateInfo&) { PSamplerState sampler = new SamplerState(); // TODO: proper sampler creation VkSamplerCreateInfo vkInfo = diff --git a/src/Engine/Graphics/Vulkan/VulkanGraphics.h b/src/Engine/Graphics/Vulkan/VulkanGraphics.h index dd027fa..f743e80 100644 --- a/src/Engine/Graphics/Vulkan/VulkanGraphics.h +++ b/src/Engine/Graphics/Vulkan/VulkanGraphics.h @@ -6,13 +6,13 @@ namespace Seele { namespace Vulkan { -DECLARE_REF(Allocator); -DECLARE_REF(StagingManager); -DECLARE_REF(CommandBufferManager); -DECLARE_REF(Queue); -DECLARE_REF(Framebuffer); -DECLARE_REF(RenderCommand); -DECLARE_REF(PipelineCache); +DECLARE_REF(Allocator) +DECLARE_REF(StagingManager) +DECLARE_REF(CommandBufferManager) +DECLARE_REF(Queue) +DECLARE_REF(Framebuffer) +DECLARE_REF(RenderCommand) +DECLARE_REF(PipelineCache) class Graphics : public Gfx::Graphics { public: @@ -72,9 +72,9 @@ protected: void pickPhysicalDevice(); void createDevice(GraphicsInitializer initInfo); + VkInstance instance; VkDevice handle; VkPhysicalDevice physicalDevice; - VkInstance instance; PQueue graphicsQueue; PQueue computeQueue; @@ -96,6 +96,6 @@ protected: friend class Window; }; -DEFINE_REF(Graphics); +DEFINE_REF(Graphics) } // namespace Vulkan } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/VulkanGraphicsResources.cpp b/src/Engine/Graphics/Vulkan/VulkanGraphicsResources.cpp index 57e69d8..942adab 100644 --- a/src/Engine/Graphics/Vulkan/VulkanGraphicsResources.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanGraphicsResources.cpp @@ -72,7 +72,8 @@ Semaphore::~Semaphore() } Fence::Fence(PGraphics graphics) - : graphics(graphics), signaled(false) + : graphics(graphics) + , signaled(false) { VkFenceCreateInfo info = init::FenceCreateInfo(0); diff --git a/src/Engine/Graphics/Vulkan/VulkanGraphicsResources.h b/src/Engine/Graphics/Vulkan/VulkanGraphicsResources.h index ee6b5f3..076090c 100644 --- a/src/Engine/Graphics/Vulkan/VulkanGraphicsResources.h +++ b/src/Engine/Graphics/Vulkan/VulkanGraphicsResources.h @@ -8,11 +8,11 @@ namespace Seele namespace Vulkan { -DECLARE_REF(DescriptorAllocator); -DECLARE_REF(CommandBufferManager); -DECLARE_REF(CmdBuffer); -DECLARE_REF(Graphics); -DECLARE_REF(SubAllocation); +DECLARE_REF(DescriptorAllocator) +DECLARE_REF(CommandBufferManager) +DECLARE_REF(CmdBuffer) +DECLARE_REF(Graphics) +DECLARE_REF(SubAllocation) class Semaphore { public: @@ -27,7 +27,7 @@ private: VkSemaphore handle; PGraphics graphics; }; -DEFINE_REF(Semaphore); +DEFINE_REF(Semaphore) class Fence { @@ -47,11 +47,11 @@ public: } private: + PGraphics graphics; bool signaled; VkFence fence; - PGraphics graphics; }; -DEFINE_REF(Fence); +DEFINE_REF(Fence) class VertexDeclaration : public Gfx::VertexDeclaration { @@ -62,7 +62,7 @@ public: virtual ~VertexDeclaration(); private: }; -DEFINE_REF(VertexDeclaration); +DEFINE_REF(VertexDeclaration) class QueueOwnedResourceDeletion { @@ -112,12 +112,12 @@ protected: VkBuffer buffer; PSubAllocation allocation; }; - BufferAllocation buffers[Gfx::numFramesBuffered]; - uint32 numBuffers; + PGraphics graphics; uint32 currentBuffer; uint32 size; - PGraphics graphics; Gfx::QueueType currentOwner; + BufferAllocation buffers[Gfx::numFramesBuffered]; + uint32 numBuffers; void executeOwnershipBarrier(Gfx::QueueType newOwner); virtual void requestOwnershipTransfer(Gfx::QueueType newOwner) = 0; @@ -125,9 +125,9 @@ protected: virtual VkAccessFlags getSourceAccessMask() = 0; virtual VkAccessFlags getDestAccessMask() = 0; }; -DEFINE_REF(ShaderBuffer); +DEFINE_REF(ShaderBuffer) -DECLARE_REF(StagingBuffer); +DECLARE_REF(StagingBuffer) class UniformBuffer : public Gfx::UniformBuffer, public ShaderBuffer { public: @@ -147,7 +147,7 @@ protected: private: PStagingBuffer dedicatedStagingBuffer; }; -DEFINE_REF(UniformBuffer); +DEFINE_REF(UniformBuffer) class StructuredBuffer : public Gfx::StructuredBuffer, public ShaderBuffer { @@ -163,7 +163,7 @@ protected: // Inherited via QueueOwnedResource virtual void executeOwnershipBarrier(Gfx::QueueType newOwner); }; -DEFINE_REF(StructuredBuffer); +DEFINE_REF(StructuredBuffer) class VertexBuffer : public Gfx::VertexBuffer, public ShaderBuffer { @@ -179,7 +179,7 @@ protected: // Inherited via QueueOwnedResource virtual void executeOwnershipBarrier(Gfx::QueueType newOwner); }; -DEFINE_REF(VertexBuffer); +DEFINE_REF(VertexBuffer) class IndexBuffer : public Gfx::IndexBuffer, public ShaderBuffer { @@ -195,7 +195,7 @@ protected: // Inherited via QueueOwnedResource virtual void executeOwnershipBarrier(Gfx::QueueType newOwner); }; -DEFINE_REF(IndexBuffer); +DEFINE_REF(IndexBuffer) class TextureHandle { @@ -303,14 +303,14 @@ protected: virtual void executeOwnershipBarrier(Gfx::QueueType newOwner); }; -DEFINE_REF(Texture2D); +DEFINE_REF(Texture2D) class SamplerState : public Gfx::SamplerState { public: VkSampler sampler; }; -DEFINE_REF(SamplerState); +DEFINE_REF(SamplerState) class Window : public Gfx::Window { @@ -347,10 +347,11 @@ protected: PSemaphore imageAcquiredSemaphore; PGraphics graphics; - VkFormat pixelFormat; - VkSampleCountFlags numSamples; - VkPresentModeKHR presentMode; + VkInstance instance; VkSwapchainKHR swapchain; + VkSampleCountFlags numSamples; + VkFormat pixelFormat; + VkPresentModeKHR presentMode; VkSurfaceKHR surface; VkSurfaceFormatKHR surfaceFormat; void *windowHandle; @@ -358,9 +359,8 @@ protected: int32 acquiredImageIndex; int32 preAcquiredImageIndex; int32 semaphoreIndex; - VkInstance instance; }; -DEFINE_REF(Window); +DEFINE_REF(Window) class Viewport : public Gfx::Viewport { @@ -375,6 +375,6 @@ private: PGraphics graphics; friend class Graphics; }; -DECLARE_REF(Viewport); +DECLARE_REF(Viewport) } // namespace Vulkan } // namespace Seele diff --git a/src/Engine/Graphics/Vulkan/VulkanPipeline.h b/src/Engine/Graphics/Vulkan/VulkanPipeline.h index fcfad08..fc43d52 100644 --- a/src/Engine/Graphics/Vulkan/VulkanPipeline.h +++ b/src/Engine/Graphics/Vulkan/VulkanPipeline.h @@ -5,8 +5,8 @@ namespace Seele { namespace Vulkan { -DECLARE_REF(PipelineLayout); -DECLARE_REF(Graphics); +DECLARE_REF(PipelineLayout) +DECLARE_REF(Graphics) class GraphicsPipeline : public Gfx::GraphicsPipeline { public: @@ -15,9 +15,9 @@ public: void bind(VkCommandBuffer handle); VkPipelineLayout getLayout() const; private: - VkPipeline pipeline; PGraphics graphics; + VkPipeline pipeline; }; -DEFINE_REF(GraphicsPipeline); +DEFINE_REF(GraphicsPipeline) } // namespace Vulkan } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/VulkanPipelineCache.h b/src/Engine/Graphics/Vulkan/VulkanPipelineCache.h index 02724d3..e5a3105 100644 --- a/src/Engine/Graphics/Vulkan/VulkanPipelineCache.h +++ b/src/Engine/Graphics/Vulkan/VulkanPipelineCache.h @@ -17,6 +17,6 @@ private: std::string cacheFile; Map createdPipelines; }; -DEFINE_REF(PipelineCache); +DEFINE_REF(PipelineCache) } // namespace Vulkan } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/VulkanQueue.cpp b/src/Engine/Graphics/Vulkan/VulkanQueue.cpp index 7c0878d..fa7a7eb 100644 --- a/src/Engine/Graphics/Vulkan/VulkanQueue.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanQueue.cpp @@ -9,7 +9,9 @@ using namespace Seele; using namespace Seele::Vulkan; Queue::Queue(PGraphics graphics, Gfx::QueueType queueType, uint32 familyIndex, uint32 queueIndex) - : familyIndex(familyIndex), graphics(graphics), queueType(queueType) + : graphics(graphics) + , familyIndex(familyIndex) + , queueType(queueType) { vkGetDeviceQueue(graphics->getDevice(), familyIndex, queueIndex, &queue); } diff --git a/src/Engine/Graphics/Vulkan/VulkanQueue.h b/src/Engine/Graphics/Vulkan/VulkanQueue.h index 0ddc7d3..a2f3049 100644 --- a/src/Engine/Graphics/Vulkan/VulkanQueue.h +++ b/src/Engine/Graphics/Vulkan/VulkanQueue.h @@ -5,8 +5,8 @@ namespace Seele { namespace Vulkan { -DECLARE_REF(CmdBuffer); -DECLARE_REF(Graphics); +DECLARE_REF(CmdBuffer) +DECLARE_REF(Graphics) class Queue { public: diff --git a/src/Engine/Graphics/Vulkan/VulkanRenderPass.h b/src/Engine/Graphics/Vulkan/VulkanRenderPass.h index 47bd40e..f53af94 100644 --- a/src/Engine/Graphics/Vulkan/VulkanRenderPass.h +++ b/src/Engine/Graphics/Vulkan/VulkanRenderPass.h @@ -38,6 +38,6 @@ private: VkRect2D renderArea; VkSubpassContents subpassContents; }; -DEFINE_REF(RenderPass); +DEFINE_REF(RenderPass) } // namespace Vulkan } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/VulkanShader.cpp b/src/Engine/Graphics/Vulkan/VulkanShader.cpp index ec64d01..12f8f9e 100644 --- a/src/Engine/Graphics/Vulkan/VulkanShader.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanShader.cpp @@ -2,8 +2,7 @@ #include "VulkanGraphics.h" #include "VulkanDescriptorSets.h" #include "slang.h" -#include "spirv_cross/spirv_reflect.hpp" -#include +//#include "spirv_cross/spirv_reflect.hpp" using namespace slang; using namespace Seele; diff --git a/src/Engine/Graphics/Vulkan/VulkanShader.h b/src/Engine/Graphics/Vulkan/VulkanShader.h index 008c733..1d9012c 100644 --- a/src/Engine/Graphics/Vulkan/VulkanShader.h +++ b/src/Engine/Graphics/Vulkan/VulkanShader.h @@ -6,8 +6,8 @@ namespace Seele { namespace Vulkan { -DECLARE_REF(Graphics); -DECLARE_REF(DescriptorLayout); +DECLARE_REF(Graphics) +DECLARE_REF(DescriptorLayout) class Shader { public: @@ -31,12 +31,12 @@ private: PGraphics graphics; Map descriptorSets; VkShaderModule module; - VkShaderStageFlags stage; ShaderType type; + VkShaderStageFlags stage; std::string entryPointName; uint32 hash; }; -DEFINE_REF(Shader); +DEFINE_REF(Shader) template class ShaderBase : public Base, public Shader @@ -57,12 +57,12 @@ typedef ShaderBase FragmentShader; typedef ShaderBase ComputeShader; -DEFINE_REF(VertexShader); -DEFINE_REF(ControlShader); -DEFINE_REF(EvaluationShader); -DEFINE_REF(GeometryShader); -DEFINE_REF(FragmentShader); -DEFINE_REF(ComputeShader); +DEFINE_REF(VertexShader) +DEFINE_REF(ControlShader) +DEFINE_REF(EvaluationShader) +DEFINE_REF(GeometryShader) +DEFINE_REF(FragmentShader) +DEFINE_REF(ComputeShader) } // namespace Vulkan } \ No newline at end of file diff --git a/src/Engine/Graphics/Vulkan/VulkanTexture.cpp b/src/Engine/Graphics/Vulkan/VulkanTexture.cpp index b6dcc19..dd437b8 100644 --- a/src/Engine/Graphics/Vulkan/VulkanTexture.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanTexture.cpp @@ -36,13 +36,13 @@ TextureHandle::TextureHandle(PGraphics graphics, VkImageViewType viewType, , sizeX(createInfo.width) , sizeY(createInfo.height) , sizeZ(createInfo.depth) - , mipLevels(createInfo.mipLevels) - , format(createInfo.format) - , samples(createInfo.samples) - , usage(createInfo.usage) , arrayCount(createInfo.bArray ? createInfo.arrayLayers : 1) - , aspect(getAspectFromFormat(createInfo.format)) + , mipLevels(createInfo.mipLevels) + , samples(createInfo.samples) + , format(createInfo.format) + , usage(createInfo.usage) , image(existingImage) + , aspect(getAspectFromFormat(createInfo.format)) , layout(VK_IMAGE_LAYOUT_UNDEFINED) { if (existingImage == VK_NULL_HANDLE) diff --git a/src/Engine/Graphics/Vulkan/VulkanViewport.cpp b/src/Engine/Graphics/Vulkan/VulkanViewport.cpp index e20457e..cea261e 100644 --- a/src/Engine/Graphics/Vulkan/VulkanViewport.cpp +++ b/src/Engine/Graphics/Vulkan/VulkanViewport.cpp @@ -3,12 +3,12 @@ #include "VulkanInitializer.h" #include "VulkanGraphicsEnums.h" #include "VulkanCommandBuffer.h" -#include +#include using namespace Seele; using namespace Seele::Vulkan; -void glfwKeyCallback(GLFWwindow* handle, int key, int scancode, int action, int modifier) +void glfwKeyCallback(GLFWwindow* handle, int key, int action, int, int modifier) { Window* window = (Window*)glfwGetWindowUserPointer(handle); window->keyCallback((KeyCode)key, (InputAction)action, (KeyModifier)modifier); @@ -39,7 +39,12 @@ void glfwFileCallback(GLFWwindow* handle, int count, const char** paths) } Window::Window(PGraphics graphics, const WindowCreateInfo &createInfo) - : Gfx::Window(createInfo), graphics(graphics), instance(graphics->getInstance()), swapchain(VK_NULL_HANDLE), numSamples(createInfo.numSamples), pixelFormat(cast(createInfo.pixelFormat)) + : Gfx::Window(createInfo) + , graphics(graphics) + , instance(graphics->getInstance()) + , swapchain(VK_NULL_HANDLE) + , numSamples(createInfo.numSamples) + , pixelFormat(cast(createInfo.pixelFormat)) { glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); GLFWwindow *handle = glfwCreateWindow(createInfo.width, createInfo.height, createInfo.title, createInfo.bFullscreen ? glfwGetPrimaryMonitor() : nullptr, nullptr); @@ -207,6 +212,7 @@ void Window::present() { presentResult = vkQueuePresentKHR(graphics->getGraphicsCommands()->getQueue()->getHandle(), &info); } + Gfx::currentFrameIndex = (Gfx::currentFrameIndex + 1)%Gfx::numFramesBuffered; } void Window::createSwapchain() diff --git a/src/Engine/Material/BRDF.cpp b/src/Engine/Material/BRDF.cpp index 72bcf12..b5c8426 100644 --- a/src/Engine/Material/BRDF.cpp +++ b/src/Engine/Material/BRDF.cpp @@ -129,4 +129,4 @@ void BlinnPhong::generateMaterialCode(std::ofstream& codeStream, json codeJson) codeStream << "}" << std::endl; } -IMPLEMENT_BRDF(BlinnPhong); \ No newline at end of file +IMPLEMENT_BRDF(BlinnPhong) \ No newline at end of file diff --git a/src/Engine/Material/BRDF.h b/src/Engine/Material/BRDF.h index 174b9cf..806b51c 100644 --- a/src/Engine/Material/BRDF.h +++ b/src/Engine/Material/BRDF.h @@ -29,7 +29,7 @@ protected: class BlinnPhong : public BRDF { - DECLARE_BRDF(BlinnPhong); + DECLARE_BRDF(BlinnPhong) public: virtual void generateMaterialCode(std::ofstream& codeStream, nlohmann::json codeJson); protected: diff --git a/src/Engine/Material/Material.h b/src/Engine/Material/Material.h index 4bc164d..8142dd1 100644 --- a/src/Engine/Material/Material.h +++ b/src/Engine/Material/Material.h @@ -31,5 +31,5 @@ private: friend class MaterialLoader; friend class MaterialInstance; }; -DEFINE_REF(Material); +DEFINE_REF(Material) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Material/MaterialAsset.h b/src/Engine/Material/MaterialAsset.h index 173ce81..b1d5951 100644 --- a/src/Engine/Material/MaterialAsset.h +++ b/src/Engine/Material/MaterialAsset.h @@ -5,8 +5,8 @@ namespace Seele { -DECLARE_REF(VertexShaderInput); -DECLARE_REF(Material); +DECLARE_REF(VertexShaderInput) +DECLARE_REF(Material) class MaterialAsset : public Asset { public: @@ -34,5 +34,5 @@ protected: uint8* uniformData; int32 uniformBinding; }; -DEFINE_REF(MaterialAsset); +DEFINE_REF(MaterialAsset) } // namespace Seele diff --git a/src/Engine/Material/MaterialInstance.h b/src/Engine/Material/MaterialInstance.h index 4aa983f..c7320fb 100644 --- a/src/Engine/Material/MaterialInstance.h +++ b/src/Engine/Material/MaterialInstance.h @@ -3,8 +3,8 @@ namespace Seele { -DECLARE_NAME_REF(Gfx, DescriptorSet); -DECLARE_REF(Material); +DECLARE_NAME_REF(Gfx, DescriptorSet) +DECLARE_REF(Material) class MaterialInstance : public MaterialAsset { public: @@ -18,5 +18,5 @@ public: private: Material* baseMaterial; }; -DEFINE_REF(MaterialInstance); +DEFINE_REF(MaterialInstance) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Material/ShaderExpression.cpp b/src/Engine/Material/ShaderExpression.cpp index 56d4db5..d99cdae 100644 --- a/src/Engine/Material/ShaderExpression.cpp +++ b/src/Engine/Material/ShaderExpression.cpp @@ -24,7 +24,7 @@ FloatParameter::~FloatParameter() { } -void FloatParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) +void FloatParameter::updateDescriptorSet(Gfx::PDescriptorSet, uint8* dst) { std::memcpy(dst + byteOffset, &data, sizeof(float)); } @@ -38,7 +38,7 @@ VectorParameter::~VectorParameter() { } -void VectorParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) +void VectorParameter::updateDescriptorSet(Gfx::PDescriptorSet, uint8* dst) { std::memcpy(dst + byteOffset, &data, sizeof(Vector)); } @@ -52,7 +52,7 @@ TextureParameter::~TextureParameter() { } -void TextureParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) +void TextureParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8*) { descriptorSet->updateTexture(binding, data->getTexture()); } @@ -67,7 +67,7 @@ SamplerParameter::~SamplerParameter() } -void SamplerParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) +void SamplerParameter::updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8*) { descriptorSet->updateSampler(binding, data); } \ No newline at end of file diff --git a/src/Engine/Material/ShaderExpression.h b/src/Engine/Material/ShaderExpression.h index b292eb7..eb6446e 100644 --- a/src/Engine/Material/ShaderExpression.h +++ b/src/Engine/Material/ShaderExpression.h @@ -14,7 +14,7 @@ struct ExpressionOutput struct ShaderExpression { }; -DECLARE_NAME_REF(Gfx, DescriptorSet); +DECLARE_NAME_REF(Gfx, DescriptorSet) struct ShaderParameter : public ShaderExpression { std::string name; @@ -25,7 +25,7 @@ struct ShaderParameter : public ShaderExpression // update a descriptorset, in case of a uniform buffer, copy the data to the dst + byteOffset virtual void updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) = 0; }; -DEFINE_REF(ShaderParameter); +DEFINE_REF(ShaderParameter) struct FloatParameter : public ShaderParameter { float data; @@ -33,7 +33,7 @@ struct FloatParameter : public ShaderParameter virtual ~FloatParameter(); virtual void updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) override; }; -DEFINE_REF(FloatParameter); +DEFINE_REF(FloatParameter) struct VectorParameter : public ShaderParameter { Vector data; @@ -41,8 +41,8 @@ struct VectorParameter : public ShaderParameter virtual ~VectorParameter(); virtual void updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) override; }; -DEFINE_REF(VectorParameter); -DECLARE_REF(TextureAsset); +DEFINE_REF(VectorParameter) +DECLARE_REF(TextureAsset) struct TextureParameter : public ShaderParameter { PTextureAsset data; @@ -50,8 +50,8 @@ struct TextureParameter : public ShaderParameter virtual ~TextureParameter(); virtual void updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) override; }; -DEFINE_REF(TextureParameter); -DECLARE_NAME_REF(Gfx, SamplerState); +DEFINE_REF(TextureParameter) +DECLARE_NAME_REF(Gfx, SamplerState) struct SamplerParameter : public ShaderParameter { Gfx::PSamplerState data; @@ -59,6 +59,6 @@ struct SamplerParameter : public ShaderParameter virtual ~SamplerParameter(); virtual void updateDescriptorSet(Gfx::PDescriptorSet descriptorSet, uint8* dst) override; }; -DEFINE_REF(SamplerParameter); +DEFINE_REF(SamplerParameter) } // namespace Seele diff --git a/src/Engine/Math/Vector.h b/src/Engine/Math/Vector.h index 81c8142..499e4da 100644 --- a/src/Engine/Math/Vector.h +++ b/src/Engine/Math/Vector.h @@ -3,9 +3,7 @@ #include #include -#pragma warning(disable : 4201) #include -#pragma warning(default : 4201) namespace Seele { typedef glm::vec2 Vector2; diff --git a/src/Engine/MinimalEngine.h b/src/Engine/MinimalEngine.h index 60faa45..ba8e739 100644 --- a/src/Engine/MinimalEngine.h +++ b/src/Engine/MinimalEngine.h @@ -52,10 +52,7 @@ public: std::scoped_lock lock(registeredObjectsLock); registeredObjects.erase(handle); } -// we cant always have the definition of every class -#pragma warning(disable : 4150) delete handle; -#pragma warning(default : 4150) } RefObject &operator=(const RefObject &rhs) { @@ -105,7 +102,6 @@ public: { return handle; } - private: T *handle; std::atomic_uint64_t refCount; @@ -161,7 +157,7 @@ public: RefPtr(const RefPtr &other) { F *f = other.getObject()->getHandle(); - T* t = static_cast(f); + assert(static_cast(f)); object = (RefObject *)other.getObject(); object->addRef(); } @@ -267,7 +263,7 @@ private: RefObject *object; friend class boost::serialization::access; template - void serialize(Archive& ar, const unsigned int version) + void serialize(Archive& ar, const unsigned int) { ar & *object->getHandle(); } diff --git a/src/Engine/Scene/Actor/Actor.h b/src/Engine/Scene/Actor/Actor.h index 76d6079..5080b8a 100644 --- a/src/Engine/Scene/Actor/Actor.h +++ b/src/Engine/Scene/Actor/Actor.h @@ -4,9 +4,9 @@ namespace Seele { -DECLARE_REF(Actor); -DECLARE_REF(Component); -DECLARE_REF(Scene); +DECLARE_REF(Actor) +DECLARE_REF(Component) +DECLARE_REF(Scene) class Actor { public: @@ -48,5 +48,5 @@ protected: Array children; PComponent rootComponent; }; -DEFINE_REF(Actor); +DEFINE_REF(Actor) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Scene/Actor/CameraActor.h b/src/Engine/Scene/Actor/CameraActor.h index 133d0ab..39a61e0 100644 --- a/src/Engine/Scene/Actor/CameraActor.h +++ b/src/Engine/Scene/Actor/CameraActor.h @@ -17,5 +17,5 @@ private: PCameraComponent cameraComponent; PComponent sceneComponent; // This will be the root, camera will be the child }; -DEFINE_REF(CameraActor); +DEFINE_REF(CameraActor) } // namespace Seele diff --git a/src/Engine/Scene/Components/CameraComponent.h b/src/Engine/Scene/Components/CameraComponent.h index 4d19282..e353528 100644 --- a/src/Engine/Scene/Components/CameraComponent.h +++ b/src/Engine/Scene/Components/CameraComponent.h @@ -56,5 +56,5 @@ private: Matrix4 viewMatrix; Matrix4 projectionMatrix; }; -DEFINE_REF(CameraComponent); +DEFINE_REF(CameraComponent) } // namespace Seele diff --git a/src/Engine/Scene/Components/Component.h b/src/Engine/Scene/Components/Component.h index f4b41db..b1062ad 100644 --- a/src/Engine/Scene/Components/Component.h +++ b/src/Engine/Scene/Components/Component.h @@ -4,9 +4,9 @@ namespace Seele { -DECLARE_REF(Actor); -DECLARE_REF(Scene); -DECLARE_REF(Component); +DECLARE_REF(Actor) +DECLARE_REF(Scene) +DECLARE_REF(Component) class Component { public: diff --git a/src/Engine/Scene/Components/PrimitiveComponent.h b/src/Engine/Scene/Components/PrimitiveComponent.h index 05c8cba..3f05ce2 100644 --- a/src/Engine/Scene/Components/PrimitiveComponent.h +++ b/src/Engine/Scene/Components/PrimitiveComponent.h @@ -7,7 +7,7 @@ namespace Seele { -DECLARE_REF(MeshAsset); +DECLARE_REF(MeshAsset) class PrimitiveComponent : public Component { public: @@ -23,5 +23,5 @@ private: Gfx::PUniformBuffer uniformBuffer; friend class Scene; }; -DEFINE_REF(PrimitiveComponent); +DEFINE_REF(PrimitiveComponent) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Scene/Scene.h b/src/Engine/Scene/Scene.h index 97b566a..7e35be7 100644 --- a/src/Engine/Scene/Scene.h +++ b/src/Engine/Scene/Scene.h @@ -8,7 +8,7 @@ namespace Seele { -DECLARE_REF(Material); +DECLARE_REF(Material) struct DirectionalLight { diff --git a/src/Engine/Window/RenderPath.h b/src/Engine/Window/RenderPath.h index 1fd0ad8..cb039a5 100644 --- a/src/Engine/Window/RenderPath.h +++ b/src/Engine/Window/RenderPath.h @@ -18,5 +18,5 @@ protected: Gfx::PGraphics graphics; Gfx::PViewport target; }; -DEFINE_REF(RenderPath); +DEFINE_REF(RenderPath) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Window/SceneRenderPath.h b/src/Engine/Window/SceneRenderPath.h index 6cc880f..82eb549 100644 --- a/src/Engine/Window/SceneRenderPath.h +++ b/src/Engine/Window/SceneRenderPath.h @@ -4,8 +4,8 @@ namespace Seele { -DECLARE_REF(Scene); -DECLARE_REF(CameraActor); +DECLARE_REF(Scene) +DECLARE_REF(CameraActor) class SceneRenderPath : public RenderPath { public: diff --git a/src/Engine/Window/SceneView.cpp b/src/Engine/Window/SceneView.cpp index b5c5095..defabd1 100644 --- a/src/Engine/Window/SceneView.cpp +++ b/src/Engine/Window/SceneView.cpp @@ -26,7 +26,7 @@ void SceneView::beginFrame() scene->tick(0);//TODO: update in separate thread } -void SceneView::keyCallback(KeyCode code, InputAction action, KeyModifier modifier) +void SceneView::keyCallback(KeyCode code, InputAction action, KeyModifier) { if(action != InputAction::RELEASE) { @@ -56,7 +56,7 @@ void SceneView::mouseMoveCallback(double xPos, double yPos) } } -void SceneView::mouseButtonCallback(MouseButton button, InputAction action, KeyModifier modifier) +void SceneView::mouseButtonCallback(MouseButton button, InputAction action, KeyModifier) { if(button == MouseButton::MOUSE_BUTTON_1 && action != InputAction::RELEASE) { @@ -68,12 +68,12 @@ void SceneView::mouseButtonCallback(MouseButton button, InputAction action, KeyM } } -void SceneView::scrollCallback(double xOffset, double yOffset) +void SceneView::scrollCallback(double, double yOffset) { activeCamera->getCameraComponent()->mouseScroll(yOffset); } -void SceneView::fileCallback(int count, const char** paths) +void SceneView::fileCallback(int, const char**) { } diff --git a/src/Engine/Window/SceneView.h b/src/Engine/Window/SceneView.h index 886d070..4797ed9 100644 --- a/src/Engine/Window/SceneView.h +++ b/src/Engine/Window/SceneView.h @@ -2,8 +2,8 @@ #include "View.h" namespace Seele { -DECLARE_REF(Scene); -DECLARE_REF(CameraActor); +DECLARE_REF(Scene) +DECLARE_REF(CameraActor) class SceneView : public View { public: @@ -20,5 +20,5 @@ private: virtual void scrollCallback(double xOffset, double yOffset) override; virtual void fileCallback(int count, const char** paths) override; }; -DEFINE_REF(SceneView); +DEFINE_REF(SceneView) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Window/View.h b/src/Engine/Window/View.h index 6d3649a..d0570a0 100644 --- a/src/Engine/Window/View.h +++ b/src/Engine/Window/View.h @@ -2,7 +2,7 @@ #include "RenderPath.h" namespace Seele { -DECLARE_REF(Window); +DECLARE_REF(Window) // A view is a part of the window, which can be anything from a viewport to an editor class View { diff --git a/src/Engine/Window/Window.h b/src/Engine/Window/Window.h index 92410bd..937711f 100644 --- a/src/Engine/Window/Window.h +++ b/src/Engine/Window/Window.h @@ -22,5 +22,5 @@ private: PView focusedView; Gfx::PWindow gfxHandle; }; -DEFINE_REF(Window); +DEFINE_REF(Window) } // namespace Seele \ No newline at end of file diff --git a/src/Engine/Window/WindowManager.h b/src/Engine/Window/WindowManager.h index 0ae33e8..be38313 100644 --- a/src/Engine/Window/WindowManager.h +++ b/src/Engine/Window/WindowManager.h @@ -28,5 +28,5 @@ private: Array windows; static Gfx::PGraphics graphics; }; -DEFINE_REF(WindowManager); +DEFINE_REF(WindowManager) } // namespace Seele \ No newline at end of file diff --git a/test/Engine/CMakeLists.txt b/test/Engine/CMakeLists.txt index 36ee31c..b1acf4b 100644 --- a/test/Engine/CMakeLists.txt +++ b/test/Engine/CMakeLists.txt @@ -5,6 +5,6 @@ target_sources(Seele_unit_tests EngineTest.cpp) target_include_directories(Seele_unit_tests PUBLIC ./) add_subdirectory(Containers/) -add_subdirectory(Fibers/) +#add_subdirectory(Fibers/) add_subdirectory(Graphics/) add_subdirectory(Math/) \ No newline at end of file diff --git a/test/Engine/EngineTest.h b/test/Engine/EngineTest.h index a3d7ec7..ccf4582 100644 --- a/test/Engine/EngineTest.h +++ b/test/Engine/EngineTest.h @@ -13,11 +13,11 @@ namespace Seele } void setup() { - Fibers::JobQueue::initJobQueues(); + //Fibers::JobQueue::initJobQueues(); } void teardown() { - Fibers::JobQueue::cleanupJobQueues(); + //Fibers::JobQueue::cleanupJobQueues(); } }; }; \ No newline at end of file