├── LICENSE.txt ├── Projects ├── .editorconfig ├── .gitattributes ├── .gitignore ├── Common │ ├── DirectXTex.vcxproj │ ├── DirectXTex.vcxproj.filters │ ├── DirectXTex │ │ ├── LICENSE.txt │ │ └── src │ │ │ └── directxtex │ │ │ ├── DDSTextureLoader.cpp │ │ │ ├── DDSTextureLoader.h │ │ │ ├── ScreenGrab.cpp │ │ │ ├── ScreenGrab.h │ │ │ ├── WICTextureLoader.cpp │ │ │ └── WICTextureLoader.h │ ├── GSL │ │ ├── LICENSE.txt │ │ └── src │ │ │ └── gsl │ │ │ ├── gsl │ │ │ ├── gsl_algorithm │ │ │ ├── gsl_assert │ │ │ ├── gsl_byte │ │ │ ├── gsl_util │ │ │ ├── multi_span │ │ │ ├── pointers │ │ │ ├── span │ │ │ └── string_span │ ├── ImGui.vcxproj │ ├── ImGui.vcxproj.filters │ ├── ImGui │ │ ├── LICENSE.txt │ │ ├── modifications.md │ │ └── src │ │ │ ├── imconfig.h │ │ │ ├── imgui.cpp │ │ │ ├── imgui.h │ │ │ ├── imgui_demo.cpp │ │ │ ├── imgui_draw.cpp │ │ │ ├── imgui_impl_dx11.cpp │ │ │ ├── imgui_impl_dx11.h │ │ │ ├── imgui_impl_win32.cpp │ │ │ ├── imgui_impl_win32.h │ │ │ ├── imgui_internal.h │ │ │ ├── imgui_widgets.cpp │ │ │ ├── imgui_window_message_listener.cpp │ │ │ ├── imgui_window_message_listener.hpp │ │ │ ├── imstb_rectpack.h │ │ │ ├── imstb_textedit.h │ │ │ └── imstb_truetype.h │ ├── MAGE.vcxproj │ ├── MAGE.vcxproj.filters │ ├── MAGE │ │ ├── LICENSE.txt │ │ └── src │ │ │ ├── collection │ │ │ ├── array.hpp │ │ │ ├── collection_utils.hpp │ │ │ ├── dynamic_array.hpp │ │ │ └── vector.hpp │ │ │ ├── directxmath │ │ │ └── facade.hpp │ │ │ ├── ecs │ │ │ └── ecs.hpp │ │ │ ├── exception │ │ │ ├── exception.cpp │ │ │ ├── exception.hpp │ │ │ └── exception.tpp │ │ │ ├── logging │ │ │ ├── dump.cpp │ │ │ ├── dump.hpp │ │ │ ├── logging.cpp │ │ │ ├── logging.hpp │ │ │ ├── logging.tpp │ │ │ ├── progress_reporter.cpp │ │ │ └── progress_reporter.hpp │ │ │ ├── memory │ │ │ ├── allocation.hpp │ │ │ ├── memory.hpp │ │ │ ├── memory.tpp │ │ │ ├── memory_arena.cpp │ │ │ ├── memory_arena.hpp │ │ │ ├── memory_arena.tpp │ │ │ ├── memory_buffer.hpp │ │ │ ├── memory_stack.cpp │ │ │ ├── memory_stack.hpp │ │ │ └── memory_stack.tpp │ │ │ ├── parallel │ │ │ ├── id_generator.cpp │ │ │ ├── id_generator.hpp │ │ │ ├── parallel.cpp │ │ │ └── parallel.hpp │ │ │ ├── platform │ │ │ ├── windows.hpp │ │ │ ├── windows_utils.hpp │ │ │ └── windows_utils.tpp │ │ │ ├── string │ │ │ ├── format.hpp │ │ │ ├── format.tpp │ │ │ ├── formats.hpp │ │ │ ├── string.hpp │ │ │ ├── string_utils.cpp │ │ │ ├── string_utils.hpp │ │ │ └── string_utils.tpp │ │ │ ├── system │ │ │ ├── cpu_monitor.hpp │ │ │ ├── game_timer.hpp │ │ │ ├── system_time.cpp │ │ │ ├── system_time.hpp │ │ │ ├── system_usage.cpp │ │ │ ├── system_usage.hpp │ │ │ ├── timer.hpp │ │ │ └── timer.tpp │ │ │ ├── type │ │ │ ├── atomic_types.hpp │ │ │ ├── scalar_types.hpp │ │ │ ├── types.hpp │ │ │ └── vector_types.hpp │ │ │ └── ui │ │ │ ├── window.cpp │ │ │ └── window.hpp │ ├── Properties │ │ ├── x64_Debug.props │ │ ├── x64_Release.props │ │ ├── x86_Debug.props │ │ └── x86_Release.props │ ├── fmt.vcxproj │ ├── fmt.vcxproj.filters │ └── fmt │ │ ├── LICENSE.txt │ │ └── src │ │ └── fmt │ │ ├── color.h │ │ ├── core.h │ │ ├── format-inl.h │ │ ├── format.cpp │ │ ├── format.h │ │ ├── ostream.h │ │ ├── posix.cpp │ │ ├── posix.h │ │ ├── printf.h │ │ ├── ranges.h │ │ └── time.h ├── Project1 │ ├── Demo.sln │ ├── Demo.vcxproj │ ├── Demo.vcxproj.filters │ └── Demo │ │ └── src │ │ └── demo.cpp ├── Project2 │ ├── Demo.sln │ ├── Demo.vcxproj │ ├── Demo.vcxproj.filters │ └── Demo │ │ └── src │ │ └── demo.cpp ├── Project3 │ ├── Demo.sln │ ├── Demo.vcxproj │ ├── Demo.vcxproj.filters │ └── Demo │ │ ├── shaders │ │ ├── PS.hlsl │ │ └── VS.hlsl │ │ └── src │ │ └── demo.cpp ├── Project4 │ ├── Demo.sln │ ├── Demo.vcxproj │ ├── Demo.vcxproj.filters │ └── Demo │ │ ├── shaders │ │ ├── PS.hlsl │ │ └── VS.hlsl │ │ └── src │ │ └── demo.cpp ├── Project5 │ ├── Demo.sln │ ├── Demo.vcxproj │ ├── Demo.vcxproj.filters │ └── Demo │ │ ├── shaders │ │ ├── PS.hlsl │ │ └── VS.hlsl │ │ └── src │ │ └── demo.cpp ├── Project6 │ ├── Demo.sln │ ├── Demo.vcxproj │ ├── Demo.vcxproj.filters │ └── Demo │ │ ├── shaders │ │ ├── PS.hlsl │ │ ├── VS.hlsl │ │ ├── model.hlsli │ │ └── solid_PS.hlsl │ │ └── src │ │ └── demo.cpp ├── Project7 │ ├── Demo.sln │ ├── Demo.vcxproj │ ├── Demo.vcxproj.filters │ └── Demo │ │ ├── res │ │ └── seafloor.dds │ │ ├── shaders │ │ ├── PS.hlsl │ │ ├── VS.hlsl │ │ └── buffer.hlsli │ │ └── src │ │ └── demo.cpp ├── Project8 │ ├── Demo.sln │ ├── Demo.vcxproj │ ├── Demo.vcxproj.filters │ └── Demo │ │ └── src │ │ └── demo.cpp └── appveyor.yml ├── README.md └── res └── d3d11.png /Projects/.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | charset = utf-8 3 | indent_style = tab 4 | indent_size = 4 5 | -------------------------------------------------------------------------------- /Projects/.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Auto detect text files and perform LF normalization 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Explicitly declare CRLF normalization for the following files 8 | ############################################################################### 9 | 10 | # Header Files 11 | *.h text eol=crlf 12 | *.hpp text eol=crlf 13 | *.inc text eol=crlf 14 | *.inl text eol=crlf 15 | *.tpp text eol=crlf 16 | 17 | # Source Files 18 | *.c text eol=crlf 19 | *.cc text eol=crlf 20 | *.cpp text eol=crlf 21 | 22 | # Shader Files 23 | *.hlsl text eol=crlf 24 | *.hlsli text eol=crlf 25 | 26 | # Resource Files 27 | *.rc text eol=crlf 28 | 29 | # Visual Studio 30 | *.filters text eol=crlf 31 | *.props text eol=crlf 32 | *.sln text eol=crlf 33 | *.users text eol=crlf 34 | *.vcxproj text eol=crlf 35 | 36 | ############################################################################### 37 | # Explicitly declare programming languages for the following files 38 | ############################################################################### 39 | 40 | # Header Files 41 | 42 | Common/DirectXTex/**/*.h linguist-language=C++ 43 | Common/fmt/**/*.h linguist-language=C++ 44 | Common/GSL/**/*.h linguist-language=C++ 45 | Common/ImGui/**/*.h linguist-language=C++ 46 | 47 | *.hpp linguist-language=C++ 48 | *.inc linguist-language=C++ 49 | *.inl linguist-language=C++ 50 | *.tpp linguist-language=C++ 51 | 52 | # Source Files 53 | *.c linguist-language=C 54 | *.cc linguist-language=C++ 55 | *.cpp linguist-language=C++ 56 | 57 | # Shader Files 58 | *.hlsl linguist-language=HLSL 59 | *.hlsli linguist-language=HLSL 60 | 61 | ############################################################################### 62 | # Explicitly declare vendored for the following files 63 | ############################################################################### 64 | 65 | Common/DirectXTex/**/* linguist-vendored 66 | Common/fmt/**/* linguist-vendored 67 | Common/GSL/**/* linguist-vendored 68 | Common/ImGui/**/* linguist-vendored 69 | Common/MAGE/**/* linguist-vendored -------------------------------------------------------------------------------- /Projects/.gitignore: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # User-Specific Files 3 | ############################################################################### 4 | *.suo 5 | *.user 6 | 7 | ############################################################################### 8 | # Intermediate Results 9 | ############################################################################### 10 | [Tt]emp/ 11 | [Tt]mp/ 12 | 13 | ############################################################################### 14 | # Build Results 15 | ############################################################################### 16 | [Dd]ebug/ 17 | [Rr]elease/ 18 | x64/ 19 | x86/ 20 | [Bb]in/ 21 | [Oo]bj/ 22 | [Ll]og/ 23 | Shaders/src/*/ 24 | 25 | ############################################################################### 26 | # Visual Studio Cache/Options Directory 27 | ############################################################################### 28 | .vs/ 29 | 30 | ############################################################################### 31 | # Visual Studio Cache Files 32 | ############################################################################### 33 | # files ending in .cache can be ignored 34 | *.[Cc]ache 35 | # but keep track of directories ending in .cache 36 | !*.[Cc]ache/ 37 | 38 | ############################################################################### 39 | # Visual C++ Cache Files 40 | ############################################################################### 41 | ipch/ 42 | *.aps 43 | *.cachefile 44 | *.ncb 45 | *.opendb 46 | *.opensdf 47 | *.sdf 48 | *.VC.db 49 | *.VC.VC.opendb 50 | 51 | ############################################################################### 52 | # Visual Studio Profiler 53 | ############################################################################### 54 | *.diagsession 55 | *.psess 56 | *.sap 57 | *.vsp 58 | *.vspx 59 | 60 | ############################################################################### 61 | # Nsight 62 | ############################################################################### 63 | *.nvuser 64 | -------------------------------------------------------------------------------- /Projects/Common/DirectXTex.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | {54FB0635-3B8A-459A-9739-64D306953FE1} 24 | Win32Proj 25 | DirectXTex 26 | 10.0 27 | 28 | 29 | 30 | StaticLibrary 31 | true 32 | v142 33 | Unicode 34 | 35 | 36 | StaticLibrary 37 | false 38 | v142 39 | true 40 | Unicode 41 | 42 | 43 | StaticLibrary 44 | true 45 | v142 46 | Unicode 47 | 48 | 49 | StaticLibrary 50 | false 51 | v142 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /Projects/Common/DirectXTex.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;tpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {01b99cc8-93fb-4d45-b995-62278ad0d2e9} 14 | 15 | 16 | {0a160e43-2155-482c-8718-33dc4741033b} 17 | 18 | 19 | 20 | 21 | Header Files\directxtex 22 | 23 | 24 | Header Files\directxtex 25 | 26 | 27 | Header Files\directxtex 28 | 29 | 30 | 31 | 32 | Source Files\directxtex 33 | 34 | 35 | Source Files\directxtex 36 | 37 | 38 | Source Files\directxtex 39 | 40 | 41 | -------------------------------------------------------------------------------- /Projects/Common/DirectXTex/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Microsoft Corp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this 6 | software and associated documentation files (the "Software"), to deal in the Software 7 | without restriction, including without limitation the rights to use, copy, modify, 8 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies 13 | or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 17 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 18 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 19 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 20 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | -------------------------------------------------------------------------------- /Projects/Common/DirectXTex/src/directxtex/ScreenGrab.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: ScreenGrab.h 3 | // 4 | // Function for capturing a 2D texture and saving it to a file (aka a 'screenshot' 5 | // when used on a Direct3D 11 Render Target). 6 | // 7 | // Note these functions are useful as a light-weight runtime screen grabber. For 8 | // full-featured texture capture, DDS writer, and texture processing pipeline, 9 | // see the 'Texconv' sample and the 'DirectXTex' library. 10 | // 11 | // Copyright (c) Microsoft Corporation. All rights reserved. 12 | // Licensed under the MIT License. 13 | // 14 | // http://go.microsoft.com/fwlink/?LinkId=248926 15 | // http://go.microsoft.com/fwlink/?LinkId=248929 16 | //-------------------------------------------------------------------------------------- 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | 27 | namespace DirectX 28 | { 29 | HRESULT SaveDDSTextureToFile( _In_ ID3D11DeviceContext* pContext, 30 | _In_ ID3D11Resource* pSource, 31 | _In_z_ const wchar_t* fileName ); 32 | 33 | HRESULT SaveWICTextureToFile( _In_ ID3D11DeviceContext* pContext, 34 | _In_ ID3D11Resource* pSource, 35 | _In_ REFGUID guidContainerFormat, 36 | _In_z_ const wchar_t* fileName, 37 | _In_opt_ const GUID* targetFormat = nullptr, 38 | _In_opt_ std::function setCustomProps = nullptr ); 39 | } -------------------------------------------------------------------------------- /Projects/Common/DirectXTex/src/directxtex/WICTextureLoader.h: -------------------------------------------------------------------------------- 1 | //-------------------------------------------------------------------------------------- 2 | // File: WICTextureLoader.h 3 | // 4 | // Function for loading a WIC image and creating a Direct3D runtime texture for it 5 | // (auto-generating mipmaps if possible) 6 | // 7 | // Note: Assumes application has already called CoInitializeEx 8 | // 9 | // Warning: CreateWICTexture* functions are not thread-safe if given a d3dContext instance for 10 | // auto-gen mipmap support. 11 | // 12 | // Note these functions are useful for images created as simple 2D textures. For 13 | // more complex resources, DDSTextureLoader is an excellent light-weight runtime loader. 14 | // For a full-featured DDS file reader, writer, and texture processing pipeline see 15 | // the 'Texconv' sample and the 'DirectXTex' library. 16 | // 17 | // Copyright (c) Microsoft Corporation. All rights reserved. 18 | // Licensed under the MIT License. 19 | // 20 | // http://go.microsoft.com/fwlink/?LinkId=248926 21 | // http://go.microsoft.com/fwlink/?LinkId=248929 22 | //-------------------------------------------------------------------------------------- 23 | 24 | #pragma once 25 | 26 | #include 27 | #include 28 | 29 | 30 | namespace DirectX 31 | { 32 | enum WIC_LOADER_FLAGS 33 | { 34 | WIC_LOADER_DEFAULT = 0, 35 | WIC_LOADER_FORCE_SRGB = 0x1, 36 | WIC_LOADER_IGNORE_SRGB = 0x2, 37 | }; 38 | 39 | // Standard version 40 | HRESULT CreateWICTextureFromMemory( 41 | _In_ ID3D11Device* d3dDevice, 42 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 43 | _In_ size_t wicDataSize, 44 | _Outptr_opt_ ID3D11Resource** texture, 45 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 46 | _In_ size_t maxsize = 0); 47 | 48 | HRESULT CreateWICTextureFromFile( 49 | _In_ ID3D11Device* d3dDevice, 50 | _In_z_ const wchar_t* szFileName, 51 | _Outptr_opt_ ID3D11Resource** texture, 52 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 53 | _In_ size_t maxsize = 0); 54 | 55 | // Standard version with optional auto-gen mipmap support 56 | HRESULT CreateWICTextureFromMemory( 57 | _In_ ID3D11Device* d3dDevice, 58 | _In_opt_ ID3D11DeviceContext* d3dContext, 59 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 60 | _In_ size_t wicDataSize, 61 | _Outptr_opt_ ID3D11Resource** texture, 62 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 63 | _In_ size_t maxsize = 0); 64 | 65 | HRESULT CreateWICTextureFromFile( 66 | _In_ ID3D11Device* d3dDevice, 67 | _In_opt_ ID3D11DeviceContext* d3dContext, 68 | _In_z_ const wchar_t* szFileName, 69 | _Outptr_opt_ ID3D11Resource** texture, 70 | _Outptr_opt_ ID3D11ShaderResourceView** textureView, 71 | _In_ size_t maxsize = 0); 72 | 73 | // Extended version 74 | HRESULT CreateWICTextureFromMemoryEx( 75 | _In_ ID3D11Device* d3dDevice, 76 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 77 | _In_ size_t wicDataSize, 78 | _In_ size_t maxsize, 79 | _In_ D3D11_USAGE usage, 80 | _In_ unsigned int bindFlags, 81 | _In_ unsigned int cpuAccessFlags, 82 | _In_ unsigned int miscFlags, 83 | _In_ unsigned int loadFlags, 84 | _Outptr_opt_ ID3D11Resource** texture, 85 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 86 | 87 | HRESULT CreateWICTextureFromFileEx( 88 | _In_ ID3D11Device* d3dDevice, 89 | _In_z_ const wchar_t* szFileName, 90 | _In_ size_t maxsize, 91 | _In_ D3D11_USAGE usage, 92 | _In_ unsigned int bindFlags, 93 | _In_ unsigned int cpuAccessFlags, 94 | _In_ unsigned int miscFlags, 95 | _In_ unsigned int loadFlags, 96 | _Outptr_opt_ ID3D11Resource** texture, 97 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 98 | 99 | // Extended version with optional auto-gen mipmap support 100 | HRESULT CreateWICTextureFromMemoryEx( 101 | _In_ ID3D11Device* d3dDevice, 102 | _In_opt_ ID3D11DeviceContext* d3dContext, 103 | _In_reads_bytes_(wicDataSize) const uint8_t* wicData, 104 | _In_ size_t wicDataSize, 105 | _In_ size_t maxsize, 106 | _In_ D3D11_USAGE usage, 107 | _In_ unsigned int bindFlags, 108 | _In_ unsigned int cpuAccessFlags, 109 | _In_ unsigned int miscFlags, 110 | _In_ unsigned int loadFlags, 111 | _Outptr_opt_ ID3D11Resource** texture, 112 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 113 | 114 | HRESULT CreateWICTextureFromFileEx( 115 | _In_ ID3D11Device* d3dDevice, 116 | _In_opt_ ID3D11DeviceContext* d3dContext, 117 | _In_z_ const wchar_t* szFileName, 118 | _In_ size_t maxsize, 119 | _In_ D3D11_USAGE usage, 120 | _In_ unsigned int bindFlags, 121 | _In_ unsigned int cpuAccessFlags, 122 | _In_ unsigned int miscFlags, 123 | _In_ unsigned int loadFlags, 124 | _Outptr_opt_ ID3D11Resource** texture, 125 | _Outptr_opt_ ID3D11ShaderResourceView** textureView); 126 | } -------------------------------------------------------------------------------- /Projects/Common/GSL/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Microsoft Corporation. All rights reserved. 2 | 3 | This code is licensed under the MIT License (MIT). 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Projects/Common/GSL/src/gsl/gsl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2015 Microsoft Corporation. All rights reserved. 4 | // 5 | // This code is licensed under the MIT License (MIT). 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13 | // THE SOFTWARE. 14 | // 15 | /////////////////////////////////////////////////////////////////////////////// 16 | 17 | #ifndef GSL_GSL_H 18 | #define GSL_GSL_H 19 | 20 | #include // copy 21 | #include // Ensures/Expects 22 | #include // byte 23 | #include // finally()/narrow()/narrow_cast()... 24 | #include // multi_span, strided_span... 25 | #include // owner, not_null 26 | #include // span 27 | #include // zstring, string_span, zstring_builder... 28 | 29 | #endif // GSL_GSL_H 30 | -------------------------------------------------------------------------------- /Projects/Common/GSL/src/gsl/gsl_algorithm: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2015 Microsoft Corporation. All rights reserved. 4 | // 5 | // This code is licensed under the MIT License (MIT). 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13 | // THE SOFTWARE. 14 | // 15 | /////////////////////////////////////////////////////////////////////////////// 16 | 17 | #ifndef GSL_ALGORITHM_H 18 | #define GSL_ALGORITHM_H 19 | 20 | #include // for Expects 21 | #include // for dynamic_extent, span 22 | 23 | #include // for copy_n 24 | #include // for ptrdiff_t 25 | #include // for is_assignable 26 | 27 | #ifdef _MSC_VER 28 | #pragma warning(push) 29 | 30 | // turn off some warnings that are noisy about our Expects statements 31 | #pragma warning(disable : 4127) // conditional expression is constant 32 | #pragma warning(disable : 4996) // unsafe use of std::copy_n 33 | 34 | #endif // _MSC_VER 35 | 36 | namespace gsl 37 | { 38 | // Note: this will generate faster code than std::copy using span iterator in older msvc+stl 39 | // not necessary for msvc since VS2017 15.8 (_MSC_VER >= 1915) 40 | template 42 | void copy(span src, span dest) 43 | { 44 | static_assert(std::is_assignable::value, 45 | "Elements of source span can not be assigned to elements of destination span"); 46 | static_assert(SrcExtent == dynamic_extent || DestExtent == dynamic_extent || 47 | (SrcExtent <= DestExtent), 48 | "Source range is longer than target range"); 49 | 50 | Expects(dest.size() >= src.size()); 51 | GSL_SUPPRESS(stl.1) // NO-FORMAT: attribute 52 | std::copy_n(src.data(), src.size(), dest.data()); 53 | } 54 | 55 | } // namespace gsl 56 | 57 | #ifdef _MSC_VER 58 | #pragma warning(pop) 59 | #endif // _MSC_VER 60 | 61 | #endif // GSL_ALGORITHM_H 62 | -------------------------------------------------------------------------------- /Projects/Common/GSL/src/gsl/gsl_util: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2015 Microsoft Corporation. All rights reserved. 4 | // 5 | // This code is licensed under the MIT License (MIT). 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13 | // THE SOFTWARE. 14 | // 15 | /////////////////////////////////////////////////////////////////////////////// 16 | 17 | #ifndef GSL_UTIL_H 18 | #define GSL_UTIL_H 19 | 20 | #include // for Expects 21 | 22 | #include 23 | #include // for ptrdiff_t, size_t 24 | #include // for exception 25 | #include // for initializer_list 26 | #include // for is_signed, integral_constant 27 | #include // for forward 28 | 29 | #if defined(_MSC_VER) 30 | 31 | #pragma warning(push) 32 | #pragma warning(disable : 4127) // conditional expression is constant 33 | 34 | #if _MSC_VER < 1910 35 | #pragma push_macro("constexpr") 36 | #define constexpr /*constexpr*/ 37 | #endif // _MSC_VER < 1910 38 | #endif // _MSC_VER 39 | 40 | namespace gsl 41 | { 42 | // 43 | // GSL.util: utilities 44 | // 45 | 46 | // index type for all container indexes/subscripts/sizes 47 | using index = std::ptrdiff_t; 48 | 49 | // final_action allows you to ensure something gets run at the end of a scope 50 | template 51 | class final_action 52 | { 53 | public: 54 | explicit final_action(F f) noexcept : f_(std::move(f)) {} 55 | 56 | final_action(final_action&& other) noexcept : f_(std::move(other.f_)), invoke_(other.invoke_) 57 | { 58 | other.invoke_ = false; 59 | } 60 | 61 | final_action(const final_action&) = delete; 62 | final_action& operator=(const final_action&) = delete; 63 | final_action& operator=(final_action&&) = delete; 64 | 65 | GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // terminate if throws 66 | ~final_action() noexcept 67 | { 68 | if (invoke_) f_(); 69 | } 70 | 71 | private: 72 | F f_; 73 | bool invoke_{true}; 74 | }; 75 | 76 | // finally() - convenience function to generate a final_action 77 | template 78 | final_action finally(const F& f) noexcept 79 | { 80 | return final_action(f); 81 | } 82 | 83 | template 84 | final_action finally(F&& f) noexcept 85 | { 86 | return final_action(std::forward(f)); 87 | } 88 | 89 | // narrow_cast(): a searchable way to do narrowing casts of values 90 | template 91 | GSL_SUPPRESS(type.1) // NO-FORMAT: attribute 92 | constexpr T narrow_cast(U&& u) noexcept 93 | { 94 | return static_cast(std::forward(u)); 95 | } 96 | 97 | struct narrowing_error : public std::exception 98 | { 99 | }; 100 | 101 | namespace details 102 | { 103 | template 104 | struct is_same_signedness 105 | : public std::integral_constant::value == std::is_signed::value> 106 | { 107 | }; 108 | } // namespace details 109 | 110 | // narrow() : a checked version of narrow_cast() that throws if the cast changed the value 111 | template 112 | GSL_SUPPRESS(type.1) // NO-FORMAT: attribute 113 | GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) 114 | T narrow(U u) noexcept(false) 115 | { 116 | T t = narrow_cast(u); 117 | if (static_cast(t) != u) gsl::details::throw_exception(narrowing_error()); 118 | if (!details::is_same_signedness::value && ((t < T{}) != (u < U{}))) 119 | gsl::details::throw_exception(narrowing_error()); 120 | return t; 121 | } 122 | 123 | // 124 | // at() - Bounds-checked way of accessing builtin arrays, std::array, std::vector 125 | // 126 | template 127 | GSL_SUPPRESS(bounds.4) // NO-FORMAT: attribute 128 | GSL_SUPPRESS(bounds.2) // NO-FORMAT: attribute 129 | constexpr T& at(T (&arr)[N], const index i) 130 | { 131 | Expects(i >= 0 && i < narrow_cast(N)); 132 | return arr[narrow_cast(i)]; 133 | } 134 | 135 | template 136 | GSL_SUPPRESS(bounds.4) // NO-FORMAT: attribute 137 | GSL_SUPPRESS(bounds.2) // NO-FORMAT: attribute 138 | constexpr auto at(Cont& cont, const index i) -> decltype(cont[cont.size()]) 139 | { 140 | Expects(i >= 0 && i < narrow_cast(cont.size())); 141 | using size_type = decltype(cont.size()); 142 | return cont[narrow_cast(i)]; 143 | } 144 | 145 | template 146 | GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute 147 | constexpr T at(const std::initializer_list cont, const index i) 148 | { 149 | Expects(i >= 0 && i < narrow_cast(cont.size())); 150 | return *(cont.begin() + i); 151 | } 152 | 153 | } // namespace gsl 154 | 155 | #if defined(_MSC_VER) 156 | #if _MSC_VER < 1910 157 | #undef constexpr 158 | #pragma pop_macro("constexpr") 159 | 160 | #endif // _MSC_VER < 1910 161 | 162 | #pragma warning(pop) 163 | 164 | #endif // _MSC_VER 165 | 166 | #endif // GSL_UTIL_H 167 | -------------------------------------------------------------------------------- /Projects/Common/ImGui.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;tpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Header Files 16 | 17 | 18 | Header Files 19 | 20 | 21 | Header Files 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | Header Files 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | Header Files 40 | 41 | 42 | 43 | 44 | Source Files 45 | 46 | 47 | Source Files 48 | 49 | 50 | Source Files 51 | 52 | 53 | Source Files 54 | 55 | 56 | Source Files 57 | 58 | 59 | Source Files 60 | 61 | 62 | Source Files 63 | 64 | 65 | -------------------------------------------------------------------------------- /Projects/Common/ImGui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2018 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Projects/Common/ImGui/modifications.md: -------------------------------------------------------------------------------- 1 | # Modifications 2 | 3 | ### `imconfig.h` 4 | 5 | Added: 6 | ```cpp 7 | #pragma once 8 | 9 | #include "logging\logging.hpp" 10 | 11 | ... 12 | 13 | #define IM_ASSERT(expr) Assert(expr) 14 | 15 | #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 16 | 17 | ... 18 | 19 | #define IM_VEC2_CLASS_EXTRA \ 20 | ImVec2(const mage::F32x2& f) noexcept : x(f[0u]), y(f[1u]) {} \ 21 | operator mage::F32x2() const noexcept { return { x, y }; } 22 | 23 | #define IM_VEC4_CLASS_EXTRA \ 24 | ImVec4(const mage::F32x4& f) noexcept : x(f[0u]), y(f[1u]), z(f[2u]), w(f[3u]) {} \ 25 | operator mage::F32x4() const noexcept { return { x, y, z, w }; } 26 | ``` 27 | 28 | ### `imgui_impl_dx12.h` 29 | 30 | Added: 31 | ```cpp 32 | #pragma once 33 | 34 | #include "imgui.h" 35 | ``` 36 | 37 | ### `imgui_impl_dx12.cpp` 38 | 39 | Replaced: 40 | ```cpp 41 | output.col = input.col;\ 42 | ``` 43 | with: 44 | ```cpp 45 | output.col.xyz = pow(abs(input.col.xyz), 2.2f);\ 46 | output.col.w = input.col.w;\ 47 | ``` 48 | 49 | ### `imgui_impl_win32.h` 50 | 51 | Added: 52 | ```cpp 53 | #pragma once 54 | 55 | #include "imgui.h" 56 | ``` 57 | 58 | Uncommented: 59 | ```cpp 60 | IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 61 | ``` 62 | -------------------------------------------------------------------------------- /Projects/Common/ImGui/src/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating imgui, or maintain a patch/branch with your modifications to imconfig.h) 7 | // B) or add configuration directives in your own file and compile with #define IMGUI_USER_CONFIG "myfilename.h" 8 | // If you do so you need to make sure that configuration settings are defined consistently _everywhere_ dear imgui is used, which include 9 | // the imgui*.cpp files but also _any_ of your code that uses imgui. This is because some compile-time options have an affect on data structures. 10 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 11 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 12 | //----------------------------------------------------------------------------- 13 | 14 | #pragma once 15 | 16 | //----------------------------------------------------------------------------- 17 | // Engine Includes 18 | //----------------------------------------------------------------------------- 19 | #pragma region 20 | 21 | #include "logging\logging.hpp" 22 | 23 | #pragma endregion 24 | 25 | //----------------------------------------------------------------------------- 26 | // Engine Defines 27 | //----------------------------------------------------------------------------- 28 | 29 | #define IM_ASSERT(expr) Assert(expr) 30 | 31 | #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 32 | 33 | //---- Don't implement some functions to reduce linkage requirements. 34 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. 35 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow. 36 | //#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself if you don't want to link with vsnprintf. 37 | //#define IMGUI_DISABLE_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 wrapper so you can implement them yourself. Declare your prototypes in imconfig.h. 38 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 39 | 40 | //---- Include imgui_user.h at the end of imgui.h as a convenience 41 | //#define IMGUI_INCLUDE_IMGUI_USER_H 42 | 43 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 44 | //#define IMGUI_USE_BGRA_PACKED_COLOR 45 | 46 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 47 | // By default the embedded implementations are declared static and not available outside of imgui cpp files. 48 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 49 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 50 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 51 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 52 | 53 | #define IM_VEC2_CLASS_EXTRA \ 54 | ImVec2(const mage::F32x2& f) noexcept : x(f[0u]), y(f[1u]) {} \ 55 | operator mage::F32x2() const noexcept { return { x, y }; } 56 | 57 | #define IM_VEC4_CLASS_EXTRA \ 58 | ImVec4(const mage::F32x4& f) noexcept : x(f[0u]), y(f[1u]), z(f[2u]), w(f[3u]) {} \ 59 | operator mage::F32x4() const noexcept { return { x, y, z, w }; } 60 | 61 | //---- Use 32-bit vertex indices (default is 16-bit) to allow meshes with more than 64K vertices. Render function needs to support it. 62 | //#define ImDrawIdx unsigned int 63 | 64 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 65 | /* 66 | namespace ImGui 67 | { 68 | void MyFunction(const char* name, const MyMatrix44& v); 69 | } 70 | */ 71 | -------------------------------------------------------------------------------- /Projects/Common/ImGui/src/imgui_impl_dx11.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Renderer for DirectX11 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | #pragma once 12 | 13 | #include "imgui.h" 14 | 15 | struct ID3D11Device; 16 | struct ID3D11DeviceContext; 17 | 18 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); 19 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); 20 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); 21 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); 22 | 23 | // Use if you want to reset your rendering device without losing ImGui state. 24 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); 25 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); 26 | -------------------------------------------------------------------------------- /Projects/Common/ImGui/src/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // dear imgui: Platform Binding for Windows (standard windows API for 32 and 64 bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core imgui) 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE). 8 | // Missing features: 9 | // [ ] Platform: Gamepad support (best leaving it to user application to fill io.NavInputs[] with gamepad inputs from their source of choice). 10 | 11 | #pragma once 12 | 13 | #include "imgui.h" 14 | 15 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 16 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 17 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 18 | 19 | IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 20 | -------------------------------------------------------------------------------- /Projects/Common/ImGui/src/imgui_window_message_listener.cpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "imgui_window_message_listener.hpp" 9 | #include "imgui_impl_win32.h" 10 | 11 | #pragma endregion 12 | 13 | //----------------------------------------------------------------------------- 14 | // Engine Definitions 15 | //----------------------------------------------------------------------------- 16 | namespace mage { 17 | 18 | ImGuiWindowMessageListener ImGuiWindowMessageListener::s_listener; 19 | 20 | ImGuiWindowMessageListener::ImGuiWindowMessageListener() noexcept = default; 21 | 22 | ImGuiWindowMessageListener::ImGuiWindowMessageListener( 23 | const ImGuiWindowMessageListener& listener) noexcept = default; 24 | 25 | ImGuiWindowMessageListener::ImGuiWindowMessageListener( 26 | ImGuiWindowMessageListener&& listener) noexcept = default; 27 | 28 | ImGuiWindowMessageListener::~ImGuiWindowMessageListener() = default; 29 | 30 | ImGuiWindowMessageListener& ImGuiWindowMessageListener 31 | ::operator=(const ImGuiWindowMessageListener& listener) noexcept = default; 32 | 33 | ImGuiWindowMessageListener& ImGuiWindowMessageListener 34 | ::operator=(ImGuiWindowMessageListener&& listener) noexcept = default; 35 | 36 | void ImGuiWindowMessageListener 37 | ::ProcessWindowMessage([[maybe_unused]] NotNull< HWND > window, 38 | UINT message, 39 | [[maybe_unused]] WPARAM wParam, 40 | [[maybe_unused]] LPARAM lParam) { 41 | 42 | ImGui_ImplWin32_WndProcHandler(window, message, wParam, lParam); 43 | } 44 | 45 | } -------------------------------------------------------------------------------- /Projects/Common/ImGui/src/imgui_window_message_listener.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "ui\window.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // Engine Declarations 14 | //----------------------------------------------------------------------------- 15 | namespace mage { 16 | 17 | /** 18 | A class of window message listeners. 19 | */ 20 | class ImGuiWindowMessageListener final : public WindowMessageListener { 21 | 22 | public: 23 | 24 | //--------------------------------------------------------------------- 25 | // Class Member Variables 26 | //--------------------------------------------------------------------- 27 | 28 | static ImGuiWindowMessageListener s_listener; 29 | 30 | //--------------------------------------------------------------------- 31 | // Constructors and Destructors 32 | //--------------------------------------------------------------------- 33 | 34 | /** 35 | Constructs an ImGui window message listener. 36 | */ 37 | ImGuiWindowMessageListener() noexcept; 38 | 39 | /** 40 | Constructs an ImGui window message listener from the given window 41 | message listener. 42 | 43 | @param[in] listener 44 | A reference to the ImGui window message listener to 45 | copy. 46 | */ 47 | ImGuiWindowMessageListener(const ImGuiWindowMessageListener& listener) noexcept; 48 | 49 | /** 50 | Constructs an ImGui window message listener by moving the given window 51 | message listener. 52 | 53 | @param[in] listener 54 | A reference to the ImGui window message listener to move. 55 | */ 56 | ImGuiWindowMessageListener(ImGuiWindowMessageListener&& listener) noexcept; 57 | 58 | /** 59 | Destructs this ImGui window message listener. 60 | */ 61 | virtual ~ImGuiWindowMessageListener(); 62 | 63 | //--------------------------------------------------------------------- 64 | // Assignment Operators 65 | //--------------------------------------------------------------------- 66 | 67 | /** 68 | Copies the given ImGui window message listener to this ImGui window 69 | message listener. 70 | 71 | @param[in] listener 72 | A reference to the ImGui window message listener to 73 | copy. 74 | @return A reference to the copy of the given ImGui window 75 | message listener (i.e. this ImGui window message 76 | listener). 77 | */ 78 | ImGuiWindowMessageListener& operator=( 79 | const ImGuiWindowMessageListener& listener) noexcept; 80 | 81 | /** 82 | Moves the given ImGui window message listener to this ImGui window 83 | message listener. 84 | 85 | @param[in] listener 86 | A reference to the ImGui window message listener to 87 | move. 88 | @return A reference to the moved ImGui window message listener 89 | (i.e. this ImGui window message listener). 90 | */ 91 | ImGuiWindowMessageListener& operator=( 92 | ImGuiWindowMessageListener&& listener) noexcept; 93 | 94 | //--------------------------------------------------------------------- 95 | // Member Methods 96 | //--------------------------------------------------------------------- 97 | 98 | /** 99 | Processes the given message sent to a window. 100 | 101 | @param[in] window 102 | A handle to the window. 103 | @param[in] message 104 | The message. 105 | @param[in] wParam 106 | Additional message information. The contents of this 107 | parameter depend on the value of @a msg. 108 | @param[in] lParam 109 | Additional message information. The contents of this 110 | parameter depend on the value of @a msg. 111 | */ 112 | virtual void ProcessWindowMessage([[maybe_unused]] NotNull< HWND > window, 113 | UINT message, 114 | [[maybe_unused]] WPARAM wParam, 115 | [[maybe_unused]] LPARAM lParam) override; 116 | }; 117 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/collection/collection_utils.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // System Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // Engine Declarations and Definitions 14 | //----------------------------------------------------------------------------- 15 | namespace mage { 16 | 17 | /** 18 | Erases all the elements of the given container that satisfy the given 19 | predicate. 20 | 21 | @tparam ContainerT 22 | The container type. 23 | @tparam PredicateT 24 | The predicate type. 25 | @param[in,out] container 26 | A reference to the container. 27 | @param[in] predicate 28 | A reference to the predicate. 29 | @return The iterator following the last removed element. 30 | */ 31 | template< typename ContainerT, typename PredicateT > 32 | inline decltype(auto) EraseIf(ContainerT& container, 33 | PredicateT&& predicate) { 34 | 35 | // Erase-Remove Idiom 36 | return container.erase(std::remove_if(container.begin(), container.end(), 37 | std::forward< PredicateT >(predicate)), 38 | container.end()); 39 | } 40 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/collection/vector.hpp: -------------------------------------------------------------------------------- 1 | #pragma region 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "memory\allocation.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // System Includes 14 | //----------------------------------------------------------------------------- 15 | #pragma region 16 | 17 | #include 18 | 19 | #pragma endregion 20 | 21 | //----------------------------------------------------------------------------- 22 | // Type Declarations and Definitions 23 | //----------------------------------------------------------------------------- 24 | namespace mage { 25 | 26 | template< typename T > 27 | using AlignedVector = std::vector< T, AlignedAllocator< T > >; 28 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/exception/exception.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Engine Includes 3 | //----------------------------------------------------------------------------- 4 | #pragma region 5 | 6 | #include "exception\exception.hpp" 7 | 8 | #pragma endregion 9 | 10 | //----------------------------------------------------------------------------- 11 | // Engine Definitions 12 | //----------------------------------------------------------------------------- 13 | namespace mage { 14 | 15 | Exception::Exception() 16 | : std::exception(), 17 | m_text{} {} 18 | 19 | Exception::Exception(const Exception& exception) = default; 20 | 21 | Exception::Exception(Exception&& exception) = default; 22 | 23 | Exception::~Exception() = default; 24 | 25 | Exception& Exception::operator=(const Exception& exception) = default; 26 | 27 | Exception& Exception::operator=(Exception&& exception) = default; 28 | 29 | const char* Exception::what() const noexcept { 30 | return m_text; 31 | } 32 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/exception/exception.tpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Definitions 5 | //----------------------------------------------------------------------------- 6 | namespace mage { 7 | 8 | //------------------------------------------------------------------------- 9 | // Exception 10 | //------------------------------------------------------------------------- 11 | #pragma region 12 | 13 | template< typename... ArgsT > 14 | Exception::Exception(std::string_view format_str, const ArgsT&... args) 15 | : std::exception() { 16 | 17 | WriteTo(m_text, format_str, args...); 18 | } 19 | 20 | #pragma endregion 21 | 22 | //------------------------------------------------------------------------- 23 | // Exception: Utilities 24 | //------------------------------------------------------------------------- 25 | #pragma region 26 | 27 | inline void ThrowIfFailed(bool result) { 28 | if (false == result) { 29 | const Exception exception; 30 | Error(exception.what()); 31 | throw exception; 32 | } 33 | } 34 | 35 | template< typename... ArgsT > 36 | inline void ThrowIfFailed(bool result, 37 | std::string_view format_str, 38 | const ArgsT&... args) { 39 | 40 | if (false == result) { 41 | const Exception exception(format_str, args...); 42 | Error(exception.what()); 43 | throw exception; 44 | } 45 | } 46 | 47 | inline void ThrowIfFailed(BOOL result) { 48 | if (FALSE == result) { 49 | const Exception exception; 50 | Error(exception.what()); 51 | throw exception; 52 | } 53 | } 54 | 55 | template< typename... ArgsT > 56 | inline void ThrowIfFailed(BOOL result, 57 | std::string_view format_str, 58 | const ArgsT&... args) { 59 | 60 | if (FALSE == result) { 61 | const Exception exception(format_str, args...); 62 | Error(exception.what()); 63 | throw exception; 64 | } 65 | } 66 | 67 | inline void ThrowIfFailed(HRESULT result) { 68 | if (FAILED(result)) { 69 | const Exception exception; 70 | Error(exception.what()); 71 | throw exception; 72 | } 73 | } 74 | 75 | template< typename... ArgsT > 76 | inline void ThrowIfFailed(HRESULT result, 77 | std::string_view format_str, 78 | const ArgsT&... args) { 79 | 80 | if (FAILED(result)) { 81 | const Exception exception(format_str, args...); 82 | Error(exception.what()); 83 | throw exception; 84 | } 85 | } 86 | 87 | #pragma endregion 88 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/logging/dump.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Engine Includes 3 | //----------------------------------------------------------------------------- 4 | #pragma region 5 | 6 | #include "logging\dump.hpp" 7 | #include "logging\logging.hpp" 8 | 9 | #pragma endregion 10 | 11 | //----------------------------------------------------------------------------- 12 | // System Includes 13 | //----------------------------------------------------------------------------- 14 | #pragma region 15 | 16 | #include 17 | 18 | #pragma endregion 19 | 20 | //----------------------------------------------------------------------------- 21 | // Linker Directives 22 | //----------------------------------------------------------------------------- 23 | #pragma region 24 | 25 | #pragma comment ( lib, "dbghelp.lib" ) 26 | 27 | #pragma endregion 28 | 29 | //----------------------------------------------------------------------------- 30 | // Engine Declarations and Definitions 31 | //----------------------------------------------------------------------------- 32 | namespace mage { 33 | 34 | namespace { 35 | 36 | [[nodiscard]] 37 | inline LONG WINAPI UnhandledExceptionFilter( 38 | EXCEPTION_POINTERS* exception_record) noexcept { 39 | 40 | CreateMiniDump(exception_record); 41 | return EXCEPTION_CONTINUE_SEARCH; 42 | } 43 | 44 | } 45 | 46 | void AddUnhandledExceptionFilter() noexcept { 47 | SetUnhandledExceptionFilter(UnhandledExceptionFilter); 48 | } 49 | 50 | void CreateMiniDump(EXCEPTION_POINTERS* exception_record) noexcept { 51 | Info("Start creating a mini dump file."); 52 | 53 | const auto file_handle 54 | = CreateUniqueHandle(CreateFile(L"MiniDump.dmp", 55 | GENERIC_READ | GENERIC_WRITE, 56 | 0, 57 | nullptr, 58 | CREATE_ALWAYS, 59 | FILE_ATTRIBUTE_NORMAL, 60 | nullptr)); 61 | 62 | if (!file_handle) { 63 | Error("Failed to create file: {}.", GetLastError()); 64 | return; 65 | } 66 | 67 | MINIDUMP_EXCEPTION_INFORMATION info = {}; 68 | info.ThreadId = GetCurrentThreadId(); 69 | info.ExceptionPointers = exception_record; 70 | info.ClientPointers = FALSE; 71 | 72 | const auto type = static_cast< MINIDUMP_TYPE >( 73 | MiniDumpWithFullMemory | 74 | MiniDumpWithFullMemoryInfo | 75 | MiniDumpWithHandleData | 76 | MiniDumpWithThreadInfo | 77 | MiniDumpWithUnloadedModules); 78 | 79 | const BOOL result 80 | = MiniDumpWriteDump(GetCurrentProcess(), 81 | GetCurrentProcessId(), 82 | file_handle.get(), 83 | type, 84 | (exception_record) ? &info : nullptr, 85 | nullptr, 86 | nullptr); 87 | 88 | if (FALSE == result) { 89 | Error("Failed to create a mini dump file: {}.", GetLastError()); 90 | } 91 | else { 92 | Info("Succeeded to create a mini dump file: MiniDump.dmp."); 93 | } 94 | } 95 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/logging/dump.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "platform\windows.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // Engine Declarations 14 | //----------------------------------------------------------------------------- 15 | namespace mage { 16 | 17 | void AddUnhandledExceptionFilter() noexcept; 18 | 19 | void CreateMiniDump(EXCEPTION_POINTERS* exception_record) noexcept; 20 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/logging/logging.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Engine Includes 3 | //----------------------------------------------------------------------------- 4 | #pragma region 5 | 6 | #include "logging\logging.hpp" 7 | #include "exception\exception.hpp" 8 | 9 | #pragma endregion 10 | 11 | //----------------------------------------------------------------------------- 12 | // Engine Declarations and Definitions 13 | //----------------------------------------------------------------------------- 14 | namespace mage { 15 | 16 | //------------------------------------------------------------------------- 17 | // LoggingConfiguration 18 | //------------------------------------------------------------------------- 19 | #pragma region 20 | 21 | LoggingConfiguration LoggingConfiguration::s_logging_configuration; 22 | 23 | #pragma endregion 24 | 25 | //------------------------------------------------------------------------- 26 | // Console 27 | //------------------------------------------------------------------------- 28 | #pragma region 29 | 30 | namespace { 31 | 32 | /** 33 | Handler callback for handling the user closing the console (either by 34 | clicking the "Close" button on the console window's window menu, or by 35 | clicking the "End Task" button command from the Task Manager). 36 | 37 | @param[in] control_type 38 | The type of control signal received by the handler. 39 | @return @c TRUE if the function handles the control signal 40 | (i.e. @c CTRL_CLOSE_EVENT). @c FALSE otherwise. 41 | */ 42 | [[nodiscard]] 43 | constexpr BOOL WINAPI ConsoleCloseHandler(DWORD control_type) noexcept { 44 | return (CTRL_CLOSE_EVENT == control_type) ? TRUE : FALSE; 45 | } 46 | } 47 | 48 | [[nodiscard]] 49 | FU16 ConsoleWidth() { 50 | // Retrieve a handle to the standard output device. 51 | const auto handle = GetStdHandle(STD_OUTPUT_HANDLE); 52 | ThrowIfFailed((nullptr != handle), 53 | "Obtained no handle to the standard output device."); 54 | ThrowIfFailed((INVALID_HANDLE_VALUE != handle), 55 | "Obtained invalid handle to the standard output device."); 56 | 57 | // Retrieve the screen buffer information of the console. 58 | CONSOLE_SCREEN_BUFFER_INFO buffer_info = {}; 59 | { 60 | const BOOL result = GetConsoleScreenBufferInfo(handle, 61 | &buffer_info); 62 | ThrowIfFailed(result, 63 | "Retrieving console screen buffer info failed."); 64 | } 65 | 66 | return static_cast< FU16 >(buffer_info.dwSize.X); 67 | } 68 | 69 | void InitializeConsole() { 70 | // Allocate a console for basic IO. 71 | { 72 | const BOOL result = AllocConsole(); 73 | ThrowIfFailed(result, "Console allocation failed."); 74 | } 75 | 76 | // Set console handler for handling the user closing the console. 77 | { 78 | // This allows proper memory cleanup from the application itself 79 | // in case the console is closed by the user. 80 | const BOOL result = SetConsoleCtrlHandler(ConsoleCloseHandler, 81 | TRUE); 82 | ThrowIfFailed(result, "Setting console handler failed."); 83 | } 84 | 85 | // Redirect stdin to the allocated console. 86 | { 87 | std::FILE* stream; 88 | // Reuse stdin to open the file "CONIN$". 89 | const errno_t result 90 | = freopen_s(&stream, "CONIN$", "r", stdin); 91 | ThrowIfFailed(0 == result, 92 | "stdin redirection failed: {}.", result); 93 | } 94 | 95 | // Redirect stdout to the allocated console. 96 | { 97 | std::FILE* stream; 98 | // Reuse stdout to open the file "CONOUT$". 99 | const errno_t result 100 | = freopen_s(&stream, "CONOUT$", "w", stdout); 101 | ThrowIfFailed(0 == result, 102 | "stdout redirection failed: {}.", result); 103 | } 104 | 105 | // Redirect stderr to the allocated console. 106 | { 107 | std::FILE* stream; 108 | // Reuse stderr to open the file "CONOUT$". 109 | const errno_t result 110 | = freopen_s(&stream, "CONOUT$", "w", stderr); 111 | ThrowIfFailed(0 == result, 112 | "stderr redirection failed: {}.", result); 113 | } 114 | } 115 | 116 | #pragma endregion 117 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/logging/logging.tpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Declarations 5 | //----------------------------------------------------------------------------- 6 | namespace mage { 7 | 8 | template< typename... ArgsT > 9 | inline void Log(MessageDisposition disposition, 10 | std::string_view format_str, const ArgsT&... args) { 11 | 12 | if (MessageDisposition::Ignore == disposition) { 13 | return; 14 | } 15 | 16 | Print(format_str, args...); 17 | Print("\n"); 18 | 19 | if (MessageDisposition::Abort == disposition) { 20 | __debugbreak(); 21 | } 22 | } 23 | 24 | template< typename... ArgsT > 25 | inline void Log(MessageDisposition disposition, 26 | std::wstring_view format_str, const ArgsT&... args) { 27 | 28 | if (MessageDisposition::Ignore == disposition) { 29 | return; 30 | } 31 | 32 | Print(format_str, args...); 33 | Print("\n"); 34 | 35 | if (MessageDisposition::Abort == disposition) { 36 | __debugbreak(); 37 | } 38 | } 39 | 40 | template< typename... ArgsT > 41 | inline void Debug([[maybe_unused]] std::string_view format_str, 42 | [[maybe_unused]] const ArgsT&... args) { 43 | 44 | #ifdef _DEBUG 45 | if ( !LoggingConfiguration::Get().IsVerbose() 46 | || LoggingConfiguration::Get().IsQuiet()) { 47 | // Do not process info in non-verbose mode. 48 | // Do not process info in quiet mode. 49 | return; 50 | } 51 | 52 | Print("Debug: "); 53 | Log(MessageDisposition::Continue, format_str, args...); 54 | #endif 55 | } 56 | 57 | template< typename... ArgsT > 58 | inline void Debug([[maybe_unused]] std::wstring_view format_str, 59 | [[maybe_unused]] const ArgsT&... args) { 60 | 61 | #ifdef _DEBUG 62 | if ( !LoggingConfiguration::Get().IsVerbose() 63 | || LoggingConfiguration::Get().IsQuiet()) { 64 | // Do not process info in non-verbose mode. 65 | // Do not process info in quiet mode. 66 | return; 67 | } 68 | 69 | Print("Debug: "); 70 | Log(MessageDisposition::Continue, format_str, args...); 71 | #endif 72 | } 73 | 74 | template< typename... ArgsT > 75 | inline void Info(std::string_view format_str, const ArgsT&... args) { 76 | if ( !LoggingConfiguration::Get().IsVerbose() 77 | || LoggingConfiguration::Get().IsQuiet()) { 78 | // Do not process info in non-verbose mode. 79 | // Do not process info in quiet mode. 80 | return; 81 | } 82 | 83 | Print("Info: "); 84 | Log(MessageDisposition::Continue, format_str, args...); 85 | } 86 | 87 | template< typename... ArgsT > 88 | inline void Info(std::wstring_view format_str, const ArgsT&... args) { 89 | if ( !LoggingConfiguration::Get().IsVerbose() 90 | || LoggingConfiguration::Get().IsQuiet()) { 91 | // Do not process info in non-verbose mode. 92 | // Do not process info in quiet mode. 93 | return; 94 | } 95 | 96 | Print("Info: "); 97 | Log(MessageDisposition::Continue, format_str, args...); 98 | } 99 | 100 | template< typename... ArgsT > 101 | inline void Warning(std::string_view format_str, const ArgsT&... args) { 102 | if (LoggingConfiguration::Get().IsQuiet()) { 103 | // Do not process warning in quiet mode. 104 | return; 105 | } 106 | 107 | Print("Warning: "); 108 | Log(MessageDisposition::Continue, format_str, args...); 109 | } 110 | 111 | template< typename... ArgsT > 112 | inline void Warning(std::wstring_view format_str, const ArgsT&... args) { 113 | if (LoggingConfiguration::Get().IsQuiet()) { 114 | // Do not process warning in quiet mode. 115 | return; 116 | } 117 | 118 | Print("Warning: "); 119 | Log(MessageDisposition::Continue, format_str, args...); 120 | } 121 | 122 | template< typename... ArgsT > 123 | inline void Error(std::string_view format_str, const ArgsT&... args) { 124 | Print("Error: "); 125 | Log(MessageDisposition::Continue, format_str, args...); 126 | } 127 | 128 | template< typename... ArgsT > 129 | inline void Error(std::wstring_view format_str, const ArgsT&... args) { 130 | Print("Error: "); 131 | Log(MessageDisposition::Continue, format_str, args...); 132 | } 133 | 134 | template< typename... ArgsT > 135 | inline void Fatal(std::string_view format_str, const ArgsT&... args) { 136 | Print("Fatal: "); 137 | Log(MessageDisposition::Abort, format_str, args...); 138 | } 139 | 140 | template< typename... ArgsT > 141 | inline void Fatal(std::wstring_view format_str, const ArgsT&... args) { 142 | Print("Fatal: "); 143 | Log(MessageDisposition::Abort, format_str, args...); 144 | } 145 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/logging/progress_reporter.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "type\types.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // Engine Declarations 14 | //----------------------------------------------------------------------------- 15 | namespace mage { 16 | 17 | /** 18 | A class of progress reporters. 19 | */ 20 | class ProgressReporter { 21 | 22 | public: 23 | 24 | //--------------------------------------------------------------------- 25 | // Constructors and Destructors 26 | //--------------------------------------------------------------------- 27 | 28 | /** 29 | Constructs a progress reporter. 30 | 31 | @param[in] title 32 | The title. 33 | @param[in] nb_work 34 | The total number of work units. 35 | @param[in] progress_char 36 | The character representing the progress. 37 | @param[in] bar_length 38 | The length of the progress bar. If @a bar_length is 39 | equal to 0 the default length will be chosen. 40 | */ 41 | explicit ProgressReporter(std::string_view title, 42 | U32 nb_work, 43 | char progress_char = '+', 44 | FU16 bar_length = 0u); 45 | 46 | /** 47 | Constructs a progress reporter from the given progress reporter. 48 | 49 | @param[in] reporter 50 | A reference to the progress reporter to copy. 51 | */ 52 | ProgressReporter(const ProgressReporter& reporter) = delete; 53 | 54 | /** 55 | Constructs a progress reporter by moving the given progress reporter. 56 | 57 | @param[in] reporter 58 | A reference to the progress reporter to move. 59 | */ 60 | ProgressReporter(ProgressReporter&& reporter) noexcept; 61 | 62 | /** 63 | Destructs this progress reporter. 64 | */ 65 | ~ProgressReporter(); 66 | 67 | //--------------------------------------------------------------------- 68 | // Assignment Operators 69 | //--------------------------------------------------------------------- 70 | 71 | /** 72 | Copies the given progress reporter to this progress reporter. 73 | 74 | @param[in] reporter 75 | A reference to the progress reporter to copy. 76 | @return A reference to the copy of the given progress reporter 77 | (i.e. this progress reporter). 78 | */ 79 | ProgressReporter& operator=(const ProgressReporter& reporter) = delete; 80 | 81 | /** 82 | Copies the given progress reporter to this progress reporter. 83 | 84 | @param[in] reporter 85 | A reference to the progress reporter to move. 86 | @return A reference to moved progress reporter (i.e. this 87 | progress reporter). 88 | */ 89 | ProgressReporter& operator=(ProgressReporter&& reporter) = delete; 90 | 91 | //--------------------------------------------------------------------- 92 | // Member Methods 93 | //--------------------------------------------------------------------- 94 | 95 | /** 96 | Updates this progress reporter. 97 | 98 | @param[in] nb_work 99 | The number of work units that are done. 100 | */ 101 | void Update(U32 nb_work = 1u); 102 | 103 | /** 104 | Finishes this progress reporter. 105 | */ 106 | void Done(); 107 | 108 | private: 109 | 110 | //--------------------------------------------------------------------- 111 | // Member Variables 112 | //--------------------------------------------------------------------- 113 | 114 | class Impl; 115 | 116 | /** 117 | A pointer to the implementation of this progress reporter. 118 | */ 119 | UniquePtr< Impl > m_impl; 120 | }; 121 | } 122 | -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/memory/memory.tpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Definitions 5 | //----------------------------------------------------------------------------- 6 | namespace mage { 7 | 8 | //------------------------------------------------------------------------- 9 | // SharedPtr 10 | //------------------------------------------------------------------------- 11 | #pragma region 12 | 13 | template< typename T, typename... ConstructorArgsT > 14 | inline SharedPtr< T > MakeShared(ConstructorArgsT&&... args) { 15 | return std::make_shared< T >(std::forward< ConstructorArgsT >(args)...); 16 | } 17 | 18 | template< typename T, typename... ConstructorArgsT > 19 | inline SharedPtr< T > MakeAllocatedShared(ConstructorArgsT&&... args) { 20 | return SharedPtr< T >(new T{ std::forward< ConstructorArgsT >(args)... }); 21 | } 22 | 23 | #pragma endregion 24 | 25 | //------------------------------------------------------------------------- 26 | // UniquePtr 27 | //------------------------------------------------------------------------- 28 | #pragma region 29 | 30 | template< typename T, typename... ConstructorArgsT > 31 | inline UniquePtr< T > MakeUnique(ConstructorArgsT&&... args) { 32 | return std::make_unique< T >(std::forward< ConstructorArgsT >(args)...); 33 | } 34 | 35 | template< typename ToT, typename FromT > 36 | inline UniquePtr< ToT > static_pointer_cast(UniquePtr< FromT >&& ptr) noexcept { 37 | return UniquePtr< ToT >(static_cast< ToT* >(ptr.release())); 38 | } 39 | 40 | template< typename ToT, typename FromT > 41 | inline UniquePtr< ToT > dynamic_pointer_cast(UniquePtr< FromT >&& ptr) noexcept { 42 | const auto stored_ptr = ptr.release(); 43 | const auto converted_stored_ptr = dynamic_cast< ToT* >(stored_ptr); 44 | if (converted_stored_ptr) { 45 | return UniquePtr< ToT >(converted_stored_ptr); 46 | } 47 | else { 48 | ptr.reset(stored_ptr); 49 | return UniquePtr< ToT >(nullptr); 50 | } 51 | } 52 | 53 | template< typename ToT, typename FromT > 54 | inline UniquePtr< ToT > const_pointer_cast(UniquePtr< FromT >&& ptr) noexcept { 55 | return UniquePtr< ToT >(const_cast< ToT* >(ptr.release())); 56 | } 57 | 58 | template< typename ToT, typename FromT > 59 | inline UniquePtr< ToT > reinterpret_pointer_cast(UniquePtr< FromT >&& ptr) noexcept { 60 | return UniquePtr< ToT >(reinterpret_cast< ToT* >(ptr.release())); 61 | } 62 | 63 | #pragma endregion 64 | 65 | //------------------------------------------------------------------------- 66 | // ProxyPtr 67 | //------------------------------------------------------------------------- 68 | #pragma region 69 | 70 | template< typename ToT, typename FromT > 71 | inline ProxyPtr< ToT > static_pointer_cast(const ProxyPtr< FromT >& ptr) noexcept { 72 | return ProxyPtr< ToT >([getter(ptr.m_getter)]() noexcept { 73 | return static_cast< ToT* >(getter()); 74 | }); 75 | } 76 | 77 | template< typename ToT, typename FromT > 78 | inline ProxyPtr< ToT > static_pointer_cast(ProxyPtr< FromT >&& ptr) noexcept { 79 | return ProxyPtr< ToT >([getter(std::move(ptr.m_getter))]() noexcept { 80 | return static_cast< ToT* >(getter()); 81 | }); 82 | } 83 | 84 | template< typename ToT, typename FromT > 85 | inline ProxyPtr< ToT > dynamic_pointer_cast(const ProxyPtr< FromT >& ptr) noexcept { 86 | return ProxyPtr< ToT >([getter(ptr.m_getter)]() noexcept { 87 | return dynamic_cast< ToT* >(getter()); 88 | }); 89 | } 90 | 91 | template< typename ToT, typename FromT > 92 | inline ProxyPtr< ToT > dynamic_pointer_cast(ProxyPtr< FromT >&& ptr) noexcept { 93 | return ProxyPtr< ToT >([getter(std::move(ptr.m_getter))]() noexcept { 94 | return dynamic_cast< ToT* >(getter()); 95 | }); 96 | } 97 | 98 | template< typename ToT, typename FromT > 99 | inline ProxyPtr< ToT > const_pointer_cast(const ProxyPtr< FromT >& ptr) noexcept { 100 | return ProxyPtr< ToT >([getter(ptr.m_getter)]() noexcept { 101 | return const_cast< ToT* >(getter()); 102 | }); 103 | } 104 | 105 | template< typename ToT, typename FromT > 106 | inline ProxyPtr< ToT > const_pointer_cast(ProxyPtr< FromT >&& ptr) noexcept { 107 | return ProxyPtr< ToT >([getter(std::move(ptr.m_getter))]() noexcept { 108 | return const_cast< ToT* >(getter()); 109 | }); 110 | } 111 | 112 | template< typename ToT, typename FromT > 113 | inline ProxyPtr< ToT > reinterpret_pointer_cast(const ProxyPtr< FromT >& ptr) noexcept { 114 | return ProxyPtr< ToT >([getter(ptr.m_getter)]() noexcept { 115 | return reinterpret_cast< ToT* >(getter()); 116 | }); 117 | } 118 | 119 | template< typename ToT, typename FromT > 120 | inline ProxyPtr< ToT > reinterpret_pointer_cast(ProxyPtr< FromT >&& ptr) noexcept { 121 | return ProxyPtr< ToT >([getter(std::move(ptr.m_getter))]() noexcept { 122 | return reinterpret_cast< ToT* >(getter()); 123 | }); 124 | } 125 | 126 | #pragma endregion 127 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/memory/memory_arena.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Engine Includes 3 | //----------------------------------------------------------------------------- 4 | #pragma region 5 | 6 | #include "memory\allocation.hpp" 7 | #include "memory\memory_arena.hpp" 8 | 9 | #pragma endregion 10 | 11 | //----------------------------------------------------------------------------- 12 | // Engine Definitions 13 | //----------------------------------------------------------------------------- 14 | namespace mage { 15 | 16 | MemoryArena::MemoryArena(std::size_t maximum_block_size, 17 | std::size_t alignment) 18 | : m_alignment(alignment), 19 | m_maximum_block_size(maximum_block_size), 20 | m_current_block(0u, nullptr), 21 | m_current_block_pos(0u), 22 | m_used_blocks(), 23 | m_available_blocks() {} 24 | 25 | MemoryArena::MemoryArena(MemoryArena&& arena) = default; 26 | 27 | MemoryArena::~MemoryArena() { 28 | FreeAligned(GetCurrentBlockPtr()); 29 | 30 | for (const auto& block : m_used_blocks) { 31 | FreeAligned(block.second); 32 | } 33 | 34 | for (const auto& block : m_available_blocks) { 35 | FreeAligned(block.second); 36 | } 37 | } 38 | 39 | [[nodiscard]] 40 | std::size_t MemoryArena::GetTotalBlockSize() const noexcept { 41 | auto size = GetCurrentBlockSize(); 42 | 43 | for (const auto& block : m_used_blocks) { 44 | size += block.first; 45 | } 46 | 47 | for (const auto& block : m_available_blocks) { 48 | size += block.first; 49 | } 50 | 51 | return size; 52 | } 53 | 54 | void MemoryArena::Reset() { 55 | using std::begin; 56 | 57 | m_current_block_pos = 0u; 58 | m_current_block = { 0u, nullptr }; 59 | m_available_blocks.splice(begin(m_available_blocks), m_used_blocks); 60 | } 61 | 62 | void* MemoryArena::Alloc(std::size_t size) { 63 | using std::begin; 64 | using std::end; 65 | 66 | // Round up the given size to minimum machine alignment. 67 | size = ((size + 15u) & (~15u)); 68 | 69 | if (m_current_block_pos + size > GetCurrentBlockSize()) { 70 | 71 | // Store current block (if existing) as used block. 72 | if (GetCurrentBlockPtr()) { 73 | m_used_blocks.push_back(m_current_block); 74 | } 75 | 76 | // Fetch new block from available blocks (if possible). 77 | for (auto it = begin(m_available_blocks); 78 | it != end(m_available_blocks); ++it) { 79 | 80 | if (it->first >= size) { 81 | m_current_block = *it; 82 | m_available_blocks.erase(it); 83 | break; 84 | } 85 | } 86 | 87 | // Allocate new block (if needed). 88 | if (!GetCurrentBlockPtr()) { 89 | // Allocate new block. 90 | const auto alloc_size = std::max(size, GetMaximumBlockSize()); 91 | const auto alloc_ptr = AllocAlignedData< U8 >(alloc_size, m_alignment); 92 | 93 | if (!alloc_ptr) { 94 | // The allocation failed. 95 | return nullptr; 96 | } 97 | 98 | m_current_block = { alloc_size, alloc_ptr }; 99 | } 100 | 101 | m_current_block_pos = 0u; 102 | } 103 | 104 | const auto ptr = static_cast< void* >( 105 | m_current_block.second + m_current_block_pos); 106 | 107 | m_current_block_pos += size; 108 | 109 | return ptr; 110 | } 111 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/memory/memory_arena.tpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Definitions 5 | //----------------------------------------------------------------------------- 6 | namespace mage { 7 | 8 | template< typename T > 9 | T* MemoryArena::AllocData(std::size_t count, bool initialization) { 10 | // Allocation 11 | const auto ptr = static_cast< T* >(Alloc(count * sizeof(T))); 12 | 13 | if (!ptr) { 14 | // The allocation failed. 15 | return nullptr; 16 | } 17 | 18 | // Initialization 19 | if (initialization) { 20 | for (std::size_t i = 0u; i < count; ++i) { 21 | new (&ptr[i]) T{}; 22 | } 23 | } 24 | 25 | return ptr; 26 | } 27 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/memory/memory_stack.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Engine Includes 3 | //----------------------------------------------------------------------------- 4 | #pragma region 5 | 6 | #include "logging\logging.hpp" 7 | #include "memory\allocation.hpp" 8 | #include "memory\memory_stack.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // Engine Definitions 14 | //----------------------------------------------------------------------------- 15 | namespace mage { 16 | 17 | //------------------------------------------------------------------------- 18 | // MemoryStack 19 | //------------------------------------------------------------------------- 20 | #pragma region 21 | 22 | SingleEndedMemoryStack::SingleEndedMemoryStack(std::size_t size, 23 | std::size_t alignment) 24 | : m_alignment(alignment), 25 | m_size(size), 26 | m_begin(), 27 | m_current() { 28 | 29 | const auto ptr = AllocAligned(m_size, m_alignment); 30 | if (!ptr) { 31 | throw std::bad_alloc(); 32 | } 33 | 34 | m_begin = reinterpret_cast< std::uintptr_t >(ptr); 35 | Reset(); 36 | } 37 | 38 | SingleEndedMemoryStack::SingleEndedMemoryStack( 39 | SingleEndedMemoryStack&& stack) noexcept = default; 40 | 41 | SingleEndedMemoryStack::~SingleEndedMemoryStack() { 42 | FreeAligned((void*)m_begin); 43 | } 44 | 45 | void SingleEndedMemoryStack::Reset() noexcept { 46 | RollBack(m_begin); 47 | } 48 | 49 | void SingleEndedMemoryStack::RollBack(std::uintptr_t ptr) noexcept { 50 | Assert(m_begin <= ptr && ptr <= m_current); 51 | 52 | m_current = ptr; 53 | } 54 | 55 | void* SingleEndedMemoryStack::Alloc(std::size_t size) noexcept { 56 | if (GetAvailableSize() < size) { 57 | // The allocation failed. 58 | return nullptr; 59 | } 60 | 61 | const auto ptr = (void*)m_current; 62 | m_current += size; 63 | return ptr; 64 | } 65 | 66 | #pragma endregion 67 | 68 | //------------------------------------------------------------------------- 69 | // DoubleEndedMemoryStack 70 | //------------------------------------------------------------------------- 71 | #pragma region 72 | 73 | DoubleEndedMemoryStack::DoubleEndedMemoryStack(std::size_t size, 74 | std::size_t alignment) 75 | : m_alignment(alignment), 76 | m_size(size), 77 | m_begin(), 78 | m_current_low(), 79 | m_current_high() { 80 | 81 | const auto ptr = AllocAligned(m_size, m_alignment); 82 | if (!ptr) { 83 | throw std::bad_alloc(); 84 | } 85 | 86 | m_begin = reinterpret_cast< std::uintptr_t >(ptr); 87 | Reset(); 88 | } 89 | 90 | DoubleEndedMemoryStack::DoubleEndedMemoryStack( 91 | DoubleEndedMemoryStack&& stack) noexcept = default; 92 | 93 | DoubleEndedMemoryStack::~DoubleEndedMemoryStack() { 94 | FreeAligned((void*)m_begin); 95 | } 96 | 97 | void DoubleEndedMemoryStack::Reset() noexcept { 98 | RollBackLow(m_begin); 99 | RollBackHigh(m_begin + m_size - 1u); 100 | } 101 | 102 | void DoubleEndedMemoryStack::RollBackLow(std::uintptr_t ptr) noexcept { 103 | Assert(m_begin <= ptr && ptr <= m_current_low); 104 | 105 | m_current_low = ptr; 106 | } 107 | 108 | void DoubleEndedMemoryStack::RollBackHigh(std::uintptr_t ptr) noexcept { 109 | Assert(m_current_high <= ptr && ptr < m_begin + m_size); 110 | 111 | m_current_high = ptr; 112 | } 113 | 114 | void* DoubleEndedMemoryStack::AllocLow(std::size_t size) noexcept { 115 | if (GetAvailableSize() < size) { 116 | // The allocation failed. 117 | return nullptr; 118 | } 119 | 120 | const auto ptr = (void*)m_current_low; 121 | m_current_low += size; 122 | return ptr; 123 | } 124 | 125 | void* DoubleEndedMemoryStack::AllocHigh(std::size_t size) noexcept { 126 | if (GetAvailableSize() < size) { 127 | // The allocation failed. 128 | return nullptr; 129 | } 130 | 131 | const auto ptr = (void*)m_current_high; 132 | m_current_high -= size; 133 | return ptr; 134 | } 135 | 136 | #pragma endregion 137 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/memory/memory_stack.tpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Definitions 5 | //----------------------------------------------------------------------------- 6 | namespace mage { 7 | 8 | template< typename T > 9 | T* SingleEndedMemoryStack::AllocData(std::size_t count, bool initialization) { 10 | // Allocation 11 | const auto ptr = static_cast< T* >(Alloc(count * sizeof(T))); 12 | 13 | if (!ptr) { 14 | // The allocation failed. 15 | return nullptr; 16 | } 17 | 18 | // Initialization 19 | if (initialization) { 20 | for (std::size_t i = 0u; i < count; ++i) { 21 | new (&ptr[i]) T{}; 22 | } 23 | } 24 | 25 | return ptr; 26 | } 27 | 28 | template< typename T > 29 | T* DoubleEndedMemoryStack::AllocDataLow(std::size_t count, bool initialization) { 30 | // Allocation 31 | const auto ptr = static_cast< T* >(AllocLow(count * sizeof(T))); 32 | 33 | if (!ptr) { 34 | // The allocation failed. 35 | return nullptr; 36 | } 37 | 38 | // Initialization 39 | if (initialization) { 40 | for (std::size_t i = 0u; i < count; ++i) { 41 | new (&ptr[i]) T{}; 42 | } 43 | } 44 | 45 | return ptr; 46 | } 47 | 48 | template< typename T > 49 | T* DoubleEndedMemoryStack::AllocDataHigh(std::size_t count, bool initialization) { 50 | // Allocation 51 | const auto ptr = static_cast< T* >(AllocHigh(count * sizeof(T))); 52 | 53 | if (!ptr) { 54 | // The allocation failed. 55 | return nullptr; 56 | } 57 | 58 | // Initialization 59 | if (initialization) { 60 | for (std::size_t i = 0u; i < count; ++i) { 61 | new (&ptr[i]) T{}; 62 | } 63 | } 64 | 65 | return ptr; 66 | } 67 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/parallel/id_generator.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Engine Includes 3 | //----------------------------------------------------------------------------- 4 | #pragma region 5 | 6 | #include "parallel\id_generator.hpp" 7 | 8 | #pragma endregion 9 | 10 | //----------------------------------------------------------------------------- 11 | // Engine Definitions 12 | //----------------------------------------------------------------------------- 13 | namespace mage { 14 | 15 | U64 GetNextGuid() noexcept { 16 | static IdGenerator< U64 > s_guid_generator; 17 | return s_guid_generator.GetNextId(); 18 | } 19 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/parallel/id_generator.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "type\atomic_types.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // Engine Declarations and Definitions 14 | //----------------------------------------------------------------------------- 15 | namespace mage { 16 | 17 | /** 18 | Returns the next guid. 19 | 20 | @return The next guid. 21 | */ 22 | U64 GetNextGuid() noexcept; 23 | 24 | /** 25 | A class of id generators. 26 | */ 27 | template< typename T, typename = std::enable_if_t< std::is_integral_v< T > > > 28 | class IdGenerator { 29 | 30 | public: 31 | 32 | //--------------------------------------------------------------------- 33 | // Constructors and Destructors 34 | //--------------------------------------------------------------------- 35 | 36 | /** 37 | Constructs an id generator. 38 | 39 | @param[in] first_id 40 | The first id of this id_generator 41 | */ 42 | constexpr explicit IdGenerator(T first_id = T(0)) noexcept 43 | : m_current_id(first_id) {} 44 | 45 | /** 46 | Constructs an id generator from the given id generator. 47 | 48 | @param[in] generator 49 | A reference to the id generator to copy. 50 | */ 51 | IdGenerator(const IdGenerator& generator) = delete; 52 | 53 | /** 54 | Constructs an id generator by moving the given id generator. 55 | 56 | @param[in] generator 57 | A reference to the id generator to move. 58 | */ 59 | IdGenerator(IdGenerator&& generator) = delete; 60 | 61 | /** 62 | Destructs this id generator. 63 | */ 64 | ~IdGenerator() = default; 65 | 66 | //--------------------------------------------------------------------- 67 | // Assignment Operators 68 | //--------------------------------------------------------------------- 69 | 70 | /** 71 | Copies the given id generator to this id generator. 72 | 73 | @param[in] generator 74 | The id generator to copy. 75 | @return A reference to the copy of the given id generator (i.e. 76 | this id generator). 77 | */ 78 | IdGenerator& operator=(const IdGenerator& generator) = delete; 79 | 80 | /** 81 | Copies the given id generator to this id generator. 82 | 83 | @param[in] generator 84 | The id generator to move. 85 | @return A reference to the moved id generator (i.e. this id 86 | generator). 87 | */ 88 | IdGenerator& operator=(IdGenerator&& generator) = delete; 89 | 90 | //--------------------------------------------------------------------- 91 | // Member Methods 92 | //--------------------------------------------------------------------- 93 | 94 | /** 95 | Returns the next id of this id generator. 96 | 97 | @return The next id of this id generator. 98 | */ 99 | T GetNextId() noexcept { 100 | return m_current_id++; 101 | } 102 | 103 | private: 104 | 105 | //--------------------------------------------------------------------- 106 | // Member Variables 107 | //--------------------------------------------------------------------- 108 | 109 | /** 110 | The current id of this id generator. 111 | */ 112 | std::atomic< T > m_current_id; 113 | }; 114 | } 115 | -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/parallel/parallel.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Engine Includes 3 | //----------------------------------------------------------------------------- 4 | #pragma region 5 | 6 | #include "exception\exception.hpp" 7 | #include "parallel\parallel.hpp" 8 | 9 | #pragma endregion 10 | 11 | //----------------------------------------------------------------------------- 12 | // Engine Definitions 13 | //----------------------------------------------------------------------------- 14 | namespace mage { 15 | 16 | [[nodiscard]] 17 | FU16 NumberOfPhysicalCores() { 18 | DWORD length = 0u; 19 | 20 | // Obtain the buffer length. 21 | { 22 | const BOOL result = GetLogicalProcessorInformationEx( 23 | RelationProcessorCore, nullptr, &length); 24 | ThrowIfFailed(result, 25 | "Retrieving processor information failed."); 26 | ThrowIfFailed((ERROR_INSUFFICIENT_BUFFER != GetLastError()), 27 | "Retrieving processor information failed."); 28 | } 29 | 30 | auto buffer = DynamicArray< U8 >(length); 31 | 32 | // Populate the buffer. 33 | { 34 | const auto info = reinterpret_cast< 35 | PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX >(buffer.data()); 36 | 37 | const BOOL result = GetLogicalProcessorInformationEx( 38 | RelationProcessorCore, info, &length); 39 | ThrowIfFailed(result, "Retrieving processor information failed."); 40 | } 41 | 42 | FU16 nb_physical_cores = 0u; 43 | DWORD offset = 0u; 44 | do { 45 | const auto info = reinterpret_cast< 46 | PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX >(buffer.data() + offset); 47 | 48 | offset += info->Size; 49 | ++nb_physical_cores; 50 | 51 | } while (offset < length); 52 | 53 | return nb_physical_cores; 54 | } 55 | 56 | [[nodiscard]] 57 | FU16 NumberOfSystemCores() noexcept { 58 | SYSTEM_INFO system_info = {}; 59 | GetSystemInfo(&system_info); 60 | // Return the number of logical processors in the current group. 61 | return static_cast< FU16 >(system_info.dwNumberOfProcessors); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/parallel/parallel.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "type\types.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // Engine Declarations 14 | //----------------------------------------------------------------------------- 15 | namespace mage { 16 | 17 | /** 18 | Returns the number of physical cores (i.e. physical processors). 19 | 20 | @return The number of physical cores (i.e. physical processors). 21 | */ 22 | [[nodiscard]] 23 | FU16 NumberOfPhysicalCores(); 24 | 25 | /** 26 | Returns the number of system cores (i.e. logical processors). 27 | 28 | @return The number of system cores (i.e. logical processors). 29 | */ 30 | [[nodiscard]] 31 | FU16 NumberOfSystemCores() noexcept; 32 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/platform/windows.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | // Scalar types. 9 | #include "type\scalar_types.hpp" 10 | 11 | #pragma endregion 12 | 13 | //----------------------------------------------------------------------------- 14 | // System Defines 15 | //----------------------------------------------------------------------------- 16 | #pragma region 17 | 18 | // Exclude APIs such as Cryptography, DDE, RPC, Shell, and Windows Sockets. 19 | #define WIN32_LEAN_AND_MEAN 20 | 21 | // Inhibit definitions: macros min(a,b) and max(a,b). 22 | #define NOMINMAX 23 | 24 | // Inhibit definitions: DrawText() and DT_*. 25 | #define NODRAWTEXT 26 | 27 | // Inhibit definitions: all GDI defines and routines. 28 | #define NOGDI 29 | 30 | // Inhibit definitions 31 | #define NOBITMAP 32 | 33 | // Inhibit definitions: typedef MSG and associated routines. 34 | #define NOMCX 35 | 36 | // Inhibit definitions: all Service Controller routines, SERVICE_ equates, etc. 37 | #define NOSERVICE 38 | 39 | // Inhibit definitions: help engine interface. 40 | #define NOHELP 41 | 42 | #pragma endregion 43 | 44 | //----------------------------------------------------------------------------- 45 | // System Includes 46 | //----------------------------------------------------------------------------- 47 | #pragma region 48 | 49 | #include 50 | 51 | #pragma endregion 52 | 53 | //----------------------------------------------------------------------------- 54 | // Type Checks 55 | //----------------------------------------------------------------------------- 56 | namespace mage { 57 | 58 | //------------------------------------------------------------------------- 59 | // Same Types 60 | //------------------------------------------------------------------------- 61 | 62 | static_assert(std::is_same_v< F32, FLOAT >, "MAGE/Windows type mismatch"); 63 | 64 | static_assert(std::is_same_v< S32, INT >, "MAGE/Windows type mismatch"); 65 | static_assert(std::is_same_v< S8, INT8 >, "MAGE/Windows type mismatch"); 66 | static_assert(std::is_same_v< S16, INT16 >, "MAGE/Windows type mismatch"); 67 | static_assert(std::is_same_v< S32, INT32 >, "MAGE/Windows type mismatch"); 68 | static_assert(std::is_same_v< S64, INT64 >, "MAGE/Windows type mismatch"); 69 | 70 | static_assert(std::is_same_v< U32, UINT >, "MAGE/Windows type mismatch"); 71 | static_assert(std::is_same_v< U8, UINT8 >, "MAGE/Windows type mismatch"); 72 | static_assert(std::is_same_v< U16, UINT16 >, "MAGE/Windows type mismatch"); 73 | static_assert(std::is_same_v< U32, UINT32 >, "MAGE/Windows type mismatch"); 74 | static_assert(std::is_same_v< U64, UINT64 >, "MAGE/Windows type mismatch"); 75 | 76 | static_assert(std::is_same_v< U8, BYTE >, "MAGE/Windows type mismatch"); 77 | 78 | //------------------------------------------------------------------------- 79 | // Equivalent Types 80 | //------------------------------------------------------------------------- 81 | 82 | template< typename T, typename U > 83 | struct is_equivalent_integral : public std::bool_constant< 84 | (sizeof(T) == sizeof(U)) 85 | && std::is_integral_v< T > 86 | && std::is_integral_v< U > 87 | && (std::is_signed_v< T > == std::is_signed_v< U >) 88 | && (std::is_unsigned_v< T > == std::is_unsigned_v< U >) >{}; 89 | 90 | template< typename T, typename U > 91 | constexpr bool is_equivalent_integral_v = is_equivalent_integral< T, U >::value; 92 | 93 | static_assert(is_equivalent_integral_v< U16, WORD >, 94 | "MAGE/Windows type mismatch"); 95 | 96 | static_assert(is_equivalent_integral_v< U32, DWORD >, 97 | "MAGE/Windows type mismatch"); 98 | static_assert(is_equivalent_integral_v< U64, DWORDLONG >, 99 | "MAGE/Windows type mismatch"); 100 | static_assert(is_equivalent_integral_v< U32, DWORD32 >, 101 | "MAGE/Windows type mismatch"); 102 | static_assert(is_equivalent_integral_v< U64, DWORD64 >, 103 | "MAGE/Windows type mismatch"); 104 | 105 | static_assert(is_equivalent_integral_v< S32, LONG >, 106 | "MAGE/Windows type mismatch"); 107 | static_assert(is_equivalent_integral_v< S64, LONGLONG >, 108 | "MAGE/Windows type mismatch"); 109 | static_assert(is_equivalent_integral_v< S32, LONG32 >, 110 | "MAGE/Windows type mismatch"); 111 | static_assert(is_equivalent_integral_v< S64, LONG64 >, 112 | "MAGE/Windows type mismatch"); 113 | 114 | static_assert(is_equivalent_integral_v< U32, ULONG >, 115 | "MAGE/Windows type mismatch"); 116 | static_assert(is_equivalent_integral_v< U64, ULONGLONG >, 117 | "MAGE/Windows type mismatch"); 118 | static_assert(is_equivalent_integral_v< U32, ULONG32 >, 119 | "MAGE/Windows type mismatch"); 120 | static_assert(is_equivalent_integral_v< U64, ULONG64 >, 121 | "MAGE/Windows type mismatch"); 122 | 123 | static_assert(is_equivalent_integral_v< std::size_t, SIZE_T >, 124 | "MAGE/Windows type mismatch"); 125 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/platform/windows_utils.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "type\types.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // Engine Declarations 14 | //----------------------------------------------------------------------------- 15 | namespace mage { 16 | 17 | /** 18 | Returns the caller of @c CreateWindow or @c CreateWindowEx. 19 | 20 | @pre The @c lpParam formal parameter of @c CreateWindow or 21 | @c CreateWindowEx should be initialized to @c this and 22 | @c this should point to an instance of type @a CallerT. 23 | @tparam CallerT 24 | The caller type. 25 | @param[in] window 26 | A handle to the window. 27 | @param[in] message 28 | The message. 29 | @param[in] wParam 30 | Additional message-specific information. 31 | @param[in] lParam 32 | Additional message-specific information. 33 | @return A pointer to the caller of @c CreateWindow or 34 | @c CreateWindowEx. 35 | */ 36 | template< typename CallerT > 37 | [[nodiscard]] 38 | CallerT* GetWindowCaller(NotNull< HWND > window, 39 | UINT message, 40 | [[maybe_unused]] WPARAM wParam, 41 | LPARAM lParam) noexcept; 42 | 43 | /** 44 | Returns the caller of @c DialogBoxParam. 45 | 46 | @pre The @c lParam formal parameter of @c DialogBoxParam should 47 | be initialized to @c this and @c this should point to an 48 | instance of type @a CallerT. 49 | @tparam CallerT 50 | The caller type. 51 | @param[in] dialog 52 | A handle to the dialog box. 53 | @param[in] message 54 | The message. 55 | @param[in] wParam 56 | Additional message-specific information. 57 | @param[in] lParam 58 | Additional message-specific information. 59 | @return A pointer to the caller of @c DialogBoxParam. 60 | */ 61 | template< typename CallerT > 62 | [[nodiscard]] 63 | CallerT* GetDialogCaller(NotNull< HWND > dialog, 64 | UINT message, 65 | [[maybe_unused]] WPARAM wParam, 66 | LPARAM lParam) noexcept; 67 | } 68 | 69 | //----------------------------------------------------------------------------- 70 | // Engine Includes 71 | //----------------------------------------------------------------------------- 72 | #pragma region 73 | 74 | #include "platform\windows_utils.tpp" 75 | 76 | #pragma endregion -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/platform/windows_utils.tpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Definitions 5 | //----------------------------------------------------------------------------- 6 | namespace mage { 7 | 8 | template< typename CallerT > 9 | [[nodiscard]] 10 | CallerT* GetWindowCaller(NotNull< HWND > window, 11 | UINT message, 12 | [[maybe_unused]] WPARAM wParam, 13 | LPARAM lParam) noexcept { 14 | 15 | if (WM_NCCREATE != message) { 16 | // Retrieve user data information about the window. 17 | return reinterpret_cast< CallerT* >( 18 | GetWindowLongPtr(window, GWLP_USERDATA)); 19 | } 20 | 21 | const auto caller = reinterpret_cast< CallerT* >( 22 | reinterpret_cast< CREATESTRUCT* >(lParam)->lpCreateParams); 23 | 24 | // Change the user data attribute of the window. 25 | SetWindowLongPtr(window, GWLP_USERDATA, 26 | reinterpret_cast< LONG_PTR >(caller)); 27 | 28 | return caller; 29 | } 30 | 31 | template< typename CallerT > 32 | [[nodiscard]] 33 | CallerT* GetDialogCaller(NotNull< HWND > dialog, 34 | UINT message, 35 | [[maybe_unused]] WPARAM wParam, 36 | LPARAM lParam) noexcept { 37 | 38 | if (WM_INITDIALOG != message) { 39 | // Retrieve user data information about the window. 40 | return reinterpret_cast< CallerT* >( 41 | GetWindowLongPtr(dialog, GWLP_USERDATA)); 42 | } 43 | 44 | const auto caller = reinterpret_cast< CallerT* >(lParam); 45 | 46 | // Changes the user data attribute of the window. 47 | SetWindowLongPtr(dialog, GWLP_USERDATA, 48 | reinterpret_cast< LONG_PTR >(caller)); 49 | 50 | return caller; 51 | } 52 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/string/format.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "string\formats.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // Engine Declarations 14 | //----------------------------------------------------------------------------- 15 | namespace mage { 16 | 17 | template< typename StringT, typename... ArgsT > 18 | [[nodiscard]] 19 | const auto Format(const StringT& format_str, const ArgsT&... args); 20 | 21 | template< typename... ArgsT > 22 | void Print(std::string_view format_str, const ArgsT&... args); 23 | 24 | template< typename... ArgsT > 25 | void Print(std::wstring_view format_str, const ArgsT&... args); 26 | 27 | template< typename OutputIt, typename... ArgsT > 28 | OutputIt AppendWrite(OutputIt it, 29 | std::string_view format_str, const ArgsT&... args); 30 | 31 | template< typename OutputIt, typename... ArgsT > 32 | OutputIt AppendWrite(OutputIt it, 33 | std::wstring_view format_str, const ArgsT&... args); 34 | 35 | template< typename OutputIt, typename... ArgsT > 36 | OutputIt AppendWrite(OutputIt it, std::size_t length, 37 | std::string_view format_str, const ArgsT&... args); 38 | 39 | template< typename OutputIt, typename... ArgsT > 40 | OutputIt AppendWrite(OutputIt it, std::size_t length, 41 | std::wstring_view format_str, const ArgsT&... args); 42 | 43 | template< typename... ArgsT > 44 | void WriteTo(NotNull< std::FILE* > stream, 45 | std::string_view format_str, const ArgsT&... args); 46 | 47 | template< typename... ArgsT > 48 | void WriteTo(NotNull< std::FILE* > stream, 49 | std::wstring_view format_str, const ArgsT&... args); 50 | 51 | template< typename... ArgsT > 52 | void WriteTo(NotNull< zstring > buffer, std::size_t length, 53 | std::string_view format_str, const ArgsT&... args); 54 | 55 | template< typename... ArgsT > 56 | void WriteTo(NotNull< wzstring > buffer, std::size_t length, 57 | std::wstring_view format_str, const ArgsT&... args); 58 | 59 | template< std::size_t N, typename... ArgsT > 60 | void WriteTo(char (&buffer)[N], 61 | std::string_view format_str, const ArgsT&... args); 62 | 63 | template< std::size_t N, typename... ArgsT > 64 | void WriteTo(wchar_t (&buffer)[N], 65 | std::wstring_view format_str, const ArgsT&... args); 66 | } 67 | 68 | //----------------------------------------------------------------------------- 69 | // Engine Includes 70 | //----------------------------------------------------------------------------- 71 | #pragma region 72 | 73 | #include "string\format.tpp" 74 | 75 | #pragma endregion -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/string/format.tpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Definitions 5 | //----------------------------------------------------------------------------- 6 | namespace mage { 7 | 8 | template< typename StringT, typename... ArgsT > 9 | [[nodiscard]] 10 | inline const auto Format(const StringT& format_str, const ArgsT&... args) { 11 | return fmt::format(format_str, args...); 12 | } 13 | 14 | template< typename... ArgsT > 15 | inline void Print(std::string_view format_str, const ArgsT&... args) { 16 | return fmt::print(format_str, args...); 17 | } 18 | 19 | template< typename... ArgsT > 20 | inline void Print(std::wstring_view format_str, const ArgsT&... args) { 21 | return fmt::print(format_str, args...); 22 | } 23 | 24 | template< typename OutputIt, typename... ArgsT > 25 | inline OutputIt AppendWrite(OutputIt it, 26 | std::string_view format_str, const ArgsT&... args) { 27 | 28 | return fmt::format_to(it, format_str, args...); 29 | } 30 | 31 | template< typename OutputIt, typename... ArgsT > 32 | inline OutputIt AppendWrite(OutputIt it, 33 | std::wstring_view format_str, const ArgsT&... args) { 34 | 35 | return fmt::format_to(it, format_str, args...); 36 | } 37 | 38 | template< typename OutputIt, typename... ArgsT > 39 | inline OutputIt AppendWrite(OutputIt it, std::size_t length, 40 | std::string_view format_str, const ArgsT&... args) { 41 | 42 | return fmt::format_to_n(it, length, format_str, args...).out; 43 | } 44 | 45 | template< typename OutputIt, typename... ArgsT > 46 | inline OutputIt AppendWrite(OutputIt it, std::size_t length, 47 | std::wstring_view format_str, const ArgsT&... args) { 48 | 49 | return fmt::format_to_n(it, length, format_str, args...).out; 50 | } 51 | 52 | template< typename... ArgsT > 53 | inline void WriteTo(NotNull< std::FILE* > stream, 54 | std::string_view format_str, const ArgsT&... args) { 55 | 56 | fmt::print(stream, format_str, args...); 57 | } 58 | 59 | template< typename... ArgsT > 60 | inline void WriteTo(NotNull< std::FILE* > stream, 61 | std::wstring_view format_str, const ArgsT&... args) { 62 | 63 | fmt::print(stream, format_str, args...); 64 | } 65 | 66 | template< typename... ArgsT > 67 | inline void WriteTo(NotNull< zstring > buffer, std::size_t length, 68 | std::string_view format_str, const ArgsT&... args) { 69 | 70 | if (0u == length) { 71 | return; 72 | } 73 | 74 | char* const begin = buffer; 75 | char* const end = AppendWrite(begin, length - 1u, format_str, args...); 76 | *end = '\0'; 77 | } 78 | 79 | template< typename... ArgsT > 80 | inline void WriteTo(NotNull< wzstring > buffer, std::size_t length, 81 | std::wstring_view format_str, const ArgsT&... args) { 82 | 83 | if (0u == length) { 84 | return; 85 | } 86 | 87 | wchar_t* const begin = buffer; 88 | wchar_t* const end = AppendWrite(begin, length - 1u, format_str, args...); 89 | *end = L'\0'; 90 | } 91 | 92 | template< std::size_t N, typename... ArgsT > 93 | inline void WriteTo(char (&buffer)[N], 94 | std::string_view format_str, const ArgsT&... args) { 95 | 96 | WriteTo(NotNull< zstring >(buffer), N, format_str, args...); 97 | } 98 | 99 | template< std::size_t N, typename... ArgsT > 100 | inline void WriteTo(wchar_t (&buffer)[N], 101 | std::wstring_view format_str, const ArgsT&... args) { 102 | 103 | WriteTo(NotNull< wzstring >(buffer), N, format_str, args...); 104 | } 105 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/string/string.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // System Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #pragma endregion 14 | 15 | //----------------------------------------------------------------------------- 16 | // Type Declarations and Definitions 17 | //----------------------------------------------------------------------------- 18 | namespace mage { 19 | 20 | using zstring = gsl::zstring<>; 21 | using wzstring = gsl::wzstring<>; 22 | using const_zstring = gsl::czstring<>; 23 | using const_wzstring = gsl::cwzstring<>; 24 | 25 | /** 26 | A type for representing not-null values. 27 | */ 28 | template< typename T > 29 | using NotNull = gsl::not_null< T >; 30 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/string/string_utils.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Engine Includes 3 | //----------------------------------------------------------------------------- 4 | #pragma region 5 | 6 | #include "string\string_utils.hpp" 7 | 8 | #pragma endregion 9 | 10 | //----------------------------------------------------------------------------- 11 | // System Includes 12 | //----------------------------------------------------------------------------- 13 | #pragma region 14 | 15 | #include 16 | 17 | #pragma endregion 18 | 19 | //----------------------------------------------------------------------------- 20 | // Engine Definitions 21 | //----------------------------------------------------------------------------- 22 | namespace mage { 23 | 24 | DWORD UTF8toUTF16::Convert(std::string_view s) { 25 | if (static_cast< std::size_t >(std::numeric_limits< int >::max()) < s.size()) { 26 | return ERROR_INVALID_PARAMETER; 27 | } 28 | const auto s_size = static_cast< int >(s.size()); 29 | 30 | if (0 == s_size) { 31 | m_buffer.resize(1u); 32 | return 0u; 33 | } 34 | 35 | const int required_size = MultiByteToWideChar( 36 | CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), s_size, nullptr, 0); 37 | if (0 == required_size) { 38 | return GetLastError(); 39 | } 40 | 41 | m_buffer.resize(static_cast< std::size_t >(required_size) + 1u); 42 | 43 | const int written_size = MultiByteToWideChar( 44 | CP_UTF8, MB_ERR_INVALID_CHARS, s.data(), s_size, m_buffer.data(), required_size); 45 | if (0 == written_size) { 46 | return GetLastError(); 47 | } 48 | 49 | return 0u; 50 | } 51 | 52 | DWORD UTF16toUTF8::Convert(std::wstring_view s) { 53 | if (static_cast< std::size_t >(std::numeric_limits< int >::max()) < s.size()) { 54 | return ERROR_INVALID_PARAMETER; 55 | } 56 | const auto s_size = static_cast< int >(s.size()); 57 | 58 | if (0 == s_size) { 59 | m_buffer.resize(1u); 60 | return 0u; 61 | } 62 | 63 | const int required_size = WideCharToMultiByte( 64 | CP_UTF8, 0u, s.data(), s_size, nullptr, 0, nullptr, nullptr); 65 | if (0 == required_size) { 66 | return GetLastError(); 67 | } 68 | 69 | m_buffer.resize(static_cast< std::size_t >(required_size) + 1u); 70 | 71 | const int written_size = WideCharToMultiByte( 72 | CP_UTF8, 0u, s.data(), s_size, m_buffer.data(), required_size, nullptr, nullptr); 73 | if (0 == written_size) { 74 | return GetLastError(); 75 | } 76 | 77 | return 0u; 78 | } 79 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/string/string_utils.tpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Definitions 5 | //----------------------------------------------------------------------------- 6 | namespace mage { 7 | 8 | template< typename T > 9 | [[nodiscard]] 10 | inline const std::optional< T > StringTo(std::string_view str) noexcept { 11 | using std::from_chars; 12 | 13 | const char* const first = str.data(); 14 | const char* const last = str.data() + str.size(); 15 | T result = {}; 16 | const auto [ptr, error_code] = from_chars(first, last, result); 17 | 18 | if (last != ptr 19 | || std::errc::invalid_argument == error_code 20 | || std::errc::result_out_of_range == error_code) { 21 | 22 | return {}; 23 | } 24 | else { 25 | return result; 26 | } 27 | } 28 | 29 | template<> 30 | [[nodiscard]] 31 | inline const std::optional< bool > StringTo(std::string_view str) noexcept { 32 | if ("true" == str) { 33 | return true; 34 | } 35 | if ("false" == str) { 36 | return false; 37 | } 38 | 39 | return {}; 40 | } 41 | 42 | template< typename T > 43 | [[nodiscard]] 44 | inline const std::optional< T > StringPrefixTo(std::string_view str) noexcept { 45 | using std::from_chars; 46 | 47 | const char* const first = str.data(); 48 | const char* const last = str.data() + str.size(); 49 | T result = {}; 50 | const auto [ptr, error_code] = from_chars(first, last, result); 51 | 52 | if (first == ptr 53 | || std::errc::invalid_argument == error_code 54 | || std::errc::result_out_of_range == error_code) { 55 | 56 | return {}; 57 | } 58 | else { 59 | return result; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/system/cpu_monitor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "system\timer.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // Engine Declarations and Definitions 14 | //----------------------------------------------------------------------------- 15 | namespace mage { 16 | 17 | /** 18 | A class of CPU monitors for monitoring CPU usage. 19 | */ 20 | class CPUMonitor { 21 | 22 | public: 23 | 24 | //--------------------------------------------------------------------- 25 | // Constructors and Destructors 26 | //--------------------------------------------------------------------- 27 | 28 | /** 29 | Constructs a CPU monitor. 30 | */ 31 | CPUMonitor() noexcept = default; 32 | 33 | /** 34 | Constructs a CPU monitor from the given CPU monitor. 35 | 36 | @param[in] cpu_monitor 37 | A reference to the CPU monitor to copy. 38 | */ 39 | CPUMonitor(const CPUMonitor& cpu_monitor) noexcept = default; 40 | 41 | /** 42 | Constructs a CPU monitor by moving the given CPU monitor. 43 | 44 | @param[in] cpu_monitor 45 | A reference to the CPU monitor to move. 46 | */ 47 | CPUMonitor(CPUMonitor&& cpu_monitor) noexcept = default; 48 | 49 | /** 50 | Destructs this CPU monitor. 51 | */ 52 | ~CPUMonitor() = default; 53 | 54 | //--------------------------------------------------------------------- 55 | // Assignment Operators 56 | //--------------------------------------------------------------------- 57 | 58 | /** 59 | Copies the given CPU monitor to this CPU monitor. 60 | 61 | @param[in] cpu_monitor 62 | A reference to the CPU monitor to copy. 63 | @return A reference to the copy of the given CPU monitor (i.e. 64 | this CPU monitor). 65 | */ 66 | CPUMonitor& operator=(const CPUMonitor& cpu_monitor) noexcept = default; 67 | 68 | /** 69 | Moves the given CPU monitor to this CPU monitor. 70 | 71 | @param[in] cpu_monitor 72 | A reference to the CPU monitor to move. 73 | @return A reference to the moved CPU monitor (i.e. this CPU 74 | monitor). 75 | */ 76 | CPUMonitor& operator=(CPUMonitor&& cpu_monitor) noexcept = default; 77 | 78 | //--------------------------------------------------------------------- 79 | // Member Methods 80 | //--------------------------------------------------------------------- 81 | 82 | /** 83 | Starts this CPU monitor. 84 | */ 85 | void Start() noexcept { 86 | m_wall_clock_timer.Start(); 87 | m_core_clock_timer.Start(); 88 | } 89 | 90 | /** 91 | Stops this CPU monitor. 92 | */ 93 | void Stop() noexcept { 94 | m_wall_clock_timer.Stop(); 95 | m_core_clock_timer.Stop(); 96 | } 97 | 98 | /** 99 | Restarts this CPU monitor. 100 | */ 101 | void Restart() noexcept { 102 | m_wall_clock_timer.Restart(); 103 | m_core_clock_timer.Restart(); 104 | } 105 | 106 | /** 107 | Resumes this CPU monitor. 108 | */ 109 | void Resume() noexcept { 110 | m_wall_clock_timer.Resume(); 111 | m_core_clock_timer.Resume(); 112 | } 113 | 114 | /** 115 | Returns the CPU delta percentage of this CPU monitor's process. 116 | 117 | @return The CPU delta percentage of this CPU monitor's process. 118 | */ 119 | F64 GetCPUDeltaPercentage() noexcept { 120 | const auto wall_time = m_wall_clock_timer.GetDeltaTime(); 121 | const auto core_time = m_core_clock_timer.GetDeltaTime(); 122 | return 100.0 * (core_time / wall_time); 123 | } 124 | 125 | /** 126 | Returns the total CPU delta percentage of this CPU monitor's process. 127 | 128 | @return The total CPU delta percentage of this CPU monitor's 129 | process. 130 | */ 131 | F64 GetTotalCPUDeltaPercentage() noexcept { 132 | const auto wall_time = m_wall_clock_timer.GetTotalDeltaTime(); 133 | const auto core_time = m_core_clock_timer.GetTotalDeltaTime(); 134 | return 100.0 * (core_time / wall_time); 135 | } 136 | 137 | private: 138 | 139 | //--------------------------------------------------------------------- 140 | // Member Variables 141 | //--------------------------------------------------------------------- 142 | 143 | /** 144 | The wall clock timer of this CPU monitor. 145 | */ 146 | WallClockTimer m_wall_clock_timer; 147 | 148 | /** 149 | The core clock per core timer of this CPU monitor. 150 | */ 151 | CPUTimer m_core_clock_timer; 152 | }; 153 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/system/system_time.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "type\types.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // System Includes 14 | //----------------------------------------------------------------------------- 15 | #pragma region 16 | 17 | #include 18 | 19 | #pragma endregion 20 | 21 | //----------------------------------------------------------------------------- 22 | // Engine Declarations and Definitions 23 | //----------------------------------------------------------------------------- 24 | namespace mage { 25 | 26 | //------------------------------------------------------------------------- 27 | // System Time 28 | //------------------------------------------------------------------------- 29 | #pragma region 30 | 31 | /** 32 | Returns the current local system date as a string. 33 | 34 | @return The current local system date as a string. 35 | */ 36 | [[nodiscard]] 37 | const std::wstring GetLocalSystemDateAsString(); 38 | 39 | /** 40 | Returns the current local system time as a string. 41 | 42 | @return The current local system time as a string. 43 | */ 44 | [[nodiscard]] 45 | const std::wstring GetLocalSystemTimeAsString(); 46 | 47 | /** 48 | Returns the current local system date and time as a string. 49 | 50 | @return The current local system date and time as a string. 51 | */ 52 | [[nodiscard]] 53 | const std::wstring GetLocalSystemDateAndTimeAsString(); 54 | 55 | struct SystemClock { 56 | using rep = U64; 57 | using period = std::ratio< 1, 10'000'000 >; 58 | using duration = std::chrono::duration< rep, period >; 59 | using time_point = std::chrono::time_point< SystemClock >; 60 | 61 | static constexpr bool is_steady = true; 62 | 63 | [[nodiscard]] 64 | static const time_point now() noexcept; 65 | }; 66 | 67 | #pragma endregion 68 | 69 | //------------------------------------------------------------------------- 70 | // Core Time 71 | //------------------------------------------------------------------------- 72 | #pragma region 73 | 74 | struct CoreClock { 75 | using rep = U64; 76 | using period = std::ratio< 1, 10'000'000 >; 77 | using duration = std::chrono::duration< rep, period >; 78 | using time_point = std::chrono::time_point< CoreClock >; 79 | 80 | static constexpr bool is_steady = true; 81 | 82 | [[nodiscard]] 83 | static const time_point now() noexcept; 84 | }; 85 | 86 | struct KernelModeCoreClock { 87 | using rep = U64; 88 | using period = std::ratio< 1, 10'000'000 >; 89 | using duration = std::chrono::duration< rep, period >; 90 | using time_point = std::chrono::time_point< KernelModeCoreClock >; 91 | 92 | static constexpr bool is_steady = true; 93 | 94 | [[nodiscard]] 95 | static const time_point now() noexcept; 96 | }; 97 | 98 | struct UserModeCoreClock { 99 | using rep = U64; 100 | using period = std::ratio< 1, 10'000'000 >; 101 | using duration = std::chrono::duration< rep, period >; 102 | using time_point = std::chrono::time_point< UserModeCoreClock >; 103 | 104 | static constexpr bool is_steady = true; 105 | 106 | [[nodiscard]] 107 | static const time_point now() noexcept; 108 | }; 109 | 110 | struct CoreClockPerCore { 111 | using rep = U64; 112 | using period = std::ratio< 1, 10'000'000 >; 113 | using duration = std::chrono::duration< rep, period >; 114 | using time_point = std::chrono::time_point< CoreClockPerCore >; 115 | 116 | static constexpr bool is_steady = true; 117 | 118 | [[nodiscard]] 119 | static const time_point now() noexcept; 120 | }; 121 | 122 | struct KernelModeCoreClockPerCore { 123 | using rep = U64; 124 | using period = std::ratio< 1, 10'000'000 >; 125 | using duration = std::chrono::duration< rep, period >; 126 | using time_point = std::chrono::time_point< KernelModeCoreClockPerCore >; 127 | 128 | static constexpr bool is_steady = true; 129 | 130 | [[nodiscard]] 131 | static const time_point now() noexcept; 132 | }; 133 | 134 | struct UserModeCoreClockPerCore { 135 | using rep = U64; 136 | using period = std::ratio< 1, 10'000'000 >; 137 | using duration = std::chrono::duration< rep, period >; 138 | using time_point = std::chrono::time_point< UserModeCoreClockPerCore >; 139 | 140 | static constexpr bool is_steady = true; 141 | 142 | [[nodiscard]] 143 | static const time_point now() noexcept; 144 | }; 145 | 146 | #pragma endregion 147 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/system/system_usage.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Engine Includes 3 | //----------------------------------------------------------------------------- 4 | #pragma region 5 | 6 | #include "system\system_usage.hpp" 7 | 8 | #pragma endregion 9 | 10 | //----------------------------------------------------------------------------- 11 | // System Includes 12 | //----------------------------------------------------------------------------- 13 | #pragma region 14 | 15 | #include 16 | 17 | #pragma endregion 18 | 19 | //----------------------------------------------------------------------------- 20 | // Engine Definitions 21 | //----------------------------------------------------------------------------- 22 | namespace mage { 23 | 24 | [[nodiscard]] 25 | U64 GetVirtualMemoryUsage() noexcept { 26 | PROCESS_MEMORY_COUNTERS memory_stats = {}; 27 | const BOOL result = GetProcessMemoryInfo(GetCurrentProcess(), 28 | &memory_stats, 29 | sizeof(memory_stats)); 30 | 31 | return (FALSE == result) ? 0u 32 | : static_cast< U64 >(memory_stats.PagefileUsage); 33 | } 34 | 35 | [[nodiscard]] 36 | U64 GetPhysicalMemoryUsage() noexcept { 37 | PROCESS_MEMORY_COUNTERS memory_stats = {}; 38 | const BOOL result = GetProcessMemoryInfo(GetCurrentProcess(), 39 | &memory_stats, 40 | sizeof(memory_stats)); 41 | 42 | return (FALSE == result) ? 0u 43 | : static_cast< U64 >(memory_stats.WorkingSetSize); 44 | } 45 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/system/system_usage.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | #include "type\types.hpp" 9 | 10 | #pragma endregion 11 | 12 | //----------------------------------------------------------------------------- 13 | // Engine Declarations 14 | //----------------------------------------------------------------------------- 15 | namespace mage { 16 | 17 | /** 18 | Retrieves the total amount of memory (in bytes) that the memory manager 19 | has committed to the running process. 20 | 21 | @return If the retrieval fails, the return value is zero. To get 22 | extended error information, call GetLastError. 23 | @return If the retrieval succeeds, the total virtual memory usage 24 | of this process (in bytes). 25 | */ 26 | [[nodiscard]] 27 | U64 GetVirtualMemoryUsage() noexcept; 28 | 29 | /** 30 | Retrieves the current working set size (in bytes) of the running process. 31 | 32 | @return If the retrieval fails, the return value is zero. To get 33 | extended error information, call GetLastError. 34 | @return If the retrieval succeeds, the total physical memory usage 35 | of this process (in bytes). 36 | */ 37 | [[nodiscard]] 38 | U64 GetPhysicalMemoryUsage() noexcept; 39 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/system/timer.tpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Definitions 5 | //----------------------------------------------------------------------------- 6 | namespace mage { 7 | 8 | template< typename ClockT > 9 | Timer< ClockT >::Timer() noexcept 10 | : m_clock(), 11 | m_last_timestamp(TimeStamp::min()), 12 | m_delta_time(TimeInterval::zero()), 13 | m_total_delta_time(TimeInterval::zero()), 14 | m_running(false) {} 15 | 16 | template< typename ClockT > 17 | inline void Timer< ClockT >::Start() noexcept { 18 | if (m_running) { 19 | return; 20 | } 21 | 22 | m_running = true; 23 | ResetDeltaTime(); 24 | } 25 | 26 | template< typename ClockT > 27 | inline void Timer< ClockT >::Stop() noexcept { 28 | if (!m_running) { 29 | return; 30 | } 31 | 32 | m_running = false; 33 | UpdateDeltaTime(); 34 | } 35 | 36 | template< typename ClockT > 37 | inline void Timer< ClockT >::Restart() noexcept { 38 | m_running = false; 39 | Start(); 40 | } 41 | 42 | template< typename ClockT > 43 | inline void Timer< ClockT >::Resume() noexcept { 44 | if (m_running) { 45 | return; 46 | } 47 | 48 | m_running = true; 49 | m_last_timestamp = m_clock.now(); 50 | } 51 | 52 | template< typename ClockT > 53 | inline TimeIntervalSeconds Timer< ClockT >::GetDeltaTime() noexcept { 54 | if (m_running) { 55 | UpdateDeltaTime(); 56 | } 57 | 58 | return std::chrono::duration_cast< TimeIntervalSeconds >(m_delta_time); 59 | } 60 | 61 | template< typename ClockT > 62 | inline TimeIntervalSeconds Timer< ClockT >::GetTotalDeltaTime() noexcept { 63 | if (m_running) { 64 | UpdateDeltaTime(); 65 | } 66 | 67 | return std::chrono::duration_cast< TimeIntervalSeconds >(m_total_delta_time); 68 | } 69 | 70 | template< typename ClockT > 71 | inline const std::pair< TimeIntervalSeconds, TimeIntervalSeconds > 72 | Timer< ClockT >::GetTime() noexcept { 73 | 74 | if (m_running) { 75 | UpdateDeltaTime(); 76 | } 77 | 78 | return { 79 | std::chrono::duration_cast< TimeIntervalSeconds >(m_delta_time), 80 | std::chrono::duration_cast< TimeIntervalSeconds >(m_total_delta_time) 81 | }; 82 | } 83 | 84 | template< typename ClockT > 85 | inline void Timer< ClockT >::ResetDeltaTime() noexcept { 86 | // Resets the delta time of this timer. 87 | m_delta_time = TimeInterval::zero(); 88 | // Resets the total delta time of this timer. 89 | m_total_delta_time = TimeInterval::zero(); 90 | // Resets the last timestamp of this timer. 91 | m_last_timestamp = m_clock.now(); 92 | } 93 | 94 | template< typename ClockT > 95 | inline void Timer< ClockT >::UpdateDeltaTime() noexcept { 96 | // Get the current timestamp of this timer. 97 | const auto current_timestamp = m_clock.now(); 98 | 99 | // Updates the delta time of this timer. 100 | m_delta_time = current_timestamp - m_last_timestamp; 101 | // Updates the total delta time of this timer. 102 | m_total_delta_time += m_delta_time; 103 | // Updates the last timestamp of this timer. 104 | m_last_timestamp = current_timestamp; 105 | } 106 | } -------------------------------------------------------------------------------- /Projects/Common/MAGE/src/type/types.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //----------------------------------------------------------------------------- 4 | // Engine Includes 5 | //----------------------------------------------------------------------------- 6 | #pragma region 7 | 8 | // Scalar types. 9 | // Vector types. 10 | #include "type\vector_types.hpp" 11 | 12 | // Platform types. 13 | // Smart pointer types. 14 | #include "memory\memory.hpp" 15 | 16 | // String types. 17 | #include "string\string.hpp" 18 | 19 | #pragma endregion -------------------------------------------------------------------------------- /Projects/Common/Properties/x64_Debug.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(ProjectName)\bin\x64\$(Configuration)\ 7 | $(ProjectName)\tmp\x64\$(Configuration)\ 8 | $(ProjectName)\src\;$(VC_IncludePath);$(WindowsSDK_IncludePath); 9 | 10 | 11 | 12 | Level4 13 | true 14 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 15 | true 16 | stdcpplatest 17 | $(ProjectName)\doc\ 18 | Fast 19 | 20 | 21 | true 22 | Windows 23 | 24 | 25 | $(ProjectName)\doc\$(TargetName).xml 26 | 27 | 28 | -------------------------------------------------------------------------------- /Projects/Common/Properties/x64_Release.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(ProjectName)\bin\x64\$(Configuration)\ 7 | $(ProjectName)\tmp\x64\$(Configuration)\ 8 | $(ProjectName)\src\;$(VC_IncludePath);$(WindowsSDK_IncludePath); 9 | false 10 | 11 | 12 | 13 | Level4 14 | true 15 | Full 16 | AnySuitable 17 | true 18 | Speed 19 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 20 | true 21 | true 22 | stdcpplatest 23 | $(ProjectName)\doc\ 24 | Fast 25 | AdvancedVectorExtensions2 26 | 27 | 28 | true 29 | true 30 | true 31 | Windows 32 | 33 | 34 | $(ProjectName)\doc\$(TargetName).xml 35 | 36 | 37 | -------------------------------------------------------------------------------- /Projects/Common/Properties/x86_Debug.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(ProjectName)\bin\x86\$(Configuration)\ 7 | $(ProjectName)\tmp\x86\$(Configuration)\ 8 | $(ProjectName)\src\;$(VC_IncludePath);$(WindowsSDK_IncludePath); 9 | 10 | 11 | 12 | Level4 13 | true 14 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 15 | stdcpplatest 16 | $(ProjectName)\doc\ 17 | Fast 18 | true 19 | 20 | 21 | MachineX86 22 | 23 | 24 | true 25 | Windows 26 | 27 | 28 | $(ProjectName)\doc\$(TargetName).xml 29 | 30 | 31 | -------------------------------------------------------------------------------- /Projects/Common/Properties/x86_Release.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(ProjectName)\bin\x86\$(Configuration)\ 7 | $(ProjectName)\tmp\x86\$(Configuration)\ 8 | $(ProjectName)\src\;$(VC_IncludePath);$(WindowsSDK_IncludePath); 9 | false 10 | 11 | 12 | 13 | Level4 14 | true 15 | Full 16 | AnySuitable 17 | true 18 | Speed 19 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 20 | true 21 | true 22 | $(ProjectName)\doc\ 23 | stdcpplatest 24 | AdvancedVectorExtensions2 25 | Fast 26 | 27 | 28 | MachineX86 29 | 30 | 31 | true 32 | true 33 | true 34 | Windows 35 | 36 | 37 | $(ProjectName)\doc\$(TargetName).xml 38 | 39 | 40 | -------------------------------------------------------------------------------- /Projects/Common/fmt.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;tpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {a8e1fd8b-6c7e-47e6-aed8-99203088c0a6} 14 | 15 | 16 | {b52f0527-3189-4ae8-a08d-da76dfea2c5b} 17 | 18 | 19 | 20 | 21 | Header Files\fmt 22 | 23 | 24 | Header Files\fmt 25 | 26 | 27 | Header Files\fmt 28 | 29 | 30 | Header Files\fmt 31 | 32 | 33 | Header Files\fmt 34 | 35 | 36 | Header Files\fmt 37 | 38 | 39 | Header Files\fmt 40 | 41 | 42 | Header Files\fmt 43 | 44 | 45 | Header Files\fmt 46 | 47 | 48 | 49 | 50 | Source Files\fmt 51 | 52 | 53 | Source Files\fmt 54 | 55 | 56 | -------------------------------------------------------------------------------- /Projects/Common/fmt/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - 2016, Victor Zverovich 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /Projects/Common/fmt/src/fmt/format.cpp: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ 2 | // 3 | // Copyright (c) 2012 - 2016, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include "fmt/format-inl.h" 9 | 10 | FMT_BEGIN_NAMESPACE 11 | template struct internal::basic_data; 12 | 13 | // Explicit instantiations for char. 14 | 15 | template FMT_API char internal::thousands_sep(locale_provider *lp); 16 | 17 | template void internal::basic_buffer::append(const char *, const char *); 18 | 19 | template void basic_fixed_buffer::grow(std::size_t); 20 | 21 | template void internal::arg_map::init( 22 | const basic_format_args &args); 23 | 24 | template FMT_API int internal::char_traits::format_float( 25 | char *, std::size_t, const char *, int, double); 26 | 27 | template FMT_API int internal::char_traits::format_float( 28 | char *, std::size_t, const char *, int, long double); 29 | 30 | template FMT_API std::string internal::vformat( 31 | string_view, basic_format_args); 32 | 33 | // Explicit instantiations for wchar_t. 34 | 35 | template FMT_API wchar_t internal::thousands_sep(locale_provider *); 36 | 37 | template void internal::basic_buffer::append( 38 | const wchar_t *, const wchar_t *); 39 | 40 | template void basic_fixed_buffer::grow(std::size_t); 41 | 42 | template void internal::arg_map::init( 43 | const basic_format_args &); 44 | 45 | template FMT_API int internal::char_traits::format_float( 46 | wchar_t *, std::size_t, const wchar_t *, int, double); 47 | 48 | template FMT_API int internal::char_traits::format_float( 49 | wchar_t *, std::size_t, const wchar_t *, int, long double); 50 | 51 | template FMT_API std::wstring internal::vformat( 52 | wstring_view, basic_format_args); 53 | FMT_END_NAMESPACE 54 | -------------------------------------------------------------------------------- /Projects/Common/fmt/src/fmt/time.h: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - time formatting 2 | // 3 | // Copyright (c) 2012 - 2016, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #ifndef FMT_TIME_H_ 9 | #define FMT_TIME_H_ 10 | 11 | #include "format.h" 12 | #include 13 | 14 | FMT_BEGIN_NAMESPACE 15 | 16 | // Prevents expansion of a preceding token as a function-style macro. 17 | // Usage: f FMT_NOMACRO() 18 | #define FMT_NOMACRO 19 | 20 | namespace internal{ 21 | inline null<> localtime_r FMT_NOMACRO(...) { return null<>(); } 22 | inline null<> localtime_s(...) { return null<>(); } 23 | inline null<> gmtime_r(...) { return null<>(); } 24 | inline null<> gmtime_s(...) { return null<>(); } 25 | } 26 | 27 | // Thread-safe replacement for std::localtime 28 | inline std::tm localtime(std::time_t time) { 29 | struct dispatcher { 30 | std::time_t time_; 31 | std::tm tm_; 32 | 33 | dispatcher(std::time_t t): time_(t) {} 34 | 35 | bool run() { 36 | using namespace fmt::internal; 37 | return handle(localtime_r(&time_, &tm_)); 38 | } 39 | 40 | bool handle(std::tm *tm) { return tm != FMT_NULL; } 41 | 42 | bool handle(internal::null<>) { 43 | using namespace fmt::internal; 44 | return fallback(localtime_s(&tm_, &time_)); 45 | } 46 | 47 | bool fallback(int res) { return res == 0; } 48 | 49 | bool fallback(internal::null<>) { 50 | using namespace fmt::internal; 51 | std::tm *tm = std::localtime(&time_); 52 | if (tm) tm_ = *tm; 53 | return tm != FMT_NULL; 54 | } 55 | }; 56 | dispatcher lt(time); 57 | if (lt.run()) 58 | return lt.tm_; 59 | // Too big time values may be unsupported. 60 | FMT_THROW(format_error("time_t value out of range")); 61 | } 62 | 63 | // Thread-safe replacement for std::gmtime 64 | inline std::tm gmtime(std::time_t time) { 65 | struct dispatcher { 66 | std::time_t time_; 67 | std::tm tm_; 68 | 69 | dispatcher(std::time_t t): time_(t) {} 70 | 71 | bool run() { 72 | using namespace fmt::internal; 73 | return handle(gmtime_r(&time_, &tm_)); 74 | } 75 | 76 | bool handle(std::tm *tm) { return tm != FMT_NULL; } 77 | 78 | bool handle(internal::null<>) { 79 | using namespace fmt::internal; 80 | return fallback(gmtime_s(&tm_, &time_)); 81 | } 82 | 83 | bool fallback(int res) { return res == 0; } 84 | 85 | bool fallback(internal::null<>) { 86 | std::tm *tm = std::gmtime(&time_); 87 | if (tm) tm_ = *tm; 88 | return tm != FMT_NULL; 89 | } 90 | }; 91 | dispatcher gt(time); 92 | if (gt.run()) 93 | return gt.tm_; 94 | // Too big time values may be unsupported. 95 | FMT_THROW(format_error("time_t value out of range")); 96 | } 97 | 98 | namespace internal { 99 | inline std::size_t strftime(char *str, std::size_t count, const char *format, 100 | const std::tm *time) { 101 | return std::strftime(str, count, format, time); 102 | } 103 | 104 | inline std::size_t strftime(wchar_t *str, std::size_t count, 105 | const wchar_t *format, const std::tm *time) { 106 | return std::wcsftime(str, count, format, time); 107 | } 108 | } 109 | 110 | template 111 | struct formatter { 112 | template 113 | auto parse(ParseContext &ctx) -> decltype(ctx.begin()) { 114 | auto it = internal::null_terminating_iterator(ctx); 115 | if (*it == ':') 116 | ++it; 117 | auto end = it; 118 | while (*end && *end != '}') 119 | ++end; 120 | tm_format.reserve(end - it + 1); 121 | using internal::pointer_from; 122 | tm_format.append(pointer_from(it), pointer_from(end)); 123 | tm_format.push_back('\0'); 124 | return pointer_from(end); 125 | } 126 | 127 | template 128 | auto format(const std::tm &tm, FormatContext &ctx) -> decltype(ctx.out()) { 129 | internal::basic_buffer &buf = internal::get_container(ctx.out()); 130 | std::size_t start = buf.size(); 131 | for (;;) { 132 | std::size_t size = buf.capacity() - start; 133 | std::size_t count = 134 | internal::strftime(&buf[start], size, &tm_format[0], &tm); 135 | if (count != 0) { 136 | buf.resize(start + count); 137 | break; 138 | } 139 | if (size >= tm_format.size() * 256) { 140 | // If the buffer is 256 times larger than the format string, assume 141 | // that `strftime` gives an empty result. There doesn't seem to be a 142 | // better way to distinguish the two cases: 143 | // https://github.com/fmtlib/fmt/issues/367 144 | break; 145 | } 146 | const std::size_t MIN_GROWTH = 10; 147 | buf.reserve(buf.capacity() + (size > MIN_GROWTH ? size : MIN_GROWTH)); 148 | } 149 | return ctx.out(); 150 | } 151 | 152 | basic_memory_buffer tm_format; 153 | }; 154 | FMT_END_NAMESPACE 155 | 156 | #endif // FMT_TIME_H_ 157 | -------------------------------------------------------------------------------- /Projects/Project1/Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28803.156 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo.vcxproj", "{F9BA8891-AC7F-48A8-9005-CD8C73706D59}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {54FB0635-3B8A-459A-9739-64D306953FE1} = {54FB0635-3B8A-459A-9739-64D306953FE1} 9 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} = {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} 10 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 11 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmt", "..\Common\fmt.vcxproj", "{7C0476A5-5582-4DA2-85CF-1876028A7482}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "..\Common\DirectXTex.vcxproj", "{54FB0635-3B8A-459A-9739-64D306953FE1}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImGui", "..\Common\ImGui.vcxproj", "{F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}" 19 | ProjectSection(ProjectDependencies) = postProject 20 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 21 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 22 | EndProjectSection 23 | EndProject 24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MAGE", "..\Common\MAGE.vcxproj", "{529BD7A2-F3E9-4EF7-878F-C469506CFA3F}" 25 | ProjectSection(ProjectDependencies) = postProject 26 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 27 | EndProjectSection 28 | EndProject 29 | Global 30 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 31 | Debug|x64 = Debug|x64 32 | Debug|x86 = Debug|x86 33 | Release|x64 = Release|x64 34 | Release|x86 = Release|x86 35 | EndGlobalSection 36 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 37 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.ActiveCfg = Debug|x64 38 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.Build.0 = Debug|x64 39 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.ActiveCfg = Debug|Win32 40 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.Build.0 = Debug|Win32 41 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.ActiveCfg = Release|x64 42 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.Build.0 = Release|x64 43 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.ActiveCfg = Release|Win32 44 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.Build.0 = Release|Win32 45 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.ActiveCfg = Debug|x64 46 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.Build.0 = Debug|x64 47 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.ActiveCfg = Debug|Win32 48 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.Build.0 = Debug|Win32 49 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.ActiveCfg = Release|x64 50 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.Build.0 = Release|x64 51 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.ActiveCfg = Release|Win32 52 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.Build.0 = Release|Win32 53 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.ActiveCfg = Debug|x64 54 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.Build.0 = Debug|x64 55 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.ActiveCfg = Debug|Win32 56 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.Build.0 = Debug|Win32 57 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.ActiveCfg = Release|x64 58 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.Build.0 = Release|x64 59 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.ActiveCfg = Release|Win32 60 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.Build.0 = Release|Win32 61 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.ActiveCfg = Debug|x64 62 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.Build.0 = Debug|x64 63 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.ActiveCfg = Debug|Win32 64 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.Build.0 = Debug|Win32 65 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.ActiveCfg = Release|x64 66 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.Build.0 = Release|x64 67 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.ActiveCfg = Release|Win32 68 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.Build.0 = Release|Win32 69 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.ActiveCfg = Debug|x64 70 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.Build.0 = Debug|x64 71 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.ActiveCfg = Debug|Win32 72 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.Build.0 = Debug|Win32 73 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.ActiveCfg = Release|x64 74 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.Build.0 = Release|x64 75 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.ActiveCfg = Release|Win32 76 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.Build.0 = Release|Win32 77 | EndGlobalSection 78 | GlobalSection(SolutionProperties) = preSolution 79 | HideSolutionNode = FALSE 80 | EndGlobalSection 81 | GlobalSection(ExtensibilityGlobals) = postSolution 82 | SolutionGuid = {4ACF3D7D-30D3-440E-90E8-3F4F5AF65C6A} 83 | EndGlobalSection 84 | EndGlobal 85 | -------------------------------------------------------------------------------- /Projects/Project1/Demo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;tpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Projects/Project1/Demo/src/demo.cpp: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // Includes 3 | //----------------------------------------------------------------------------- 4 | #pragma region 5 | 6 | #include 7 | #include "exception\exception.hpp" 8 | #include "logging\dump.hpp" 9 | #include "ui\window.hpp" 10 | 11 | #pragma endregion 12 | 13 | //----------------------------------------------------------------------------- 14 | // Declarations and Definitions 15 | //----------------------------------------------------------------------------- 16 | using namespace mage; 17 | 18 | namespace { 19 | 20 | constexpr U32x2 g_display_resolution = { 800u, 600u }; 21 | UniquePtr< Window > g_window; 22 | 23 | void Init(NotNull< HINSTANCE > instance) { 24 | #ifdef _DEBUG 25 | const int debug_flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); 26 | // Perform automatic leak checking at program exit through a call to 27 | // _CrtDumpMemoryLeaks and generate an error report if the application 28 | // failed to free all the memory it allocated. 29 | _CrtSetDbgFlag(debug_flags | _CRTDBG_LEAK_CHECK_DF); 30 | #endif 31 | 32 | // Add filter for unhandled exceptions. 33 | AddUnhandledExceptionFilter(); 34 | 35 | // Initialize a console. 36 | InitializeConsole(); 37 | Print("Copyright (c) 2016 Matthias Moulin.\n"); 38 | 39 | // Initialize a window. 40 | { 41 | auto window_desc = MakeShared< WindowDescriptor >(instance, L"Demo"); 42 | g_window = MakeUnique< Window >(std::move(window_desc), 43 | L"Demo", 44 | g_display_resolution); 45 | } 46 | } 47 | 48 | [[nodiscard]] 49 | int Run(int nCmdShow) { 50 | // Show the main window. 51 | g_window->Show(nCmdShow); 52 | 53 | // Enter the message loop. 54 | MSG msg; 55 | SecureZeroMemory(&msg, sizeof(msg)); 56 | while (WM_QUIT != msg.message) { 57 | 58 | // Retrieves messages for any window that belongs to the current 59 | // thread without performing range filtering. Furthermore messages 60 | // are removed after processing. 61 | if (PeekMessage(&msg, nullptr, 0u, 0u, PM_REMOVE)) { 62 | // Translates virtual-key messages into character messages. 63 | TranslateMessage(&msg); 64 | // Dispatches a message to a window procedure. 65 | DispatchMessage(&msg); 66 | continue; 67 | } 68 | 69 | // Nothing useful yet. 70 | } 71 | 72 | return static_cast< int >(msg.wParam); 73 | } 74 | } 75 | 76 | int WINAPI WinMain(_In_ HINSTANCE instance, 77 | _In_opt_ [[maybe_unused]] HINSTANCE prev_instance, 78 | _In_ [[maybe_unused]] LPSTR lpCmdLine, 79 | _In_ int nCmdShow) { 80 | 81 | Init(NotNull< HINSTANCE >(instance)); 82 | return Run(nCmdShow); 83 | } 84 | -------------------------------------------------------------------------------- /Projects/Project2/Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28803.156 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo.vcxproj", "{F9BA8891-AC7F-48A8-9005-CD8C73706D59}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {54FB0635-3B8A-459A-9739-64D306953FE1} = {54FB0635-3B8A-459A-9739-64D306953FE1} 9 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} = {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} 10 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 11 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmt", "..\Common\fmt.vcxproj", "{7C0476A5-5582-4DA2-85CF-1876028A7482}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "..\Common\DirectXTex.vcxproj", "{54FB0635-3B8A-459A-9739-64D306953FE1}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImGui", "..\Common\ImGui.vcxproj", "{F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}" 19 | ProjectSection(ProjectDependencies) = postProject 20 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 21 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 22 | EndProjectSection 23 | EndProject 24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MAGE", "..\Common\MAGE.vcxproj", "{529BD7A2-F3E9-4EF7-878F-C469506CFA3F}" 25 | ProjectSection(ProjectDependencies) = postProject 26 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 27 | EndProjectSection 28 | EndProject 29 | Global 30 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 31 | Debug|x64 = Debug|x64 32 | Debug|x86 = Debug|x86 33 | Release|x64 = Release|x64 34 | Release|x86 = Release|x86 35 | EndGlobalSection 36 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 37 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.ActiveCfg = Debug|x64 38 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.Build.0 = Debug|x64 39 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.ActiveCfg = Debug|Win32 40 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.Build.0 = Debug|Win32 41 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.ActiveCfg = Release|x64 42 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.Build.0 = Release|x64 43 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.ActiveCfg = Release|Win32 44 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.Build.0 = Release|Win32 45 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.ActiveCfg = Debug|x64 46 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.Build.0 = Debug|x64 47 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.ActiveCfg = Debug|Win32 48 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.Build.0 = Debug|Win32 49 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.ActiveCfg = Release|x64 50 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.Build.0 = Release|x64 51 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.ActiveCfg = Release|Win32 52 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.Build.0 = Release|Win32 53 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.ActiveCfg = Debug|x64 54 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.Build.0 = Debug|x64 55 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.ActiveCfg = Debug|Win32 56 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.Build.0 = Debug|Win32 57 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.ActiveCfg = Release|x64 58 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.Build.0 = Release|x64 59 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.ActiveCfg = Release|Win32 60 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.Build.0 = Release|Win32 61 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.ActiveCfg = Debug|x64 62 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.Build.0 = Debug|x64 63 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.ActiveCfg = Debug|Win32 64 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.Build.0 = Debug|Win32 65 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.ActiveCfg = Release|x64 66 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.Build.0 = Release|x64 67 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.ActiveCfg = Release|Win32 68 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.Build.0 = Release|Win32 69 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.ActiveCfg = Debug|x64 70 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.Build.0 = Debug|x64 71 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.ActiveCfg = Debug|Win32 72 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.Build.0 = Debug|Win32 73 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.ActiveCfg = Release|x64 74 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.Build.0 = Release|x64 75 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.ActiveCfg = Release|Win32 76 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.Build.0 = Release|Win32 77 | EndGlobalSection 78 | GlobalSection(SolutionProperties) = preSolution 79 | HideSolutionNode = FALSE 80 | EndGlobalSection 81 | GlobalSection(ExtensibilityGlobals) = postSolution 82 | SolutionGuid = {4ACF3D7D-30D3-440E-90E8-3F4F5AF65C6A} 83 | EndGlobalSection 84 | EndGlobal 85 | -------------------------------------------------------------------------------- /Projects/Project2/Demo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;tpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Projects/Project3/Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28803.156 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo.vcxproj", "{F9BA8891-AC7F-48A8-9005-CD8C73706D59}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {54FB0635-3B8A-459A-9739-64D306953FE1} = {54FB0635-3B8A-459A-9739-64D306953FE1} 9 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} = {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} 10 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 11 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmt", "..\Common\fmt.vcxproj", "{7C0476A5-5582-4DA2-85CF-1876028A7482}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "..\Common\DirectXTex.vcxproj", "{54FB0635-3B8A-459A-9739-64D306953FE1}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImGui", "..\Common\ImGui.vcxproj", "{F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}" 19 | ProjectSection(ProjectDependencies) = postProject 20 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 21 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 22 | EndProjectSection 23 | EndProject 24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MAGE", "..\Common\MAGE.vcxproj", "{529BD7A2-F3E9-4EF7-878F-C469506CFA3F}" 25 | ProjectSection(ProjectDependencies) = postProject 26 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 27 | EndProjectSection 28 | EndProject 29 | Global 30 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 31 | Debug|x64 = Debug|x64 32 | Debug|x86 = Debug|x86 33 | Release|x64 = Release|x64 34 | Release|x86 = Release|x86 35 | EndGlobalSection 36 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 37 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.ActiveCfg = Debug|x64 38 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.Build.0 = Debug|x64 39 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.ActiveCfg = Debug|Win32 40 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.Build.0 = Debug|Win32 41 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.ActiveCfg = Release|x64 42 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.Build.0 = Release|x64 43 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.ActiveCfg = Release|Win32 44 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.Build.0 = Release|Win32 45 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.ActiveCfg = Debug|x64 46 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.Build.0 = Debug|x64 47 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.ActiveCfg = Debug|Win32 48 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.Build.0 = Debug|Win32 49 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.ActiveCfg = Release|x64 50 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.Build.0 = Release|x64 51 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.ActiveCfg = Release|Win32 52 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.Build.0 = Release|Win32 53 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.ActiveCfg = Debug|x64 54 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.Build.0 = Debug|x64 55 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.ActiveCfg = Debug|Win32 56 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.Build.0 = Debug|Win32 57 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.ActiveCfg = Release|x64 58 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.Build.0 = Release|x64 59 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.ActiveCfg = Release|Win32 60 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.Build.0 = Release|Win32 61 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.ActiveCfg = Debug|x64 62 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.Build.0 = Debug|x64 63 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.ActiveCfg = Debug|Win32 64 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.Build.0 = Debug|Win32 65 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.ActiveCfg = Release|x64 66 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.Build.0 = Release|x64 67 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.ActiveCfg = Release|Win32 68 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.Build.0 = Release|Win32 69 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.ActiveCfg = Debug|x64 70 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.Build.0 = Debug|x64 71 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.ActiveCfg = Debug|Win32 72 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.Build.0 = Debug|Win32 73 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.ActiveCfg = Release|x64 74 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.Build.0 = Release|x64 75 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.ActiveCfg = Release|Win32 76 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.Build.0 = Release|Win32 77 | EndGlobalSection 78 | GlobalSection(SolutionProperties) = preSolution 79 | HideSolutionNode = FALSE 80 | EndGlobalSection 81 | GlobalSection(ExtensibilityGlobals) = postSolution 82 | SolutionGuid = {4ACF3D7D-30D3-440E-90E8-3F4F5AF65C6A} 83 | EndGlobalSection 84 | EndGlobal 85 | -------------------------------------------------------------------------------- /Projects/Project3/Demo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;tpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {c409d954-b17f-4c9f-996a-7f840de4f401} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Shader Files 28 | 29 | 30 | Shader Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /Projects/Project3/Demo/shaders/PS.hlsl: -------------------------------------------------------------------------------- 1 | float4 PS(float4 p_viewport : SV_POSITION) : SV_Target { 2 | return float4(1.0f, 1.0f, 0.0f, 1.0f); 3 | } -------------------------------------------------------------------------------- /Projects/Project3/Demo/shaders/VS.hlsl: -------------------------------------------------------------------------------- 1 | float4 VS(float4 p_ndc : POSITION) : SV_POSITION { 2 | return p_ndc; 3 | } -------------------------------------------------------------------------------- /Projects/Project4/Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28803.156 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo.vcxproj", "{F9BA8891-AC7F-48A8-9005-CD8C73706D59}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {54FB0635-3B8A-459A-9739-64D306953FE1} = {54FB0635-3B8A-459A-9739-64D306953FE1} 9 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} = {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} 10 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 11 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmt", "..\Common\fmt.vcxproj", "{7C0476A5-5582-4DA2-85CF-1876028A7482}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "..\Common\DirectXTex.vcxproj", "{54FB0635-3B8A-459A-9739-64D306953FE1}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImGui", "..\Common\ImGui.vcxproj", "{F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}" 19 | ProjectSection(ProjectDependencies) = postProject 20 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 21 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 22 | EndProjectSection 23 | EndProject 24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MAGE", "..\Common\MAGE.vcxproj", "{529BD7A2-F3E9-4EF7-878F-C469506CFA3F}" 25 | ProjectSection(ProjectDependencies) = postProject 26 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 27 | EndProjectSection 28 | EndProject 29 | Global 30 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 31 | Debug|x64 = Debug|x64 32 | Debug|x86 = Debug|x86 33 | Release|x64 = Release|x64 34 | Release|x86 = Release|x86 35 | EndGlobalSection 36 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 37 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.ActiveCfg = Debug|x64 38 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.Build.0 = Debug|x64 39 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.ActiveCfg = Debug|Win32 40 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.Build.0 = Debug|Win32 41 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.ActiveCfg = Release|x64 42 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.Build.0 = Release|x64 43 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.ActiveCfg = Release|Win32 44 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.Build.0 = Release|Win32 45 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.ActiveCfg = Debug|x64 46 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.Build.0 = Debug|x64 47 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.ActiveCfg = Debug|Win32 48 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.Build.0 = Debug|Win32 49 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.ActiveCfg = Release|x64 50 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.Build.0 = Release|x64 51 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.ActiveCfg = Release|Win32 52 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.Build.0 = Release|Win32 53 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.ActiveCfg = Debug|x64 54 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.Build.0 = Debug|x64 55 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.ActiveCfg = Debug|Win32 56 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.Build.0 = Debug|Win32 57 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.ActiveCfg = Release|x64 58 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.Build.0 = Release|x64 59 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.ActiveCfg = Release|Win32 60 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.Build.0 = Release|Win32 61 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.ActiveCfg = Debug|x64 62 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.Build.0 = Debug|x64 63 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.ActiveCfg = Debug|Win32 64 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.Build.0 = Debug|Win32 65 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.ActiveCfg = Release|x64 66 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.Build.0 = Release|x64 67 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.ActiveCfg = Release|Win32 68 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.Build.0 = Release|Win32 69 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.ActiveCfg = Debug|x64 70 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.Build.0 = Debug|x64 71 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.ActiveCfg = Debug|Win32 72 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.Build.0 = Debug|Win32 73 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.ActiveCfg = Release|x64 74 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.Build.0 = Release|x64 75 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.ActiveCfg = Release|Win32 76 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.Build.0 = Release|Win32 77 | EndGlobalSection 78 | GlobalSection(SolutionProperties) = preSolution 79 | HideSolutionNode = FALSE 80 | EndGlobalSection 81 | GlobalSection(ExtensibilityGlobals) = postSolution 82 | SolutionGuid = {4ACF3D7D-30D3-440E-90E8-3F4F5AF65C6A} 83 | EndGlobalSection 84 | EndGlobal 85 | -------------------------------------------------------------------------------- /Projects/Project4/Demo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;tpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {c409d954-b17f-4c9f-996a-7f840de4f401} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Shader Files 28 | 29 | 30 | Shader Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /Projects/Project4/Demo/shaders/PS.hlsl: -------------------------------------------------------------------------------- 1 | struct PS_INPUT { 2 | float4 p_viewport : SV_POSITION; 3 | float4 color : COLOR0; 4 | }; 5 | 6 | float4 PS(PS_INPUT input) : SV_Target { 7 | return input.color; 8 | } -------------------------------------------------------------------------------- /Projects/Project4/Demo/shaders/VS.hlsl: -------------------------------------------------------------------------------- 1 | cbuffer Transform : register(b0) { 2 | float4x4 g_object_to_world : packoffset(c0); 3 | float4x4 g_world_to_camera : packoffset(c4); 4 | float4x4 g_camera_to_projection : packoffset(c8); 5 | } 6 | 7 | struct VS_INPUT { 8 | float4 p : POSITION; 9 | float4 color : COLOR0; 10 | }; 11 | 12 | struct VS_OUTPUT { 13 | float4 p : SV_POSITION; 14 | float4 color : COLOR0; 15 | }; 16 | 17 | VS_OUTPUT VS(VS_INPUT input) { 18 | VS_OUTPUT output; 19 | output.p = mul( input.p, g_object_to_world); 20 | output.p = mul(output.p, g_world_to_camera); 21 | output.p = mul(output.p, g_camera_to_projection); 22 | output.color = input.color; 23 | return output; 24 | } -------------------------------------------------------------------------------- /Projects/Project5/Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28803.156 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo.vcxproj", "{F9BA8891-AC7F-48A8-9005-CD8C73706D59}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {54FB0635-3B8A-459A-9739-64D306953FE1} = {54FB0635-3B8A-459A-9739-64D306953FE1} 9 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} = {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} 10 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 11 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmt", "..\Common\fmt.vcxproj", "{7C0476A5-5582-4DA2-85CF-1876028A7482}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "..\Common\DirectXTex.vcxproj", "{54FB0635-3B8A-459A-9739-64D306953FE1}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImGui", "..\Common\ImGui.vcxproj", "{F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}" 19 | ProjectSection(ProjectDependencies) = postProject 20 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 21 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 22 | EndProjectSection 23 | EndProject 24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MAGE", "..\Common\MAGE.vcxproj", "{529BD7A2-F3E9-4EF7-878F-C469506CFA3F}" 25 | ProjectSection(ProjectDependencies) = postProject 26 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 27 | EndProjectSection 28 | EndProject 29 | Global 30 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 31 | Debug|x64 = Debug|x64 32 | Debug|x86 = Debug|x86 33 | Release|x64 = Release|x64 34 | Release|x86 = Release|x86 35 | EndGlobalSection 36 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 37 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.ActiveCfg = Debug|x64 38 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.Build.0 = Debug|x64 39 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.ActiveCfg = Debug|Win32 40 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.Build.0 = Debug|Win32 41 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.ActiveCfg = Release|x64 42 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.Build.0 = Release|x64 43 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.ActiveCfg = Release|Win32 44 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.Build.0 = Release|Win32 45 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.ActiveCfg = Debug|x64 46 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.Build.0 = Debug|x64 47 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.ActiveCfg = Debug|Win32 48 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.Build.0 = Debug|Win32 49 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.ActiveCfg = Release|x64 50 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.Build.0 = Release|x64 51 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.ActiveCfg = Release|Win32 52 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.Build.0 = Release|Win32 53 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.ActiveCfg = Debug|x64 54 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.Build.0 = Debug|x64 55 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.ActiveCfg = Debug|Win32 56 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.Build.0 = Debug|Win32 57 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.ActiveCfg = Release|x64 58 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.Build.0 = Release|x64 59 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.ActiveCfg = Release|Win32 60 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.Build.0 = Release|Win32 61 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.ActiveCfg = Debug|x64 62 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.Build.0 = Debug|x64 63 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.ActiveCfg = Debug|Win32 64 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.Build.0 = Debug|Win32 65 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.ActiveCfg = Release|x64 66 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.Build.0 = Release|x64 67 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.ActiveCfg = Release|Win32 68 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.Build.0 = Release|Win32 69 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.ActiveCfg = Debug|x64 70 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.Build.0 = Debug|x64 71 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.ActiveCfg = Debug|Win32 72 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.Build.0 = Debug|Win32 73 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.ActiveCfg = Release|x64 74 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.Build.0 = Release|x64 75 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.ActiveCfg = Release|Win32 76 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.Build.0 = Release|Win32 77 | EndGlobalSection 78 | GlobalSection(SolutionProperties) = preSolution 79 | HideSolutionNode = FALSE 80 | EndGlobalSection 81 | GlobalSection(ExtensibilityGlobals) = postSolution 82 | SolutionGuid = {4ACF3D7D-30D3-440E-90E8-3F4F5AF65C6A} 83 | EndGlobalSection 84 | EndGlobal 85 | -------------------------------------------------------------------------------- /Projects/Project5/Demo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;tpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {c409d954-b17f-4c9f-996a-7f840de4f401} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Shader Files 28 | 29 | 30 | Shader Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /Projects/Project5/Demo/shaders/PS.hlsl: -------------------------------------------------------------------------------- 1 | struct PS_INPUT { 2 | float4 p_viewport : SV_POSITION; 3 | float4 color : COLOR0; 4 | }; 5 | 6 | float4 PS(PS_INPUT input) : SV_Target { 7 | return input.color; 8 | } -------------------------------------------------------------------------------- /Projects/Project5/Demo/shaders/VS.hlsl: -------------------------------------------------------------------------------- 1 | cbuffer Transform : register(b0) { 2 | float4x4 g_object_to_world : packoffset(c0); 3 | float4x4 g_world_to_camera : packoffset(c4); 4 | float4x4 g_camera_to_projection : packoffset(c8); 5 | } 6 | 7 | struct VS_INPUT { 8 | float4 p : POSITION; 9 | float4 color : COLOR0; 10 | }; 11 | 12 | struct VS_OUTPUT { 13 | float4 p : SV_POSITION; 14 | float4 color : COLOR0; 15 | }; 16 | 17 | VS_OUTPUT VS(VS_INPUT input) { 18 | VS_OUTPUT output; 19 | output.p = mul( input.p, g_object_to_world); 20 | output.p = mul(output.p, g_world_to_camera); 21 | output.p = mul(output.p, g_camera_to_projection); 22 | output.color = input.color; 23 | return output; 24 | } -------------------------------------------------------------------------------- /Projects/Project6/Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28803.156 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo.vcxproj", "{F9BA8891-AC7F-48A8-9005-CD8C73706D59}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {54FB0635-3B8A-459A-9739-64D306953FE1} = {54FB0635-3B8A-459A-9739-64D306953FE1} 9 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} = {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} 10 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 11 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmt", "..\Common\fmt.vcxproj", "{7C0476A5-5582-4DA2-85CF-1876028A7482}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "..\Common\DirectXTex.vcxproj", "{54FB0635-3B8A-459A-9739-64D306953FE1}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImGui", "..\Common\ImGui.vcxproj", "{F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}" 19 | ProjectSection(ProjectDependencies) = postProject 20 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 21 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 22 | EndProjectSection 23 | EndProject 24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MAGE", "..\Common\MAGE.vcxproj", "{529BD7A2-F3E9-4EF7-878F-C469506CFA3F}" 25 | ProjectSection(ProjectDependencies) = postProject 26 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 27 | EndProjectSection 28 | EndProject 29 | Global 30 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 31 | Debug|x64 = Debug|x64 32 | Debug|x86 = Debug|x86 33 | Release|x64 = Release|x64 34 | Release|x86 = Release|x86 35 | EndGlobalSection 36 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 37 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.ActiveCfg = Debug|x64 38 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.Build.0 = Debug|x64 39 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.ActiveCfg = Debug|Win32 40 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.Build.0 = Debug|Win32 41 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.ActiveCfg = Release|x64 42 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.Build.0 = Release|x64 43 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.ActiveCfg = Release|Win32 44 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.Build.0 = Release|Win32 45 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.ActiveCfg = Debug|x64 46 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.Build.0 = Debug|x64 47 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.ActiveCfg = Debug|Win32 48 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.Build.0 = Debug|Win32 49 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.ActiveCfg = Release|x64 50 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.Build.0 = Release|x64 51 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.ActiveCfg = Release|Win32 52 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.Build.0 = Release|Win32 53 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.ActiveCfg = Debug|x64 54 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.Build.0 = Debug|x64 55 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.ActiveCfg = Debug|Win32 56 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.Build.0 = Debug|Win32 57 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.ActiveCfg = Release|x64 58 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.Build.0 = Release|x64 59 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.ActiveCfg = Release|Win32 60 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.Build.0 = Release|Win32 61 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.ActiveCfg = Debug|x64 62 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.Build.0 = Debug|x64 63 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.ActiveCfg = Debug|Win32 64 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.Build.0 = Debug|Win32 65 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.ActiveCfg = Release|x64 66 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.Build.0 = Release|x64 67 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.ActiveCfg = Release|Win32 68 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.Build.0 = Release|Win32 69 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.ActiveCfg = Debug|x64 70 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.Build.0 = Debug|x64 71 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.ActiveCfg = Debug|Win32 72 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.Build.0 = Debug|Win32 73 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.ActiveCfg = Release|x64 74 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.Build.0 = Release|x64 75 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.ActiveCfg = Release|Win32 76 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.Build.0 = Release|Win32 77 | EndGlobalSection 78 | GlobalSection(SolutionProperties) = preSolution 79 | HideSolutionNode = FALSE 80 | EndGlobalSection 81 | GlobalSection(ExtensibilityGlobals) = postSolution 82 | SolutionGuid = {4ACF3D7D-30D3-440E-90E8-3F4F5AF65C6A} 83 | EndGlobalSection 84 | EndGlobal 85 | -------------------------------------------------------------------------------- /Projects/Project6/Demo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;tpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {c409d954-b17f-4c9f-996a-7f840de4f401} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Shader Files 28 | 29 | 30 | Shader Files 31 | 32 | 33 | Shader Files 34 | 35 | 36 | 37 | 38 | Shader Files 39 | 40 | 41 | -------------------------------------------------------------------------------- /Projects/Project6/Demo/shaders/PS.hlsl: -------------------------------------------------------------------------------- 1 | #include "model.hlsli" 2 | 3 | struct PS_INPUT { 4 | float4 p_viewport : SV_POSITION; 5 | float3 n : NORMAL0; 6 | }; 7 | 8 | float4 PS(PS_INPUT input) : SV_Target { 9 | const float3 n = normalize(input.n); 10 | 11 | float3 c = 0.0f; 12 | for (uint i = 0u; i < 2u; ++i) { 13 | c += dot(g_d_lights[i].xyz, n) * g_color_lights[i].xyz; 14 | } 15 | 16 | return float4(saturate(c), 1.0f); 17 | } -------------------------------------------------------------------------------- /Projects/Project6/Demo/shaders/VS.hlsl: -------------------------------------------------------------------------------- 1 | #include "model.hlsli" 2 | 3 | struct VS_INPUT { 4 | float4 p : POSITION; 5 | float3 n : NORMAL0; 6 | }; 7 | 8 | struct VS_OUTPUT { 9 | float4 p : SV_POSITION; 10 | float3 n : NORMAL0; 11 | }; 12 | 13 | VS_OUTPUT VS(VS_INPUT input) { 14 | VS_OUTPUT output; 15 | output.p = mul( input.p, g_object_to_world); 16 | output.p = mul(output.p, g_world_to_camera); 17 | output.p = mul(output.p, g_camera_to_projection); 18 | output.n = mul(float4(input.n, 1.0f), g_object_to_world).xyz; 19 | return output; 20 | } -------------------------------------------------------------------------------- /Projects/Project6/Demo/shaders/model.hlsli: -------------------------------------------------------------------------------- 1 | cbuffer Model : register(b0) { 2 | float4x4 g_object_to_world : packoffset(c0); 3 | float4x4 g_world_to_camera : packoffset(c4); 4 | float4x4 g_camera_to_projection : packoffset(c8); 5 | float4 g_d_lights[2u] : packoffset(c12); 6 | float4 g_color_lights[2u] : packoffset(c14); 7 | float4 g_color : packoffset(c16); 8 | } 9 | -------------------------------------------------------------------------------- /Projects/Project6/Demo/shaders/solid_PS.hlsl: -------------------------------------------------------------------------------- 1 | #include "model.hlsli" 2 | 3 | struct PS_INPUT { 4 | float4 p_viewport : SV_POSITION; 5 | float3 n : NORMAL0; 6 | }; 7 | 8 | float4 PS(PS_INPUT input) : SV_Target{ 9 | return g_color; 10 | } -------------------------------------------------------------------------------- /Projects/Project7/Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28803.156 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo.vcxproj", "{F9BA8891-AC7F-48A8-9005-CD8C73706D59}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {54FB0635-3B8A-459A-9739-64D306953FE1} = {54FB0635-3B8A-459A-9739-64D306953FE1} 9 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} = {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} 10 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 11 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmt", "..\Common\fmt.vcxproj", "{7C0476A5-5582-4DA2-85CF-1876028A7482}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "..\Common\DirectXTex.vcxproj", "{54FB0635-3B8A-459A-9739-64D306953FE1}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImGui", "..\Common\ImGui.vcxproj", "{F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}" 19 | ProjectSection(ProjectDependencies) = postProject 20 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 21 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 22 | EndProjectSection 23 | EndProject 24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MAGE", "..\Common\MAGE.vcxproj", "{529BD7A2-F3E9-4EF7-878F-C469506CFA3F}" 25 | ProjectSection(ProjectDependencies) = postProject 26 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 27 | EndProjectSection 28 | EndProject 29 | Global 30 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 31 | Debug|x64 = Debug|x64 32 | Debug|x86 = Debug|x86 33 | Release|x64 = Release|x64 34 | Release|x86 = Release|x86 35 | EndGlobalSection 36 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 37 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.ActiveCfg = Debug|x64 38 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.Build.0 = Debug|x64 39 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.ActiveCfg = Debug|Win32 40 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.Build.0 = Debug|Win32 41 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.ActiveCfg = Release|x64 42 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.Build.0 = Release|x64 43 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.ActiveCfg = Release|Win32 44 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.Build.0 = Release|Win32 45 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.ActiveCfg = Debug|x64 46 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.Build.0 = Debug|x64 47 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.ActiveCfg = Debug|Win32 48 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.Build.0 = Debug|Win32 49 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.ActiveCfg = Release|x64 50 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.Build.0 = Release|x64 51 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.ActiveCfg = Release|Win32 52 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.Build.0 = Release|Win32 53 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.ActiveCfg = Debug|x64 54 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.Build.0 = Debug|x64 55 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.ActiveCfg = Debug|Win32 56 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.Build.0 = Debug|Win32 57 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.ActiveCfg = Release|x64 58 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.Build.0 = Release|x64 59 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.ActiveCfg = Release|Win32 60 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.Build.0 = Release|Win32 61 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.ActiveCfg = Debug|x64 62 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.Build.0 = Debug|x64 63 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.ActiveCfg = Debug|Win32 64 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.Build.0 = Debug|Win32 65 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.ActiveCfg = Release|x64 66 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.Build.0 = Release|x64 67 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.ActiveCfg = Release|Win32 68 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.Build.0 = Release|Win32 69 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.ActiveCfg = Debug|x64 70 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.Build.0 = Debug|x64 71 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.ActiveCfg = Debug|Win32 72 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.Build.0 = Debug|Win32 73 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.ActiveCfg = Release|x64 74 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.Build.0 = Release|x64 75 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.ActiveCfg = Release|Win32 76 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.Build.0 = Release|Win32 77 | EndGlobalSection 78 | GlobalSection(SolutionProperties) = preSolution 79 | HideSolutionNode = FALSE 80 | EndGlobalSection 81 | GlobalSection(ExtensibilityGlobals) = postSolution 82 | SolutionGuid = {4ACF3D7D-30D3-440E-90E8-3F4F5AF65C6A} 83 | EndGlobalSection 84 | EndGlobal 85 | -------------------------------------------------------------------------------- /Projects/Project7/Demo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;tpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | {c409d954-b17f-4c9f-996a-7f840de4f401} 18 | 19 | 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Shader Files 28 | 29 | 30 | Shader Files 31 | 32 | 33 | 34 | 35 | Shader Files 36 | 37 | 38 | -------------------------------------------------------------------------------- /Projects/Project7/Demo/res/seafloor.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matt77hias/D3D11-Projects/f9b11894ff39645be4130bfa678573cf6adf8c83/Projects/Project7/Demo/res/seafloor.dds -------------------------------------------------------------------------------- /Projects/Project7/Demo/shaders/PS.hlsl: -------------------------------------------------------------------------------- 1 | #include "buffer.hlsli" 2 | 3 | Texture2D g_texture : register(t0); 4 | SamplerState g_sampler : register(s0); 5 | 6 | struct PS_INPUT { 7 | float4 p_viewport : SV_POSITION; 8 | float2 tex : TEXCOORD0; 9 | }; 10 | 11 | float4 PS(PS_INPUT input) : SV_Target { 12 | return g_texture.Sample(g_sampler, input.tex) * g_color; 13 | } -------------------------------------------------------------------------------- /Projects/Project7/Demo/shaders/VS.hlsl: -------------------------------------------------------------------------------- 1 | #include "buffer.hlsli" 2 | 3 | struct VS_INPUT { 4 | float4 p : POSITION; 5 | float2 tex : TEXCOORD0; 6 | }; 7 | 8 | struct VS_OUTPUT { 9 | float4 p : SV_POSITION; 10 | float2 tex : TEXCOORD0; 11 | }; 12 | 13 | VS_OUTPUT VS(VS_INPUT input) { 14 | VS_OUTPUT output; 15 | output.p = mul( input.p, g_object_to_world); 16 | output.p = mul(output.p, g_world_to_camera); 17 | output.p = mul(output.p, g_camera_to_projection); 18 | output.tex = input.tex; 19 | return output; 20 | } -------------------------------------------------------------------------------- /Projects/Project7/Demo/shaders/buffer.hlsli: -------------------------------------------------------------------------------- 1 | cbuffer Camera : register(b0) { 2 | float4x4 g_world_to_camera : packoffset(c0); 3 | float4x4 g_camera_to_projection : packoffset(c4); 4 | }; 5 | 6 | cbuffer Model : register(b1) { 7 | float4x4 g_object_to_world : packoffset(c0); 8 | float4 g_color : packoffset(c4); 9 | }; 10 | -------------------------------------------------------------------------------- /Projects/Project8/Demo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.28803.156 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Demo", "Demo.vcxproj", "{F9BA8891-AC7F-48A8-9005-CD8C73706D59}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {54FB0635-3B8A-459A-9739-64D306953FE1} = {54FB0635-3B8A-459A-9739-64D306953FE1} 9 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} = {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E} 10 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 11 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 12 | EndProjectSection 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmt", "..\Common\fmt.vcxproj", "{7C0476A5-5582-4DA2-85CF-1876028A7482}" 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DirectXTex", "..\Common\DirectXTex.vcxproj", "{54FB0635-3B8A-459A-9739-64D306953FE1}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImGui", "..\Common\ImGui.vcxproj", "{F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}" 19 | ProjectSection(ProjectDependencies) = postProject 20 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} = {529BD7A2-F3E9-4EF7-878F-C469506CFA3F} 21 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 22 | EndProjectSection 23 | EndProject 24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MAGE", "..\Common\MAGE.vcxproj", "{529BD7A2-F3E9-4EF7-878F-C469506CFA3F}" 25 | ProjectSection(ProjectDependencies) = postProject 26 | {7C0476A5-5582-4DA2-85CF-1876028A7482} = {7C0476A5-5582-4DA2-85CF-1876028A7482} 27 | EndProjectSection 28 | EndProject 29 | Global 30 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 31 | Debug|x64 = Debug|x64 32 | Debug|x86 = Debug|x86 33 | Release|x64 = Release|x64 34 | Release|x86 = Release|x86 35 | EndGlobalSection 36 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 37 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.ActiveCfg = Debug|x64 38 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x64.Build.0 = Debug|x64 39 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.ActiveCfg = Debug|Win32 40 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Debug|x86.Build.0 = Debug|Win32 41 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.ActiveCfg = Release|x64 42 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x64.Build.0 = Release|x64 43 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.ActiveCfg = Release|Win32 44 | {F9BA8891-AC7F-48A8-9005-CD8C73706D59}.Release|x86.Build.0 = Release|Win32 45 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.ActiveCfg = Debug|x64 46 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x64.Build.0 = Debug|x64 47 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.ActiveCfg = Debug|Win32 48 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Debug|x86.Build.0 = Debug|Win32 49 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.ActiveCfg = Release|x64 50 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x64.Build.0 = Release|x64 51 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.ActiveCfg = Release|Win32 52 | {7C0476A5-5582-4DA2-85CF-1876028A7482}.Release|x86.Build.0 = Release|Win32 53 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.ActiveCfg = Debug|x64 54 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x64.Build.0 = Debug|x64 55 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.ActiveCfg = Debug|Win32 56 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Debug|x86.Build.0 = Debug|Win32 57 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.ActiveCfg = Release|x64 58 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x64.Build.0 = Release|x64 59 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.ActiveCfg = Release|Win32 60 | {54FB0635-3B8A-459A-9739-64D306953FE1}.Release|x86.Build.0 = Release|Win32 61 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.ActiveCfg = Debug|x64 62 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x64.Build.0 = Debug|x64 63 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.ActiveCfg = Debug|Win32 64 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Debug|x86.Build.0 = Debug|Win32 65 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.ActiveCfg = Release|x64 66 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x64.Build.0 = Release|x64 67 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.ActiveCfg = Release|Win32 68 | {F16D4A47-A3C2-42F8-BEFC-58EC9C8F625E}.Release|x86.Build.0 = Release|Win32 69 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.ActiveCfg = Debug|x64 70 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x64.Build.0 = Debug|x64 71 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.ActiveCfg = Debug|Win32 72 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Debug|x86.Build.0 = Debug|Win32 73 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.ActiveCfg = Release|x64 74 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x64.Build.0 = Release|x64 75 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.ActiveCfg = Release|Win32 76 | {529BD7A2-F3E9-4EF7-878F-C469506CFA3F}.Release|x86.Build.0 = Release|Win32 77 | EndGlobalSection 78 | GlobalSection(SolutionProperties) = preSolution 79 | HideSolutionNode = FALSE 80 | EndGlobalSection 81 | GlobalSection(ExtensibilityGlobals) = postSolution 82 | SolutionGuid = {4ACF3D7D-30D3-440E-90E8-3F4F5AF65C6A} 83 | EndGlobalSection 84 | EndGlobal 85 | -------------------------------------------------------------------------------- /Projects/Project8/Demo.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;tpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /Projects/appveyor.yml: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # General Configuration 3 | ############################################################################### 4 | version: 2.0.{build} 5 | 6 | ############################################################################### 7 | # Environment Configuration 8 | ############################################################################### 9 | image: Visual Studio 2019 10 | 11 | configuration: 12 | - Release 13 | - Debug 14 | platform: 15 | - x64 16 | - x86 17 | environment: 18 | matrix: 19 | - solution_name: "Projects/Project1/Demo.sln" 20 | - solution_name: "Projects/Project2/Demo.sln" 21 | - solution_name: "Projects/Project3/Demo.sln" 22 | - solution_name: "Projects/Project4/Demo.sln" 23 | - solution_name: "Projects/Project5/Demo.sln" 24 | - solution_name: "Projects/Project6/Demo.sln" 25 | - solution_name: "Projects/Project7/Demo.sln" 26 | - solution_name: "Projects/Project8/Demo.sln" 27 | 28 | ############################################################################### 29 | # Build Configuration 30 | ############################################################################### 31 | build: 32 | parallel: true 33 | verbosity: normal 34 | 35 | build_script: 36 | - msbuild %solution_name% 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build status][s1]][av] [![Code quality][s2]][co] [![License][s3]][li] 2 | 3 | [s1]: https://ci.appveyor.com/api/projects/status/y8ew5io98llltkk2?svg=true 4 | [s2]: https://app.codacy.com/project/badge/Grade/377d3777301f4bc09d1626de1c96ec8d 5 | [s3]: https://img.shields.io/badge/licence-GPL%203.0-blue.svg 6 | 7 | [av]: https://ci.appveyor.com/project/matt77hias/direct3d-11-projects 8 | [co]: https://app.codacy.com/gh/matt77hias/D3D11-Projects/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade 9 | [li]: https://raw.githubusercontent.com/matt77hias/D3D11-Projects/master/LICENSE.txt 10 | 11 | # D3D11-Projects 12 | 13 | ## About 14 | Projects to start learning Direct3D 11 (D3D11). 15 | 16 | **Note**: [Version 1.2](https://github.com/matt77hias/D3D11-Projects/releases/tag/v1.2) (obsolete) supports Windows 8.1 and uses a more Object-Oriented Design with more verbose documentation as opposed to the current version. Furthermore, it contains some useful code snippets that are not included anymore in the latest version. 17 | 18 |

19 | 20 | * [Project 1](https://github.com/matt77hias/D3D11-Projects/tree/master/Projects/Project1): Creating a window for displaying 21 | * [Project 2](https://github.com/matt77hias/D3D11-Projects/tree/master/Projects/Project2): Rendering the background color of a window 22 | * [Project 3](https://github.com/matt77hias/D3D11-Projects/tree/master/Projects/Project3): Rendering a triangle that is defined in projection space 23 | * [Project 4](https://github.com/matt77hias/D3D11-Projects/tree/master/Projects/Project4): Rendering and animating a cube that is defined in object space 24 | * [Project 5](https://github.com/matt77hias/D3D11-Projects/tree/master/Projects/Project5): Rendering and animating multiple cubes that are defined in object space 25 | * [Project 6](https://github.com/matt77hias/D3D11-Projects/tree/master/Projects/Project6): Lighting 26 | * [Project 7](https://github.com/matt77hias/D3D11-Projects/tree/master/Projects/Project7): Textures 27 | * [Project 8](https://github.com/matt77hias/D3D11-Projects/tree/master/Projects/Project8): Switching between windowed and fullscreen mode 28 | 29 | ## Development 30 | * **Platform**: Windows 10 32 Bit and 64 Bit (Windows API + Direct3D 11) 31 | * **Engine Programming Language**: ISO C++ Latest Draft Standard (> C++17) 32 | * **Scripting Language**: ISO C++ Latest Draft Standard (> C++17) 33 | * **Shading Language**: HLSL (Shader Model 5.0) 34 | * **Dependencies**: 35 | * d3d12.lib 36 | * dxgi.lib 37 | * (d3dcompiler.lib) 38 | * **Compiler**: MSVC++ 16.0.1 39 | * **IDE**: Visual Studio 2019 40 | 41 | ## Codebase 42 | Based on: 43 | [explanation](https://code.msdn.microsoft.com/windowsdesktop/Direct3D-Tutorial-Win32-829979ef) + [code](https://github.com/walbourn/directx-sdk-samples/tree/master/Direct3D11Tutorials) 44 | 45 | * [(Dear) ImGui](https://github.com/ocornut/imgui) [[License](https://github.com/ocornut/imgui/blob/master/LICENSE.txt)] 46 | * [stb](https://github.com/nothings/stb) [[License](https://creativecommons.org/share-your-work/public-domain/cc0/)] 47 | * [{fmt}](https://github.com/fmtlib/fmt) [[License](https://github.com/fmtlib/fmt/blob/master/LICENSE.rst)] 48 | * [MAGE v0](https://github.com/matt77hias/MAGE-v0) [[License](https://github.com/matt77hias/MAGE-v0/blob/master/LICENSE.txt)] 49 | * Microsoft Corporation Libraries: 50 | * [Direct3D 11](https://docs.microsoft.com/nl-be/windows/desktop/direct3d11/atoc-dx-graphics-direct3d-11) 51 | * [DirectXShaderCompiler](https://github.com/Microsoft/DirectXShaderCompiler) [[License](https://github.com/Microsoft/DirectXShaderCompiler/blob/master/LICENSE.TXT)] 52 | * [DirectXMath](https://github.com/Microsoft/DirectXMath) [[License](https://github.com/Microsoft/DirectXMath/blob/master/LICENSE)] 53 | * [DirectXTex](https://github.com/Microsoft/DirectXTex) [[License](https://github.com/Microsoft/DirectXTex/blob/master/LICENSE)] 54 | * [Guidelines Support Library (GSL)](https://github.com/Microsoft/GSL) [[License](https://github.com/Microsoft/GSL/blob/master/LICENSE)] 55 | * [Microsoft DirectX Graphics Infrastructure (DXGI)](https://docs.microsoft.com/en-us/windows/desktop/direct3ddxgi/d3d10-graphics-programming-guide-dxgi) 56 | * [Windows Runtime C++ Template Library (WRL)](https://docs.microsoft.com/nl-be/cpp/windows/windows-runtime-cpp-template-library-wrl?view=vs-2017) 57 | * [std](https://en.cppreference.com/w/cpp/header) 58 | 59 |

Copyright © 2016 Matthias Moulin. All Rights Reserved.

60 | -------------------------------------------------------------------------------- /res/d3d11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matt77hias/D3D11-Projects/f9b11894ff39645be4130bfa678573cf6adf8c83/res/d3d11.png --------------------------------------------------------------------------------