Compare commits

...

21 Commits

Author SHA1 Message Date
ce51c11b31 Minor - Add Unitest environment - V10.7.0 2025-06-02 14:15:18 +02:00
0e11ead55b Patch - Deth Shader integration for shadow map - V10.6.1 2025-05-28 15:02:43 +02:00
1af71960c3 Minor - Depth shader - V10.6.0 2025-05-28 13:24:53 +02:00
f20adee22f Patch - Sun camera Depth experiment - V10.5.3 2025-05-26 16:03:51 +02:00
eb2cd17ec3 Patch - Sun Camera - V10.5.2 2025-05-26 13:52:00 +02:00
dbd27d1fe7 Revert "Minor - Start Shadow Map - V10.5.0"
This reverts commit d6b7626446e965d3cf4567f5cd787511c9bbe4f3.
2025-05-25 16:12:39 +02:00
d6b7626446 Minor - Start Shadow Map - V10.5.0 2025-05-22 17:28:29 +02:00
f9d4523f09 Minor - Refactor name - V10.5.0 2025-05-21 16:40:27 +02:00
24203060be Actualiser README.md 2025-05-13 21:18:50 +00:00
8b77b189a8 Merge branch 'main' of http://gitea-ui.shiba-server.fr:19000/ShibaGit/khaotic-engine-Reborn 2025-05-13 21:50:17 +02:00
e5ee8fdad3 Patch Update - BigCube Is Back - V10.4.2 2025-05-13 21:50:05 +02:00
3a2d19dff4 Actualiser README.md 2025-05-13 13:01:35 +00:00
dbc7003569 Patch Update - Remove The """Instancing""" due to unwanted behavior - V10.4.1 2025-05-12 16:14:38 +02:00
c5bfa2e621 Minor Update - Loading Obj Model is now faster than f1 - V10.4.0 2025-05-12 14:18:43 +02:00
32b71ac97f Patch Update - UI Text No Blur - V10.3.1 2025-05-08 17:35:41 +02:00
5c3c6d944c Minor Update - UI Update - V10.3.0 2025-05-08 17:28:06 +02:00
8d32f51e8c Patch Update - Clean Render Pass - V10.2.3 2025-05-08 17:07:45 +02:00
644fc57762 Patch Update - Frustum Culling Thread Independant - V10.2.2 2025-05-08 16:28:27 +02:00
f8bfb62e98 Patch Update - WIP Async Cube Generation - V10.2.1 2025-05-07 17:48:02 +02:00
94fd900ce8 Minor Update - Stats Widget + BigCube Generation WIP - V10.2.0 2025-05-07 17:15:11 +02:00
2744c809d3 Actualiser README.md 2025-05-06 16:28:06 +00:00
1546 changed files with 862913 additions and 5246 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" charset="windows-1252" />
<file url="file://$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" charset="windows-1252" />
<file url="file://$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" charset="windows-1252" />
<file url="PROJECT" charset="windows-1252" />
</component>

View File

@ -6,10 +6,15 @@
<component name="ChangeListManager">
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/assets/Texture/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/assets/Texture/imgui.ini" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/object.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/object.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/object.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/object.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj.filters" beforeDir="false" afterPath="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj.filters" afterDir="false" />
<change beforePath="$PROJECT_DIR$/KhaoticDemo/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/KhaoticDemo/main.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/KhaoticEngineReborn.sln" beforeDir="false" afterPath="$PROJECT_DIR$/KhaoticEngineReborn.sln" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj.filters" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj.filters" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/d_3d_class.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/d_3d_class.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/shadow_map.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/shadow_map.h" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -23,35 +28,16 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="cidr-memory-view://3" root0="FORCE_HIGHLIGHTING" />
<setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/d3d11.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/dinput.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/include/Inc/VertexTypes.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/include/Vulkan/Include/vulkan/vulkan_core.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/src/shader/CelShadingShader.cpp" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/../../IDE_VS/VC/Tools/MSVC/14.38.33130/include/type_traits" root0="SKIP_HIGHLIGHTING" />
</component>
<component name="KubernetesApiPersistence">{}</component>
<component name="KubernetesApiProvider">{
&quot;isMigrated&quot;: true
}</component>
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
<component name="ProblemsViewState">
<option name="selectedTabId" value="CurrentFile" />
@ -60,29 +46,32 @@
&quot;associatedIndex&quot;: 6
}</component>
<component name="ProjectId" id="2sGIWDeT5ixyzDQ0he4A3RFpG9W" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
"C++ Project.enginecustom.executor": "Run",
"C/C++ Project.enginecustom.executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"git-widget-placeholder": "main",
"ignore.virus.scanning.warn.message": "true",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "preferences.build.unityPlugin",
"vue.rearranger.settings.migration": "true"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;C++ Project.enginecustom.executor&quot;: &quot;Run&quot;,
&quot;C/C++ Project.enginecustom.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}]]></component>
}</component>
<component name="RunManager" selected="C/C++ Project.enginecustom">
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
@ -202,7 +191,24 @@
<workItem from="1746526901276" duration="2023000" />
<workItem from="1746536290167" duration="1908000" />
<workItem from="1746538260893" duration="5781000" />
<workItem from="1746546014271" duration="1490000" />
<workItem from="1746546014271" duration="1814000" />
<workItem from="1746619988287" duration="12282000" />
<workItem from="1746711806997" duration="6736000" />
<workItem from="1746719840054" duration="991000" />
<workItem from="1746795732153" duration="33000" />
<workItem from="1746795828588" duration="592000" />
<workItem from="1747049871967" duration="9350000" />
<workItem from="1747136509645" duration="3939000" />
<workItem from="1747258663152" duration="835000" />
<workItem from="1747826758888" duration="3587000" />
<workItem from="1747830379222" duration="7954000" />
<workItem from="1748254142068" duration="10499000" />
<workItem from="1748267553700" duration="654000" />
<workItem from="1748429087202" duration="7421000" />
<workItem from="1748521606678" duration="5300000" />
<workItem from="1748859894056" duration="1431000" />
<workItem from="1748861785837" duration="357000" />
<workItem from="1748865625274" duration="797000" />
</task>
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
<option name="closed" value="true" />

18
CoreLib/Color.cpp Normal file
View File

@ -0,0 +1,18 @@
#include "pch.h"
#include "Color.h"
#if __has_include("Color.g.cpp")
#include "Color.g.cpp"
#endif
namespace winrt::enginecustom::implementation
{
int32_t Color::MyProperty()
{
throw hresult_not_implemented();
}
void Color::MyProperty(int32_t /*value*/)
{
throw hresult_not_implemented();
}
}

21
CoreLib/Color.h Normal file
View File

@ -0,0 +1,21 @@
#pragma once
#include "Color.g.h"
namespace winrt::enginecustom::implementation
{
struct Color : ColorT<Color>
{
Color() = default;
int32_t MyProperty();
void MyProperty(int32_t value);
};
}
namespace winrt::enginecustom::factory_implementation
{
struct Color : ColorT<Color, implementation::Color>
{
};
}

10
CoreLib/Color.idl Normal file
View File

@ -0,0 +1,10 @@
namespace enginecustom
{
[bindable]
[default_interface]
runtimeclass Color
{
Color();
Int32 MyProperty;
}
}

View File

@ -0,0 +1 @@
1 isosphere 0 10 0 0 -0 0 1 1 1 Content/Assets/Kobject/isosphere.obj ALPHA_MAPPING 1 Unknown 1 0 2 assets/Texture/Bricks2K.png F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\moss01.png 1 assets/Texture/BricksNRM2K.png 1 assets/Texture/BricksGLOSS2K.png 1 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\alpha01.png

BIN
CoreLib/KhaoticIcon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

8
CoreLib/TODO.txt Normal file
View File

@ -0,0 +1,8 @@
- Scene Manager :
TODO : Save and Load Scene
- ImguiManager :
TODO : Add Save and Load Scene Button in the bar menu
TODO : Add a preview of the game in a new window

View File

@ -0,0 +1,82 @@
Vertex Count: 78
Data:
4 -0.5 -4 0.998008 0.998008 0 1 -0
-4 -0.5 4 0.001992 0.00199199 0 1 -0
4 -0.5 4 0.998008 0.00199199 0 1 -0
4 -0.5 -4 0.998008 0.998008 0 1 -0
-4 -0.5 -4 0.001992 0.998008 0 1 -0
-4 -0.5 4 0.001992 0.00199199 0 1 -0
4 1 4 0.187127 0.998008 0 0 -1
-4 -0.5 4 0.000374 0.00199199 0 0 -1
-4 1 4 0.187127 0.00199199 0 0 -1
4 -0.5 4 0.000374 0.998008 0 0 -1
-4 -0.5 4 0.000374 0.00199199 0 0 -1
4 1 4 0.187127 0.998008 0 0 -1
4 1 -4 0.187126 0.998008 -1 0 -0
4 -0.5 4 0.000373 0.00199199 -1 0 -0
4 1 4 0.187126 0.00199199 -1 0 -0
4 -0.5 -4 0.000373 0.998008 -1 0 -0
4 -0.5 4 0.000373 0.00199199 -1 0 -0
4 1 -4 0.187126 0.998008 -1 0 -0
-4 1 -4 0.000374 0.00199199 0 0 1
4 -0.5 -4 0.187127 0.998008 0 0 1
4 1 -4 0.000374 0.998008 0 0 1
-4 1 -4 0.000374 0.00199199 0 0 1
-4 -0.5 -4 0.187127 0.00199199 0 0 1
4 -0.5 -4 0.187127 0.998008 0 0 1
-4 1 4 0.187127 0.998008 1 0 -0
-4 -0.5 -4 0.000374 0.00199199 1 0 -0
-4 1 -4 0.187127 0.00199199 1 0 -0
-4 -0.5 4 0.000374 0.998008 1 0 -0
-4 -0.5 -4 0.000374 0.00199199 1 0 -0
-4 1 4 0.187127 0.998008 1 0 -0
-5 1 5 0.199602 0.00199199 -1 0 -0
-5 -1 -5 0.000398 0.998008 -1 0 -0
-5 -1 5 0.000398 0.00199199 -1 0 -0
-5 1 -5 0.199602 0.998008 -1 0 -0
-5 -1 -5 0.000398 0.998008 -1 0 -0
-5 1 5 0.199602 0.00199199 -1 0 -0
5 1 -5 0.199602 0.00199199 1 0 -0
5 -1 5 0.000398 0.998008 1 0 -0
5 -1 -5 0.000398 0.00199199 1 0 -0
5 1 5 0.199602 0.998008 1 0 -0
5 -1 5 0.000398 0.998008 1 0 -0
5 1 -5 0.199602 0.00199199 1 0 -0
-5 -1 5 0.199602 0.00199199 0 0 1
5 1 5 0.000398 0.998008 0 0 1
-5 1 5 0.000398 0.00199199 0 0 1
5 -1 5 0.199602 0.998008 0 0 1
5 1 5 0.000398 0.998008 0 0 1
-5 -1 5 0.199602 0.00199199 0 0 1
-5 1 5 0.001992 0.00199199 0 1 -0
-4 1 -4 0.101594 0.898406 0 1 -0
-5 1 -5 0.001992 0.998008 0 1 -0
-5 1 5 0.001992 0.00199199 0 1 -0
-4 1 4 0.101594 0.101594 0 1 -0
-4 1 -4 0.101594 0.898406 0 1 -0
-4 1 -4 0.101594 0.898406 0 1 -0
5 1 -5 0.998008 0.998008 0 1 -0
-5 1 -5 0.001992 0.998008 0 1 -0
4 1 -4 0.898406 0.898406 0 1 -0
5 1 -5 0.998008 0.998008 0 1 -0
-4 1 -4 0.101594 0.898406 0 1 -0
4 1 -4 0.898406 0.898406 0 1 -0
5 1 5 0.998008 0.00199199 0 1 -0
5 1 -5 0.998008 0.998008 0 1 -0
4 1 4 0.898406 0.101594 0 1 -0
5 1 5 0.998008 0.00199199 0 1 -0
4 1 -4 0.898406 0.898406 0 1 -0
4 1 4 0.898406 0.101594 0 1 -0
-5 1 5 0.001992 0.00199199 0 1 -0
5 1 5 0.998008 0.00199199 0 1 -0
-5 1 5 0.001992 0.00199199 0 1 -0
4 1 4 0.898406 0.101594 0 1 -0
-4 1 4 0.101594 0.101594 0 1 -0
-5 1 -5 0.199602 0.00199199 0 0 -1
5 -1 -5 0.000398 0.998008 0 0 -1
-5 -1 -5 0.000398 0.00199199 0 0 -1
5 1 -5 0.199602 0.998008 0 0 -1
5 -1 -5 0.000398 0.998008 0 0 -1
-5 1 -5 0.199602 0.00199199 0 0 -1

View File

@ -0,0 +1,403 @@
Vertex Count: 400
Data:
0 0.0 0 0.0 0.0 0.0 1.0 0.0
1 0.0 0 1.0 0.0 0.0 1.0 0.0
1 0.0 1 1.0 1.0 0.0 1.0 0.0
0 0.0 1 0.0 1.0 0.0 1.0 0.0
0 0.0 1 0.0 0.0 0.0 1.0 0.0
1 0.0 1 1.0 0.0 0.0 1.0 0.0
1 0.0 2 1.0 1.0 0.0 1.0 0.0
0 0.0 2 0.0 1.0 0.0 1.0 0.0
0 0.0 2 0.0 0.0 0.0 1.0 0.0
1 0.0 2 1.0 0.0 0.0 1.0 0.0
1 0.0 3 1.0 1.0 0.0 1.0 0.0
0 0.0 3 0.0 1.0 0.0 1.0 0.0
0 0.0 3 0.0 0.0 0.0 1.0 0.0
1 0.0 3 1.0 0.0 0.0 1.0 0.0
1 0.0 4 1.0 1.0 0.0 1.0 0.0
0 0.0 4 0.0 1.0 0.0 1.0 0.0
0 0.0 4 0.0 0.0 0.0 1.0 0.0
1 0.0 4 1.0 0.0 0.0 1.0 0.0
1 0.0 5 1.0 1.0 0.0 1.0 0.0
0 0.0 5 0.0 1.0 0.0 1.0 0.0
0 0.0 5 0.0 0.0 0.0 1.0 0.0
1 0.0 5 1.0 0.0 0.0 1.0 0.0
1 0.0 6 1.0 1.0 0.0 1.0 0.0
0 0.0 6 0.0 1.0 0.0 1.0 0.0
0 0.0 6 0.0 0.0 0.0 1.0 0.0
1 0.0 6 1.0 0.0 0.0 1.0 0.0
1 0.0 7 1.0 1.0 0.0 1.0 0.0
0 0.0 7 0.0 1.0 0.0 1.0 0.0
0 0.0 7 0.0 0.0 0.0 1.0 0.0
1 0.0 7 1.0 0.0 0.0 1.0 0.0
1 0.0 8 1.0 1.0 0.0 1.0 0.0
0 0.0 8 0.0 1.0 0.0 1.0 0.0
0 0.0 8 0.0 0.0 0.0 1.0 0.0
1 0.0 8 1.0 0.0 0.0 1.0 0.0
1 0.0 9 1.0 1.0 0.0 1.0 0.0
0 0.0 9 0.0 1.0 0.0 1.0 0.0
0 0.0 9 0.0 0.0 0.0 1.0 0.0
1 0.0 9 1.0 0.0 0.0 1.0 0.0
1 0.0 10 1.0 1.0 0.0 1.0 0.0
0 0.0 10 0.0 1.0 0.0 1.0 0.0
1 0.0 0 0.0 0.0 0.0 1.0 0.0
2 0.0 0 1.0 0.0 0.0 1.0 0.0
2 0.0 1 1.0 1.0 0.0 1.0 0.0
1 0.0 1 0.0 1.0 0.0 1.0 0.0
1 0.0 1 0.0 0.0 0.0 1.0 0.0
2 0.0 1 1.0 0.0 0.0 1.0 0.0
2 0.0 2 1.0 1.0 0.0 1.0 0.0
1 0.0 2 0.0 1.0 0.0 1.0 0.0
1 0.0 2 0.0 0.0 0.0 1.0 0.0
2 0.0 2 1.0 0.0 0.0 1.0 0.0
2 0.0 3 1.0 1.0 0.0 1.0 0.0
1 0.0 3 0.0 1.0 0.0 1.0 0.0
1 0.0 3 0.0 0.0 0.0 1.0 0.0
2 0.0 3 1.0 0.0 0.0 1.0 0.0
2 0.0 4 1.0 1.0 0.0 1.0 0.0
1 0.0 4 0.0 1.0 0.0 1.0 0.0
1 0.0 4 0.0 0.0 0.0 1.0 0.0
2 0.0 4 1.0 0.0 0.0 1.0 0.0
2 0.0 5 1.0 1.0 0.0 1.0 0.0
1 0.0 5 0.0 1.0 0.0 1.0 0.0
1 0.0 5 0.0 0.0 0.0 1.0 0.0
2 0.0 5 1.0 0.0 0.0 1.0 0.0
2 0.0 6 1.0 1.0 0.0 1.0 0.0
1 0.0 6 0.0 1.0 0.0 1.0 0.0
1 0.0 6 0.0 0.0 0.0 1.0 0.0
2 0.0 6 1.0 0.0 0.0 1.0 0.0
2 0.0 7 1.0 1.0 0.0 1.0 0.0
1 0.0 7 0.0 1.0 0.0 1.0 0.0
1 0.0 7 0.0 0.0 0.0 1.0 0.0
2 0.0 7 1.0 0.0 0.0 1.0 0.0
2 0.0 8 1.0 1.0 0.0 1.0 0.0
1 0.0 8 0.0 1.0 0.0 1.0 0.0
1 0.0 8 0.0 0.0 0.0 1.0 0.0
2 0.0 8 1.0 0.0 0.0 1.0 0.0
2 0.0 9 1.0 1.0 0.0 1.0 0.0
1 0.0 9 0.0 1.0 0.0 1.0 0.0
1 0.0 9 0.0 0.0 0.0 1.0 0.0
2 0.0 9 1.0 0.0 0.0 1.0 0.0
2 0.0 10 1.0 1.0 0.0 1.0 0.0
1 0.0 10 0.0 1.0 0.0 1.0 0.0
2 0.0 0 0.0 0.0 0.0 1.0 0.0
3 0.0 0 1.0 0.0 0.0 1.0 0.0
3 0.0 1 1.0 1.0 0.0 1.0 0.0
2 0.0 1 0.0 1.0 0.0 1.0 0.0
2 0.0 1 0.0 0.0 0.0 1.0 0.0
3 0.0 1 1.0 0.0 0.0 1.0 0.0
3 0.0 2 1.0 1.0 0.0 1.0 0.0
2 0.0 2 0.0 1.0 0.0 1.0 0.0
2 0.0 2 0.0 0.0 0.0 1.0 0.0
3 0.0 2 1.0 0.0 0.0 1.0 0.0
3 0.0 3 1.0 1.0 0.0 1.0 0.0
2 0.0 3 0.0 1.0 0.0 1.0 0.0
2 0.0 3 0.0 0.0 0.0 1.0 0.0
3 0.0 3 1.0 0.0 0.0 1.0 0.0
3 0.0 4 1.0 1.0 0.0 1.0 0.0
2 0.0 4 0.0 1.0 0.0 1.0 0.0
2 0.0 4 0.0 0.0 0.0 1.0 0.0
3 0.0 4 1.0 0.0 0.0 1.0 0.0
3 0.0 5 1.0 1.0 0.0 1.0 0.0
2 0.0 5 0.0 1.0 0.0 1.0 0.0
2 0.0 5 0.0 0.0 0.0 1.0 0.0
3 0.0 5 1.0 0.0 0.0 1.0 0.0
3 0.0 6 1.0 1.0 0.0 1.0 0.0
2 0.0 6 0.0 1.0 0.0 1.0 0.0
2 0.0 6 0.0 0.0 0.0 1.0 0.0
3 0.0 6 1.0 0.0 0.0 1.0 0.0
3 0.0 7 1.0 1.0 0.0 1.0 0.0
2 0.0 7 0.0 1.0 0.0 1.0 0.0
2 0.0 7 0.0 0.0 0.0 1.0 0.0
3 0.0 7 1.0 0.0 0.0 1.0 0.0
3 0.0 8 1.0 1.0 0.0 1.0 0.0
2 0.0 8 0.0 1.0 0.0 1.0 0.0
2 0.0 8 0.0 0.0 0.0 1.0 0.0
3 0.0 8 1.0 0.0 0.0 1.0 0.0
3 0.0 9 1.0 1.0 0.0 1.0 0.0
2 0.0 9 0.0 1.0 0.0 1.0 0.0
2 0.0 9 0.0 0.0 0.0 1.0 0.0
3 0.0 9 1.0 0.0 0.0 1.0 0.0
3 0.0 10 1.0 1.0 0.0 1.0 0.0
2 0.0 10 0.0 1.0 0.0 1.0 0.0
3 0.0 0 0.0 0.0 0.0 1.0 0.0
4 0.0 0 1.0 0.0 0.0 1.0 0.0
4 0.0 1 1.0 1.0 0.0 1.0 0.0
3 0.0 1 0.0 1.0 0.0 1.0 0.0
3 0.0 1 0.0 0.0 0.0 1.0 0.0
4 0.0 1 1.0 0.0 0.0 1.0 0.0
4 0.0 2 1.0 1.0 0.0 1.0 0.0
3 0.0 2 0.0 1.0 0.0 1.0 0.0
3 0.0 2 0.0 0.0 0.0 1.0 0.0
4 0.0 2 1.0 0.0 0.0 1.0 0.0
4 0.0 3 1.0 1.0 0.0 1.0 0.0
3 0.0 3 0.0 1.0 0.0 1.0 0.0
3 0.0 3 0.0 0.0 0.0 1.0 0.0
4 0.0 3 1.0 0.0 0.0 1.0 0.0
4 0.0 4 1.0 1.0 0.0 1.0 0.0
3 0.0 4 0.0 1.0 0.0 1.0 0.0
3 0.0 4 0.0 0.0 0.0 1.0 0.0
4 0.0 4 1.0 0.0 0.0 1.0 0.0
4 0.0 5 1.0 1.0 0.0 1.0 0.0
3 0.0 5 0.0 1.0 0.0 1.0 0.0
3 0.0 5 0.0 0.0 0.0 1.0 0.0
4 0.0 5 1.0 0.0 0.0 1.0 0.0
4 0.0 6 1.0 1.0 0.0 1.0 0.0
3 0.0 6 0.0 1.0 0.0 1.0 0.0
3 0.0 6 0.0 0.0 0.0 1.0 0.0
4 0.0 6 1.0 0.0 0.0 1.0 0.0
4 0.0 7 1.0 1.0 0.0 1.0 0.0
3 0.0 7 0.0 1.0 0.0 1.0 0.0
3 0.0 7 0.0 0.0 0.0 1.0 0.0
4 0.0 7 1.0 0.0 0.0 1.0 0.0
4 0.0 8 1.0 1.0 0.0 1.0 0.0
3 0.0 8 0.0 1.0 0.0 1.0 0.0
3 0.0 8 0.0 0.0 0.0 1.0 0.0
4 0.0 8 1.0 0.0 0.0 1.0 0.0
4 0.0 9 1.0 1.0 0.0 1.0 0.0
3 0.0 9 0.0 1.0 0.0 1.0 0.0
3 0.0 9 0.0 0.0 0.0 1.0 0.0
4 0.0 9 1.0 0.0 0.0 1.0 0.0
4 0.0 10 1.0 1.0 0.0 1.0 0.0
3 0.0 10 0.0 1.0 0.0 1.0 0.0
4 0.0 0 0.0 0.0 0.0 1.0 0.0
5 0.0 0 1.0 0.0 0.0 1.0 0.0
5 0.0 1 1.0 1.0 0.0 1.0 0.0
4 0.0 1 0.0 1.0 0.0 1.0 0.0
4 0.0 1 0.0 0.0 0.0 1.0 0.0
5 0.0 1 1.0 0.0 0.0 1.0 0.0
5 0.0 2 1.0 1.0 0.0 1.0 0.0
4 0.0 2 0.0 1.0 0.0 1.0 0.0
4 0.0 2 0.0 0.0 0.0 1.0 0.0
5 0.0 2 1.0 0.0 0.0 1.0 0.0
5 0.0 3 1.0 1.0 0.0 1.0 0.0
4 0.0 3 0.0 1.0 0.0 1.0 0.0
4 0.0 3 0.0 0.0 0.0 1.0 0.0
5 0.0 3 1.0 0.0 0.0 1.0 0.0
5 0.0 4 1.0 1.0 0.0 1.0 0.0
4 0.0 4 0.0 1.0 0.0 1.0 0.0
4 0.0 4 0.0 0.0 0.0 1.0 0.0
5 0.0 4 1.0 0.0 0.0 1.0 0.0
5 0.0 5 1.0 1.0 0.0 1.0 0.0
4 0.0 5 0.0 1.0 0.0 1.0 0.0
4 0.0 5 0.0 0.0 0.0 1.0 0.0
5 0.0 5 1.0 0.0 0.0 1.0 0.0
5 0.0 6 1.0 1.0 0.0 1.0 0.0
4 0.0 6 0.0 1.0 0.0 1.0 0.0
4 0.0 6 0.0 0.0 0.0 1.0 0.0
5 0.0 6 1.0 0.0 0.0 1.0 0.0
5 0.0 7 1.0 1.0 0.0 1.0 0.0
4 0.0 7 0.0 1.0 0.0 1.0 0.0
4 0.0 7 0.0 0.0 0.0 1.0 0.0
5 0.0 7 1.0 0.0 0.0 1.0 0.0
5 0.0 8 1.0 1.0 0.0 1.0 0.0
4 0.0 8 0.0 1.0 0.0 1.0 0.0
4 0.0 8 0.0 0.0 0.0 1.0 0.0
5 0.0 8 1.0 0.0 0.0 1.0 0.0
5 0.0 9 1.0 1.0 0.0 1.0 0.0
4 0.0 9 0.0 1.0 0.0 1.0 0.0
4 0.0 9 0.0 0.0 0.0 1.0 0.0
5 0.0 9 1.0 0.0 0.0 1.0 0.0
5 0.0 10 1.0 1.0 0.0 1.0 0.0
4 0.0 10 0.0 1.0 0.0 1.0 0.0
5 0.0 0 0.0 0.0 0.0 1.0 0.0
6 0.0 0 1.0 0.0 0.0 1.0 0.0
6 0.0 1 1.0 1.0 0.0 1.0 0.0
5 0.0 1 0.0 1.0 0.0 1.0 0.0
5 0.0 1 0.0 0.0 0.0 1.0 0.0
6 0.0 1 1.0 0.0 0.0 1.0 0.0
6 0.0 2 1.0 1.0 0.0 1.0 0.0
5 0.0 2 0.0 1.0 0.0 1.0 0.0
5 0.0 2 0.0 0.0 0.0 1.0 0.0
6 0.0 2 1.0 0.0 0.0 1.0 0.0
6 0.0 3 1.0 1.0 0.0 1.0 0.0
5 0.0 3 0.0 1.0 0.0 1.0 0.0
5 0.0 3 0.0 0.0 0.0 1.0 0.0
6 0.0 3 1.0 0.0 0.0 1.0 0.0
6 0.0 4 1.0 1.0 0.0 1.0 0.0
5 0.0 4 0.0 1.0 0.0 1.0 0.0
5 0.0 4 0.0 0.0 0.0 1.0 0.0
6 0.0 4 1.0 0.0 0.0 1.0 0.0
6 0.0 5 1.0 1.0 0.0 1.0 0.0
5 0.0 5 0.0 1.0 0.0 1.0 0.0
5 0.0 5 0.0 0.0 0.0 1.0 0.0
6 0.0 5 1.0 0.0 0.0 1.0 0.0
6 0.0 6 1.0 1.0 0.0 1.0 0.0
5 0.0 6 0.0 1.0 0.0 1.0 0.0
5 0.0 6 0.0 0.0 0.0 1.0 0.0
6 0.0 6 1.0 0.0 0.0 1.0 0.0
6 0.0 7 1.0 1.0 0.0 1.0 0.0
5 0.0 7 0.0 1.0 0.0 1.0 0.0
5 0.0 7 0.0 0.0 0.0 1.0 0.0
6 0.0 7 1.0 0.0 0.0 1.0 0.0
6 0.0 8 1.0 1.0 0.0 1.0 0.0
5 0.0 8 0.0 1.0 0.0 1.0 0.0
5 0.0 8 0.0 0.0 0.0 1.0 0.0
6 0.0 8 1.0 0.0 0.0 1.0 0.0
6 0.0 9 1.0 1.0 0.0 1.0 0.0
5 0.0 9 0.0 1.0 0.0 1.0 0.0
5 0.0 9 0.0 0.0 0.0 1.0 0.0
6 0.0 9 1.0 0.0 0.0 1.0 0.0
6 0.0 10 1.0 1.0 0.0 1.0 0.0
5 0.0 10 0.0 1.0 0.0 1.0 0.0
6 0.0 0 0.0 0.0 0.0 1.0 0.0
7 0.0 0 1.0 0.0 0.0 1.0 0.0
7 0.0 1 1.0 1.0 0.0 1.0 0.0
6 0.0 1 0.0 1.0 0.0 1.0 0.0
6 0.0 1 0.0 0.0 0.0 1.0 0.0
7 0.0 1 1.0 0.0 0.0 1.0 0.0
7 0.0 2 1.0 1.0 0.0 1.0 0.0
6 0.0 2 0.0 1.0 0.0 1.0 0.0
6 0.0 2 0.0 0.0 0.0 1.0 0.0
7 0.0 2 1.0 0.0 0.0 1.0 0.0
7 0.0 3 1.0 1.0 0.0 1.0 0.0
6 0.0 3 0.0 1.0 0.0 1.0 0.0
6 0.0 3 0.0 0.0 0.0 1.0 0.0
7 0.0 3 1.0 0.0 0.0 1.0 0.0
7 0.0 4 1.0 1.0 0.0 1.0 0.0
6 0.0 4 0.0 1.0 0.0 1.0 0.0
6 0.0 4 0.0 0.0 0.0 1.0 0.0
7 0.0 4 1.0 0.0 0.0 1.0 0.0
7 0.0 5 1.0 1.0 0.0 1.0 0.0
6 0.0 5 0.0 1.0 0.0 1.0 0.0
6 0.0 5 0.0 0.0 0.0 1.0 0.0
7 0.0 5 1.0 0.0 0.0 1.0 0.0
7 0.0 6 1.0 1.0 0.0 1.0 0.0
6 0.0 6 0.0 1.0 0.0 1.0 0.0
6 0.0 6 0.0 0.0 0.0 1.0 0.0
7 0.0 6 1.0 0.0 0.0 1.0 0.0
7 0.0 7 1.0 1.0 0.0 1.0 0.0
6 0.0 7 0.0 1.0 0.0 1.0 0.0
6 0.0 7 0.0 0.0 0.0 1.0 0.0
7 0.0 7 1.0 0.0 0.0 1.0 0.0
7 0.0 8 1.0 1.0 0.0 1.0 0.0
6 0.0 8 0.0 1.0 0.0 1.0 0.0
6 0.0 8 0.0 0.0 0.0 1.0 0.0
7 0.0 8 1.0 0.0 0.0 1.0 0.0
7 0.0 9 1.0 1.0 0.0 1.0 0.0
6 0.0 9 0.0 1.0 0.0 1.0 0.0
6 0.0 9 0.0 0.0 0.0 1.0 0.0
7 0.0 9 1.0 0.0 0.0 1.0 0.0
7 0.0 10 1.0 1.0 0.0 1.0 0.0
6 0.0 10 0.0 1.0 0.0 1.0 0.0
7 0.0 0 0.0 0.0 0.0 1.0 0.0
8 0.0 0 1.0 0.0 0.0 1.0 0.0
8 0.0 1 1.0 1.0 0.0 1.0 0.0
7 0.0 1 0.0 1.0 0.0 1.0 0.0
7 0.0 1 0.0 0.0 0.0 1.0 0.0
8 0.0 1 1.0 0.0 0.0 1.0 0.0
8 0.0 2 1.0 1.0 0.0 1.0 0.0
7 0.0 2 0.0 1.0 0.0 1.0 0.0
7 0.0 2 0.0 0.0 0.0 1.0 0.0
8 0.0 2 1.0 0.0 0.0 1.0 0.0
8 0.0 3 1.0 1.0 0.0 1.0 0.0
7 0.0 3 0.0 1.0 0.0 1.0 0.0
7 0.0 3 0.0 0.0 0.0 1.0 0.0
8 0.0 3 1.0 0.0 0.0 1.0 0.0
8 0.0 4 1.0 1.0 0.0 1.0 0.0
7 0.0 4 0.0 1.0 0.0 1.0 0.0
7 0.0 4 0.0 0.0 0.0 1.0 0.0
8 0.0 4 1.0 0.0 0.0 1.0 0.0
8 0.0 5 1.0 1.0 0.0 1.0 0.0
7 0.0 5 0.0 1.0 0.0 1.0 0.0
7 0.0 5 0.0 0.0 0.0 1.0 0.0
8 0.0 5 1.0 0.0 0.0 1.0 0.0
8 0.0 6 1.0 1.0 0.0 1.0 0.0
7 0.0 6 0.0 1.0 0.0 1.0 0.0
7 0.0 6 0.0 0.0 0.0 1.0 0.0
8 0.0 6 1.0 0.0 0.0 1.0 0.0
8 0.0 7 1.0 1.0 0.0 1.0 0.0
7 0.0 7 0.0 1.0 0.0 1.0 0.0
7 0.0 7 0.0 0.0 0.0 1.0 0.0
8 0.0 7 1.0 0.0 0.0 1.0 0.0
8 0.0 8 1.0 1.0 0.0 1.0 0.0
7 0.0 8 0.0 1.0 0.0 1.0 0.0
7 0.0 8 0.0 0.0 0.0 1.0 0.0
8 0.0 8 1.0 0.0 0.0 1.0 0.0
8 0.0 9 1.0 1.0 0.0 1.0 0.0
7 0.0 9 0.0 1.0 0.0 1.0 0.0
7 0.0 9 0.0 0.0 0.0 1.0 0.0
8 0.0 9 1.0 0.0 0.0 1.0 0.0
8 0.0 10 1.0 1.0 0.0 1.0 0.0
7 0.0 10 0.0 1.0 0.0 1.0 0.0
8 0.0 0 0.0 0.0 0.0 1.0 0.0
9 0.0 0 1.0 0.0 0.0 1.0 0.0
9 0.0 1 1.0 1.0 0.0 1.0 0.0
8 0.0 1 0.0 1.0 0.0 1.0 0.0
8 0.0 1 0.0 0.0 0.0 1.0 0.0
9 0.0 1 1.0 0.0 0.0 1.0 0.0
9 0.0 2 1.0 1.0 0.0 1.0 0.0
8 0.0 2 0.0 1.0 0.0 1.0 0.0
8 0.0 2 0.0 0.0 0.0 1.0 0.0
9 0.0 2 1.0 0.0 0.0 1.0 0.0
9 0.0 3 1.0 1.0 0.0 1.0 0.0
8 0.0 3 0.0 1.0 0.0 1.0 0.0
8 0.0 3 0.0 0.0 0.0 1.0 0.0
9 0.0 3 1.0 0.0 0.0 1.0 0.0
9 0.0 4 1.0 1.0 0.0 1.0 0.0
8 0.0 4 0.0 1.0 0.0 1.0 0.0
8 0.0 4 0.0 0.0 0.0 1.0 0.0
9 0.0 4 1.0 0.0 0.0 1.0 0.0
9 0.0 5 1.0 1.0 0.0 1.0 0.0
8 0.0 5 0.0 1.0 0.0 1.0 0.0
8 0.0 5 0.0 0.0 0.0 1.0 0.0
9 0.0 5 1.0 0.0 0.0 1.0 0.0
9 0.0 6 1.0 1.0 0.0 1.0 0.0
8 0.0 6 0.0 1.0 0.0 1.0 0.0
8 0.0 6 0.0 0.0 0.0 1.0 0.0
9 0.0 6 1.0 0.0 0.0 1.0 0.0
9 0.0 7 1.0 1.0 0.0 1.0 0.0
8 0.0 7 0.0 1.0 0.0 1.0 0.0
8 0.0 7 0.0 0.0 0.0 1.0 0.0
9 0.0 7 1.0 0.0 0.0 1.0 0.0
9 0.0 8 1.0 1.0 0.0 1.0 0.0
8 0.0 8 0.0 1.0 0.0 1.0 0.0
8 0.0 8 0.0 0.0 0.0 1.0 0.0
9 0.0 8 1.0 0.0 0.0 1.0 0.0
9 0.0 9 1.0 1.0 0.0 1.0 0.0
8 0.0 9 0.0 1.0 0.0 1.0 0.0
8 0.0 9 0.0 0.0 0.0 1.0 0.0
9 0.0 9 1.0 0.0 0.0 1.0 0.0
9 0.0 10 1.0 1.0 0.0 1.0 0.0
8 0.0 10 0.0 1.0 0.0 1.0 0.0
9 0.0 0 0.0 0.0 0.0 1.0 0.0
10 0.0 0 1.0 0.0 0.0 1.0 0.0
10 0.0 1 1.0 1.0 0.0 1.0 0.0
9 0.0 1 0.0 1.0 0.0 1.0 0.0
9 0.0 1 0.0 0.0 0.0 1.0 0.0
10 0.0 1 1.0 0.0 0.0 1.0 0.0
10 0.0 2 1.0 1.0 0.0 1.0 0.0
9 0.0 2 0.0 1.0 0.0 1.0 0.0
9 0.0 2 0.0 0.0 0.0 1.0 0.0
10 0.0 2 1.0 0.0 0.0 1.0 0.0
10 0.0 3 1.0 1.0 0.0 1.0 0.0
9 0.0 3 0.0 1.0 0.0 1.0 0.0
9 0.0 3 0.0 0.0 0.0 1.0 0.0
10 0.0 3 1.0 0.0 0.0 1.0 0.0
10 0.0 4 1.0 1.0 0.0 1.0 0.0
9 0.0 4 0.0 1.0 0.0 1.0 0.0
9 0.0 4 0.0 0.0 0.0 1.0 0.0
10 0.0 4 1.0 0.0 0.0 1.0 0.0
10 0.0 5 1.0 1.0 0.0 1.0 0.0
9 0.0 5 0.0 1.0 0.0 1.0 0.0
9 0.0 5 0.0 0.0 0.0 1.0 0.0
10 0.0 5 1.0 0.0 0.0 1.0 0.0
10 0.0 6 1.0 1.0 0.0 1.0 0.0
9 0.0 6 0.0 1.0 0.0 1.0 0.0
9 0.0 6 0.0 0.0 0.0 1.0 0.0
10 0.0 6 1.0 0.0 0.0 1.0 0.0
10 0.0 7 1.0 1.0 0.0 1.0 0.0
9 0.0 7 0.0 1.0 0.0 1.0 0.0
9 0.0 7 0.0 0.0 0.0 1.0 0.0
10 0.0 7 1.0 0.0 0.0 1.0 0.0
10 0.0 8 1.0 1.0 0.0 1.0 0.0
9 0.0 8 0.0 1.0 0.0 1.0 0.0
9 0.0 8 0.0 0.0 0.0 1.0 0.0
10 0.0 8 1.0 0.0 0.0 1.0 0.0
10 0.0 9 1.0 1.0 0.0 1.0 0.0
9 0.0 9 0.0 1.0 0.0 1.0 0.0
9 0.0 9 0.0 0.0 0.0 1.0 0.0
10 0.0 9 1.0 0.0 0.0 1.0 0.0
10 0.0 10 1.0 1.0 0.0 1.0 0.0
9 0.0 10 0.0 1.0 0.0 1.0 0.0

View File

@ -0,0 +1,40 @@
Vertex Count: 36
Data:
-1.0 1.0 -1.0 0.0 0.0 0.0 0.0 -1.0
1.0 1.0 -1.0 1.0 0.0 0.0 0.0 -1.0
-1.0 -1.0 -1.0 0.0 1.0 0.0 0.0 -1.0
-1.0 -1.0 -1.0 0.0 1.0 0.0 0.0 -1.0
1.0 1.0 -1.0 1.0 0.0 0.0 0.0 -1.0
1.0 -1.0 -1.0 1.0 1.0 0.0 0.0 -1.0
1.0 1.0 -1.0 0.0 0.0 1.0 0.0 0.0
1.0 1.0 1.0 1.0 0.0 1.0 0.0 0.0
1.0 -1.0 -1.0 0.0 1.0 1.0 0.0 0.0
1.0 -1.0 -1.0 0.0 1.0 1.0 0.0 0.0
1.0 1.0 1.0 1.0 0.0 1.0 0.0 0.0
1.0 -1.0 1.0 1.0 1.0 1.0 0.0 0.0
1.0 1.0 1.0 0.0 0.0 0.0 0.0 1.0
-1.0 1.0 1.0 1.0 0.0 0.0 0.0 1.0
1.0 -1.0 1.0 0.0 1.0 0.0 0.0 1.0
1.0 -1.0 1.0 0.0 1.0 0.0 0.0 1.0
-1.0 1.0 1.0 1.0 0.0 0.0 0.0 1.0
-1.0 -1.0 1.0 1.0 1.0 0.0 0.0 1.0
-1.0 1.0 1.0 0.0 0.0 -1.0 0.0 0.0
-1.0 1.0 -1.0 1.0 0.0 -1.0 0.0 0.0
-1.0 -1.0 1.0 0.0 1.0 -1.0 0.0 0.0
-1.0 -1.0 1.0 0.0 1.0 -1.0 0.0 0.0
-1.0 1.0 -1.0 1.0 0.0 -1.0 0.0 0.0
-1.0 -1.0 -1.0 1.0 1.0 -1.0 0.0 0.0
-1.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0
1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0
-1.0 1.0 -1.0 0.0 1.0 0.0 1.0 0.0
-1.0 1.0 -1.0 0.0 1.0 0.0 1.0 0.0
1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0
1.0 1.0 -1.0 1.0 1.0 0.0 1.0 0.0
-1.0 -1.0 -1.0 0.0 0.0 0.0 -1.0 0.0
1.0 -1.0 -1.0 1.0 0.0 0.0 -1.0 0.0
-1.0 -1.0 1.0 0.0 1.0 0.0 -1.0 0.0
-1.0 -1.0 1.0 0.0 1.0 0.0 -1.0 0.0
1.0 -1.0 -1.0 1.0 0.0 0.0 -1.0 0.0
1.0 -1.0 1.0 1.0 1.0 0.0 -1.0 0.0

View File

@ -0,0 +1,10 @@
Vertex Count: 6
Data:
-20 0 20 0.0 0.0 0 1 0
20 0 -20 1.0 1.0 0 1 0
-20 0 -20 0.0 1.0 0 1 0
20 0 20 1.0 0.0 0 1 0
20 0 -20 1.0 1.0 0 1 0
-20 0 20 0.0 0.0 0 1 0

View File

@ -0,0 +1,10 @@
Vertex Count: 6
Data:
-1.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0
1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0
-1.0 1.0 -1.0 0.0 1.0 0.0 1.0 0.0
-1.0 1.0 -1.0 0.0 1.0 0.0 1.0 0.0
1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0
1.0 1.0 -1.0 1.0 1.0 0.0 1.0 0.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
Vertex Count: 6
Data:
-1.0 1.0 0.0 0.0 0.0 0.0 0.0 -1.0
1.0 1.0 0.0 1.0 0.0 0.0 0.0 -1.0
-1.0 -1.0 0.0 0.0 1.0 0.0 0.0 -1.0
-1.0 -1.0 0.0 0.0 1.0 0.0 0.0 -1.0
1.0 1.0 0.0 1.0 0.0 0.0 0.0 -1.0
1.0 -1.0 0.0 1.0 1.0 0.0 0.0 -1.0

View File

@ -0,0 +1,40 @@
Vertex Count: 36
Data:
-5 5 -0.5 0.001992 0.00199199 0 0 -1
5 -5 -0.5 0.998008 0.998008 0 0 -1
-5 -5 -0.5 0.001992 0.998008 0 0 -1
5 5 -0.5 0.998008 0.00199199 0 0 -1
5 -5 -0.5 0.998008 0.998008 0 0 -1
-5 5 -0.5 0.001992 0.00199199 0 0 -1
-5 5 0.5 0.099801 0.00199199 0 1 -0
5 5 -0.5 0.000199 0.998008 0 1 -0
-5 5 -0.5 0.000199 0.00199199 0 1 -0
5 5 0.5 0.099801 0.998008 0 1 -0
5 5 -0.5 0.000199 0.998008 0 1 -0
-5 5 0.5 0.099801 0.00199199 0 1 -0
-5 -5 0.5 0.001992 0.00199199 0 0 1
5 5 0.5 0.998008 0.998008 0 0 1
-5 5 0.5 0.001992 0.998008 0 0 1
5 -5 0.5 0.998008 0.00199199 0 0 1
5 5 0.5 0.998008 0.998008 0 0 1
-5 -5 0.5 0.001992 0.00199199 0 0 1
-5 -5 -0.5 0.099801 0.00199199 0 -1 -0
5 -5 0.5 0.000199 0.998008 0 -1 -0
-5 -5 0.5 0.000199 0.00199199 0 -1 -0
5 -5 -0.5 0.099801 0.998008 0 -1 -0
5 -5 0.5 0.000199 0.998008 0 -1 -0
-5 -5 -0.5 0.099801 0.00199199 0 -1 -0
5 5 -0.5 0.000199 0.00199199 1 0 -0
5 -5 0.5 0.099801 0.998008 1 0 -0
5 -5 -0.5 0.000199 0.998008 1 0 -0
5 5 0.5 0.099801 0.00199199 1 0 -0
5 -5 0.5 0.099801 0.998008 1 0 -0
5 5 -0.5 0.000199 0.00199199 1 0 -0
-5 5 0.5 0.000199 0.00199199 -1 0 -0
-5 -5 -0.5 0.099801 0.998008 -1 0 -0
-5 -5 0.5 0.000199 0.998008 -1 0 -0
-5 5 -0.5 0.099801 0.00199199 -1 0 -0
-5 -5 -0.5 0.099801 0.998008 -1 0 -0
-5 5 0.5 0.000199 0.00199199 -1 0 -0

View File

@ -0,0 +1,10 @@
Vertex Count: 6
Data:
-4 0 4 0.0 0.0 0 1 0
4 0 -4 1.0 1.0 0 1 0
-4 0 -4 0.0 1.0 0 1 0
4 0 4 1.0 0.0 0 1 0
4 0 -4 1.0 1.0 0 1 0
-4 0 4 0.0 0.0 0 1 0

View File

@ -0,0 +1,24 @@
[Window][Debug##Default]
Pos=60,60
Size=400,400
[Window][Khaotic Engine]
Pos=1120,51
Size=392,273
[Window][Objects]
Pos=930,39
Size=457,294
[Window][Terrain]
Pos=60,60
Size=342,82
[Window][Light]
Pos=1551,17
Size=358,535
[Window][Shader Manager]
Pos=30,255
Size=172,284

View File

@ -0,0 +1,91 @@
[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0
[Window][Khaotic Engine]
Pos=1180,27
Size=396,826
Collapsed=0
DockId=0x00000005,0
[Window][Objects]
Pos=8,442
Size=290,411
Collapsed=0
DockId=0x0000000A,0
[Window][Terrain]
Pos=8,27
Size=290,413
Collapsed=0
DockId=0x00000009,0
[Window][Light]
Pos=8,27
Size=330,487
Collapsed=0
DockId=0x00000004,1
[Window][Shader Manager]
Pos=8,27
Size=330,487
Collapsed=0
DockId=0x00000004,2
[Window][Engine Settings]
Pos=1180,27
Size=396,826
Collapsed=0
DockId=0x00000005,1
[Window][DockSpace Demo]
Size=1584,861
Collapsed=0
[Window][Render Window]
Pos=300,27
Size=878,826
Collapsed=0
DockId=0x00000002,0
[Window][DockSpace]
Pos=0,0
Size=1584,861
Collapsed=0
[Window][Add Object]
Pos=1188,0
Size=396,430
Collapsed=0
[Window][Log]
Pos=8,518
Size=1568,335
Collapsed=0
DockId=0x0000000C,0
[Window][Log Window]
Pos=8,627
Size=1568,226
Collapsed=0
DockId=0x0000000E,0
[Docking][Data]
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Split=Y Selected=0x393905AB
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=330,487 Selected=0x393905AB
DockNode ID=0x00000006 Parent=0x00000001 SizeRef=330,485 Selected=0x031DC75C
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=8,27 Size=1568,826 Split=Y
DockNode ID=0x0000000D Parent=0xCCBD8CF7 SizeRef=1568,598 Split=Y
DockNode ID=0x0000000B Parent=0x0000000D SizeRef=1568,637 Split=X
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=290,826 Split=Y Selected=0x393905AB
DockNode ID=0x00000009 Parent=0x00000007 SizeRef=395,413 Selected=0x393905AB
DockNode ID=0x0000000A Parent=0x00000007 SizeRef=395,411 Selected=0x031DC75C
DockNode ID=0x00000008 Parent=0x0000000B SizeRef=1276,826 Split=X
DockNode ID=0x00000002 Parent=0x00000008 SizeRef=878,826 CentralNode=1 Selected=0x9204953B
DockNode ID=0x00000005 Parent=0x00000008 SizeRef=396,826 Selected=0x9F035453
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=1568,335 Selected=0x139FDA3F
DockNode ID=0x0000000E Parent=0xCCBD8CF7 SizeRef=1568,226 Selected=0xAB74BEE9

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

View File

@ -0,0 +1,101 @@
[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0
[Window][Khaotic Engine]
Pos=1745,19
Size=303,667
Collapsed=0
DockId=0x0000000F,0
[Window][Objects]
Pos=0,19
Size=281,441
Collapsed=0
DockId=0x00000011,0
[Window][Terrain]
Pos=283,19
Size=280,883
Collapsed=0
DockId=0x00000007,0
[Window][Light]
Pos=0,462
Size=281,440
Collapsed=0
DockId=0x00000012,0
[Window][Shader Manager]
Pos=8,27
Size=330,487
Collapsed=0
DockId=0x00000001,2
[Window][Engine Settings]
Pos=1745,688
Size=303,441
Collapsed=0
DockId=0x00000010,0
[Window][DockSpace Demo]
Size=1584,861
Collapsed=0
[Window][Render Window]
Pos=8,27
Size=1559,974
Collapsed=0
DockId=0x00000011,0
[Window][DockSpace]
Pos=0,0
Size=2048,1129
Collapsed=0
[Window][Add Object]
Pos=1188,0
Size=396,430
Collapsed=0
[Window][Log]
Pos=8,518
Size=1568,335
Collapsed=0
DockId=0x0000000C,0
[Window][Log Window]
Pos=873,904
Size=870,225
Collapsed=0
DockId=0x00000006,0
[Window][Render Stats]
Pos=0,904
Size=871,225
Collapsed=0
DockId=0x00000004,0
[Docking][Data]
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=2048,1110 Split=X
DockNode ID=0x00000002 Parent=0xCCBD8CF7 SizeRef=1743,826 Split=Y
DockNode ID=0x0000000A Parent=0x00000002 SizeRef=1568,599 Split=X
DockNode ID=0x00000009 Parent=0x0000000A SizeRef=281,974 Split=Y Selected=0x031DC75C
DockNode ID=0x00000011 Parent=0x00000009 SizeRef=281,441 Selected=0x031DC75C
DockNode ID=0x00000012 Parent=0x00000009 SizeRef=281,440 Selected=0x321620B2
DockNode ID=0x0000000D Parent=0x0000000A SizeRef=1460,974 Split=Y
DockNode ID=0x0000000B Parent=0x0000000D SizeRef=1568,637 Split=X Selected=0x321620B2
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=280,883 Selected=0x393905AB
DockNode ID=0x00000008 Parent=0x0000000B SizeRef=1178,883 CentralNode=1
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=1568,335 Selected=0x139FDA3F
DockNode ID=0x0000000E Parent=0x00000002 SizeRef=1568,225 Split=X Selected=0xD99DEA49
DockNode ID=0x00000004 Parent=0x0000000E SizeRef=871,225 Selected=0xD99DEA49
DockNode ID=0x00000006 Parent=0x0000000E SizeRef=870,225 Selected=0xAB74BEE9
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=303,826 Split=Y Selected=0x9F035453
DockNode ID=0x0000000F Parent=0x00000005 SizeRef=303,667 Selected=0x9F035453
DockNode ID=0x00000010 Parent=0x00000005 SizeRef=303,441 Selected=0x0B098C4B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 917 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

1
CoreLib/assets/empty.ker Normal file
View File

@ -0,0 +1 @@
0 isosphere 0 10 0 1 1 1 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Model\OBJ\isosphere.obj

89
CoreLib/assets/imgui.ini Normal file
View File

@ -0,0 +1,89 @@
[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0
[Window][Khaotic Engine]
Pos=1233,27
Size=343,826
Collapsed=0
DockId=0x00000005,0
[Window][Objects]
Pos=8,27
Size=289,413
Collapsed=0
DockId=0x00000007,0
[Window][Terrain]
Pos=8,442
Size=289,411
Collapsed=0
DockId=0x00000008,0
[Window][Light]
Pos=8,27
Size=290,866
Collapsed=0
DockId=0x00000004,1
[Window][Shader Manager]
Pos=8,27
Size=330,487
Collapsed=0
DockId=0x00000001,2
[Window][Engine Settings]
Pos=1233,27
Size=343,826
Collapsed=0
DockId=0x00000005,1
[Window][DockSpace Demo]
Size=1584,861
Collapsed=0
[Window][Render Window]
Pos=8,27
Size=1559,974
Collapsed=0
DockId=0x00000007,0
[Window][DockSpace]
Pos=0,0
Size=1584,861
Collapsed=0
[Window][Add Object]
Pos=1188,0
Size=396,430
Collapsed=0
[Window][Log]
Pos=8,518
Size=1568,335
Collapsed=0
DockId=0x0000000C,0
[Window][Log Window]
Pos=299,627
Size=932,226
Collapsed=0
DockId=0x00000006,0
[Docking][Data]
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=8,27 Size=1568,826 Split=X
DockNode ID=0x00000009 Parent=0xCCBD8CF7 SizeRef=289,974 Split=Y Selected=0x031DC75C
DockNode ID=0x00000007 Parent=0x00000009 SizeRef=289,299 Selected=0x031DC75C
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=289,297 Selected=0x393905AB
DockNode ID=0x0000000D Parent=0xCCBD8CF7 SizeRef=1613,974 Split=X
DockNode ID=0x00000002 Parent=0x0000000D SizeRef=1268,826 Split=Y
DockNode ID=0x0000000B Parent=0x00000002 SizeRef=1568,637 Split=Y
DockNode ID=0x00000004 Parent=0x0000000B SizeRef=932,598 CentralNode=1
DockNode ID=0x00000006 Parent=0x0000000B SizeRef=932,226 Selected=0xAB74BEE9
DockNode ID=0x0000000C Parent=0x00000002 SizeRef=1568,335 Selected=0x139FDA3F
DockNode ID=0x00000005 Parent=0x0000000D SizeRef=343,826 Selected=0x0B098C4B

0
CoreLib/assets/scene.ker Normal file
View File

487
CoreLib/corelib.vcxproj Normal file
View File

@ -0,0 +1,487 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="include\backends\imgui_impl_dx11.cpp" />
<ClCompile Include="include\backends\imgui_impl_win32.cpp" />
<ClCompile Include="include\imgui.cpp" />
<ClCompile Include="include\imgui_draw.cpp" />
<ClCompile Include="include\imgui_tables.cpp" />
<ClCompile Include="include\imgui_widgets.cpp" />
<ClCompile Include="include\Src\DDSTextureLoader.cpp" />
<ClCompile Include="include\Src\DirectXHelpers.cpp" />
<ClCompile Include="include\Src\pch.cpp" />
<ClCompile Include="include\Src\SimpleMath.cpp" />
<ClCompile Include="include\Src\WICTextureLoader.cpp" />
<ClCompile Include="src\src\shader\alpha_map_shader_class.cpp" />
<ClCompile Include="src\src\shader\celshade_class.cpp" />
<ClCompile Include="src\src\shader\color_shader_class.cpp" />
<ClCompile Include="src\src\shader\depth_shader_class.cpp" />
<ClCompile Include="src\src\shader\font_shader_class.cpp" />
<ClCompile Include="src\src\shader\light_map_shader_class.cpp" />
<ClCompile Include="src\src\shader\light_shader_class.cpp" />
<ClCompile Include="src\src\shader\master_shader.cpp" />
<ClCompile Include="src\src\shader\multi_texture_shader_class.cpp" />
<ClCompile Include="src\src\shader\normal_map_shader_class.cpp" />
<ClCompile Include="src\src\shader\reflection_shader_class.cpp" />
<ClCompile Include="src\src\shader\refraction_shader_class.cpp" />
<ClCompile Include="src\src\shader\shader_manager_class.cpp" />
<ClCompile Include="src\src\shader\skybox_shader_class.cpp" />
<ClCompile Include="src\src\shader\spec_map_shader_class.cpp" />
<ClCompile Include="src\src\shader\sunlight_shader_class.cpp" />
<ClCompile Include="src\src\shader\texture_shader_class.cpp" />
<ClCompile Include="src\src\shader\translate_shader_class.cpp" />
<ClCompile Include="src\src\shader\transparent_shader_class.cpp" />
<ClCompile Include="src\src\shader\water_shader_class.cpp" />
<ClCompile Include="src\src\system\application_class.cpp" />
<ClCompile Include="src\src\system\bitmap_class.cpp" />
<ClCompile Include="src\src\system\camera_class.cpp" />
<ClCompile Include="src\src\system\d_3d_class.cpp" />
<ClCompile Include="src\src\system\display_plane_class.cpp" />
<ClCompile Include="src\src\system\font_class.cpp" />
<ClCompile Include="src\src\system\fps_class.cpp" />
<ClCompile Include="src\src\system\frustum.cpp" />
<ClCompile Include="src\src\system\frustumclass.cpp" />
<ClCompile Include="src\src\system\imguiManager.cpp" />
<ClCompile Include="src\src\system\input_class.cpp" />
<ClCompile Include="src\src\system\light_class.cpp" />
<ClCompile Include="src\src\system\model_class.cpp" />
<ClCompile Include="src\src\system\Modellistclass.cpp" />
<ClCompile Include="src\src\system\object.cpp" />
<ClCompile Include="src\src\system\physics.cpp" />
<ClCompile Include="src\src\system\position_class.cpp" />
<ClCompile Include="src\src\system\render_texture_class.cpp" />
<ClCompile Include="src\src\system\shadow_map.cpp" />
<ClCompile Include="src\src\system\Skybox.cpp" />
<ClCompile Include="src\src\system\sprite_class.cpp" />
<ClCompile Include="src\src\system\system_class.cpp" />
<ClCompile Include="src\src\system\text_class.cpp" />
<ClCompile Include="src\src\system\texture_class.cpp" />
<ClCompile Include="src\src\system\timer_class.cpp" />
<ClCompile Include="src\src\system\vulkan.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\backends\imgui_impl_dx11.h" />
<ClInclude Include="include\backends\imgui_impl_win32.h" />
<ClInclude Include="include\imconfig.h" />
<ClInclude Include="include\imgui.h" />
<ClInclude Include="include\imgui_internal.h" />
<ClInclude Include="include\imstb_rectpack.h" />
<ClInclude Include="include\imstb_textedit.h" />
<ClInclude Include="include\imstb_truetype.h" />
<ClInclude Include="include\Src\CMO.h" />
<ClInclude Include="include\Src\DDS.h" />
<ClInclude Include="include\Src\LoaderHelpers.h" />
<ClInclude Include="include\Src\pch.h" />
<ClInclude Include="include\Src\PlatformHelpers.h" />
<ClInclude Include="src\inc\shader\alpha_map_shader_class.h" />
<ClInclude Include="src\inc\shader\celshade_class.h" />
<ClInclude Include="src\inc\shader\color_shader_class.h" />
<ClInclude Include="src\inc\shader\depth_shader_class.h" />
<ClInclude Include="src\inc\shader\font_shader_class.h" />
<ClInclude Include="src\inc\shader\light_map_shader_class.h" />
<ClInclude Include="src\inc\shader\light_shader_class.h" />
<ClInclude Include="src\inc\shader\master_shader.h" />
<ClInclude Include="src\inc\shader\multi_texture_shader_class.h" />
<ClInclude Include="src\inc\shader\normal_map_shader_class.h" />
<ClInclude Include="src\inc\shader\reflection_shader_class.h" />
<ClInclude Include="src\inc\shader\refraction_shader_class.h" />
<ClInclude Include="src\inc\shader\shader_manager_class.h" />
<ClInclude Include="src\inc\shader\skybox_shader_class.h" />
<ClInclude Include="src\inc\shader\spec_map_shader_class.h" />
<ClInclude Include="src\inc\shader\sunlight_shader_class.h" />
<ClInclude Include="src\inc\shader\texture_shader_class.h" />
<ClInclude Include="src\inc\shader\translate_shader_class.h" />
<ClInclude Include="src\inc\shader\transparent_shader_class.h" />
<ClInclude Include="src\inc\shader\water_shader_class.h" />
<ClInclude Include="src\inc\system\application_class.h" />
<ClInclude Include="src\inc\system\bitmap_class.h" />
<ClInclude Include="src\inc\system\camera_class.h" />
<ClInclude Include="src\inc\system\d_3d_class.h" />
<ClInclude Include="src\inc\system\display_plane_class.h" />
<ClInclude Include="src\inc\system\font_class.h" />
<ClInclude Include="src\inc\system\fps_class.h" />
<ClInclude Include="src\inc\system\fps_limiter.h" />
<ClInclude Include="src\inc\system\frustum.h" />
<ClInclude Include="src\inc\system\frustumclass.h" />
<ClInclude Include="src\inc\system\imguiManager.h" />
<ClInclude Include="src\inc\system\input_class.h" />
<ClInclude Include="src\inc\system\light_class.h" />
<ClInclude Include="src\inc\system\Logger.h" />
<ClInclude Include="src\inc\system\model_class.h" />
<ClInclude Include="src\inc\system\Modellistclass.h" />
<ClInclude Include="src\inc\system\object.h" />
<ClInclude Include="src\inc\system\physics.h" />
<ClInclude Include="src\inc\system\position_class.h" />
<ClInclude Include="src\inc\system\render_texture_class.h" />
<ClInclude Include="src\inc\system\sceneManager.h" />
<ClInclude Include="src\inc\system\shadow_map.h" />
<ClInclude Include="src\inc\system\Skybox.h" />
<ClInclude Include="src\inc\system\sprite_class.h" />
<ClInclude Include="src\inc\system\system_class.h" />
<ClInclude Include="src\inc\system\text_class.h" />
<ClInclude Include="src\inc\system\texture_class.h" />
<ClInclude Include="src\inc\system\timer_class.h" />
<ClInclude Include="src\inc\system\vulkan.h" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="src\hlsl\alphamap.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\alphamap.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\celshading.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\celshading.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\Color.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\Color.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\depth.ps">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<FileType>Document</FileType>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\depth.vs">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<FileType>Document</FileType>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\font.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\font.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\light.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\light.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\lightmap.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\lightmap.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\Multitexture.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\Multitexture.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\normalmap.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\normalmap.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\reflection.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\reflection.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\refraction.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\refraction.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\skybox.ps">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<FileType>Document</FileType>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\skybox.vs">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<FileType>Document</FileType>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\specmap.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\specmap.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\sunlight.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\sunlight.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\texture.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\texture.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\translate.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\translate.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\transparent.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\transparent.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\water.ps">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\water.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="font01.tga" />
<CopyFileToFolders Include="assets\Texture\Bricks2K.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\BricksGLOSS2K.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\BricksNRM2K.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Skybox\skybox.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox</DestinationFolders>
</CopyFileToFolders>
<Image Include="KhaoticIcon.ico" />
<CopyFileToFolders Include="sprite01.tga" />
<CopyFileToFolders Include="sprite02.tga" />
<CopyFileToFolders Include="sprite03.tga" />
<CopyFileToFolders Include="sprite04.tga" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="font01.txt" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resources.rc" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="sprite_data_01.txt" />
</ItemGroup>
<ItemGroup>
<Content Include="TODO.txt" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="assets\Model\OBJ\skysphere.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{01B412A6-5C0C-43E2-8B85-99CCD7979F08}</ProjectGuid>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>CoreLib</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;$(SolutionDir)enginecustom\src\inc\shader;$(SolutionDir)enginecustom\src\inc\system;$(SolutionDir)enginecustom\include\Vulkan\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)enginecustom\include\Vulkan\Lib;$(SolutionDir)enginecustom\include\GLFW\lib-vc2022;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;$(SolutionDir)enginecustom\src\inc\shader;$(SolutionDir)enginecustom\src\inc\system;$(SolutionDir)enginecustom\include\Vulkan\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)enginecustom\include\Vulkan\Lib;$(SolutionDir)enginecustom\include\GLFW\lib-vc2022;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

1
CoreLib/demo.ker Normal file
View File

@ -0,0 +1 @@
1 isosphere 0 10 0 0 -0 0 1 1 1 F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\Content/Assets/Kobject/isosphere.obj SUNLIGHT 1 Unknown 1 0 2 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\stone01.png F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\dirt01.png 1 assets/Texture/BricksNRM2K.png 1 assets/Texture/BricksGLOSS2K.png 1 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\alpha01.png

View File

@ -0,0 +1,519 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Fichiers sources">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Fichiers d%27en-tête">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Fichiers de ressources">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="shader">
<UniqueIdentifier>{b016e481-576e-4d99-bdde-34cc10c55b1d}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers d%27en-tête\ImGui">
<UniqueIdentifier>{dcad57f9-720f-4170-b850-be65a68a8e67}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers sources\ImGui">
<UniqueIdentifier>{2f09e599-272c-4cd3-b095-62c0b10b439b}</UniqueIdentifier>
</Filter>
<Filter Include="Texture">
<UniqueIdentifier>{e7aac2a1-4fc0-42c7-b92f-15d3aec3736b}</UniqueIdentifier>
</Filter>
<Filter Include="Fonts">
<UniqueIdentifier>{39c57c7f-e726-4443-8fbc-734e2d0c97d8}</UniqueIdentifier>
</Filter>
<Filter Include="Assets">
<UniqueIdentifier>{2978535b-193d-4876-83be-1c3c4470db62}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers sources\DirectX Tool Kit">
<UniqueIdentifier>{3bfbc604-3b39-4e49-bee2-b942fc5dce8c}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers d%27en-tête\DirectX Tool Kit">
<UniqueIdentifier>{d710c862-b37d-4ad5-aa92-2456f9745881}</UniqueIdentifier>
</Filter>
<Filter Include="Assets\Texture">
<UniqueIdentifier>{4873a73d-d11c-4d40-b847-b6d7fef4b23d}</UniqueIdentifier>
</Filter>
<Filter Include="Assets\Model">
<UniqueIdentifier>{3f3824c5-8a66-4f02-9845-1a9538336592}</UniqueIdentifier>
</Filter>
<Filter Include="Assets\Model\OBJ">
<UniqueIdentifier>{22651df1-90a4-4a19-8b97-5147b27d975a}</UniqueIdentifier>
</Filter>
<Filter Include="Assets\Model\TXT">
<UniqueIdentifier>{f67d85e0-106e-47a1-bb9c-a5ea9111509a}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers d%27en-tête\Shader">
<UniqueIdentifier>{e087647e-a306-4246-9320-bab0830bb634}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers sources\Shader">
<UniqueIdentifier>{3c669b93-a9fd-4b74-813f-f9780413f76b}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers sources\System">
<UniqueIdentifier>{b2659b1e-695d-488e-9a1c-341691d312bc}</UniqueIdentifier>
</Filter>
<Filter Include="Assets\Skybox">
<UniqueIdentifier>{4bfa47c6-e23c-4cae-a7af-3fc870a448e4}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers d%27en-tête\System">
<UniqueIdentifier>{567548ae-97a4-413e-8d44-86d6e8252487}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="include\backends\imgui_impl_dx11.cpp">
<Filter>Fichiers sources\ImGui</Filter>
</ClCompile>
<ClCompile Include="include\imgui_draw.cpp">
<Filter>Fichiers sources\ImGui</Filter>
</ClCompile>
<ClCompile Include="include\imgui.cpp">
<Filter>Fichiers sources\ImGui</Filter>
</ClCompile>
<ClCompile Include="include\backends\imgui_impl_win32.cpp">
<Filter>Fichiers sources\ImGui</Filter>
</ClCompile>
<ClCompile Include="include\imgui_tables.cpp">
<Filter>Fichiers sources\ImGui</Filter>
</ClCompile>
<ClCompile Include="include\imgui_widgets.cpp">
<Filter>Fichiers sources\ImGui</Filter>
</ClCompile>
<ClCompile Include="include\Src\DDSTextureLoader.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile>
<ClCompile Include="include\Src\DirectXHelpers.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile>
<ClCompile Include="include\Src\pch.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile>
<ClCompile Include="include\Src\SimpleMath.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile>
<ClCompile Include="include\Src\WICTextureLoader.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile>
<ClCompile Include="src\src\system\frustum.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\frustumclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\imguiManager.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\Main.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\Modellistclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\object.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\physics.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\vulkan.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\Skybox.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\alpha_map_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\celshade_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\color_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\depth_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\font_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\light_map_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\light_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\master_shader.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\multi_texture_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\normal_map_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\reflection_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\refraction_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\shader_manager_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\skybox_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\spec_map_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\sunlight_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\texture_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\translate_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\transparent_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\water_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\application_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\bitmap_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\camera_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\d_3d_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\display_plane_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\font_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\fps_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\input_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\light_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\model_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\position_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\render_texture_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\shadow_map.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\sprite_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\system_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\text_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\texture_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\timer_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\imconfig.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude>
<ClInclude Include="include\imgui.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude>
<ClInclude Include="include\imgui_internal.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude>
<ClInclude Include="include\imstb_rectpack.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude>
<ClInclude Include="include\imstb_textedit.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude>
<ClInclude Include="include\imstb_truetype.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude>
<ClInclude Include="include\backends\imgui_impl_dx11.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude>
<ClInclude Include="include\backends\imgui_impl_win32.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude>
<ClInclude Include="include\Src\CMO.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude>
<ClInclude Include="include\Src\DDS.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude>
<ClInclude Include="include\Src\LoaderHelpers.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude>
<ClInclude Include="include\Src\pch.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude>
<ClInclude Include="include\Src\PlatformHelpers.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\frustum.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\frustumclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\imguiManager.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\Logger.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\Modellistclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\object.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\physics.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\sceneManager.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\vulkan.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\Skybox.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\alpha_map_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\celshade_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\color_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\depth_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\font_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\light_map_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\light_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\master_shader.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\multi_texture_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\normal_map_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\reflection_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\refraction_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\shader_manager_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\skybox_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\spec_map_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\sunlight_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\texture_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\translate_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\transparent_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\water_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\application_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\bitmap_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\camera_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\d_3d_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\display_plane_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\font_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\fps_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\fps_limiter.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\input_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\light_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\model_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\position_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\render_texture_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\shadow_map.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\sprite_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\system_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\text_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\texture_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\timer_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="KhaoticIcon.ico">
<Filter>Assets</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resources.rc">
<Filter>Fichiers de ressources</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="font01.txt">
<Filter>Fonts</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="font01.tga">
<Filter>fonts</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="sprite_data_01.txt">
<Filter>Assets</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="sprite01.tga">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="sprite02.tga">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="sprite03.tga">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="sprite04.tga">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\alphamap.ps" />
<CopyFileToFolders Include="src\hlsl\alphamap.vs" />
<CopyFileToFolders Include="src\hlsl\celshading.ps" />
<CopyFileToFolders Include="src\hlsl\celshading.vs" />
<CopyFileToFolders Include="src\hlsl\Color.ps" />
<CopyFileToFolders Include="src\hlsl\Color.vs" />
<CopyFileToFolders Include="src\hlsl\font.ps" />
<CopyFileToFolders Include="src\hlsl\font.vs" />
<CopyFileToFolders Include="src\hlsl\light.ps" />
<CopyFileToFolders Include="src\hlsl\light.vs" />
<CopyFileToFolders Include="src\hlsl\lightmap.ps" />
<CopyFileToFolders Include="src\hlsl\lightmap.vs" />
<CopyFileToFolders Include="src\hlsl\Multitexture.ps" />
<CopyFileToFolders Include="src\hlsl\Multitexture.vs" />
<CopyFileToFolders Include="src\hlsl\normalmap.ps" />
<CopyFileToFolders Include="src\hlsl\normalmap.vs" />
<CopyFileToFolders Include="src\hlsl\reflection.ps" />
<CopyFileToFolders Include="src\hlsl\reflection.vs" />
<CopyFileToFolders Include="src\hlsl\refraction.ps" />
<CopyFileToFolders Include="src\hlsl\refraction.vs" />
<CopyFileToFolders Include="src\hlsl\specmap.ps" />
<CopyFileToFolders Include="src\hlsl\specmap.vs" />
<CopyFileToFolders Include="src\hlsl\sunlight.ps" />
<CopyFileToFolders Include="src\hlsl\sunlight.vs" />
<CopyFileToFolders Include="src\hlsl\texture.ps" />
<CopyFileToFolders Include="src\hlsl\texture.vs" />
<CopyFileToFolders Include="src\hlsl\translate.ps" />
<CopyFileToFolders Include="src\hlsl\translate.vs" />
<CopyFileToFolders Include="src\hlsl\transparent.ps" />
<CopyFileToFolders Include="src\hlsl\transparent.vs" />
<CopyFileToFolders Include="src\hlsl\water.ps" />
<CopyFileToFolders Include="src\hlsl\water.vs" />
<CopyFileToFolders Include="src\hlsl\skybox.ps" />
<CopyFileToFolders Include="src\hlsl\skybox.vs" />
<CopyFileToFolders Include="assets\Model\OBJ\skysphere.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\BricksNRM2K.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\BricksGLOSS2K.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\Bricks2K.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Skybox\skybox.png">
<Filter>Assets\Skybox</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\depth.ps" />
<CopyFileToFolders Include="src\hlsl\depth.vs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

BIN
CoreLib/font01.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

95
CoreLib/font01.txt Normal file
View File

@ -0,0 +1,95 @@
32 0.0 0.0 0
33 ! 0.0 0.00390625 4
34 " 0.0048828125 0.0107421875 6
35 # 0.01171875 0.025390625 14
36 $ 0.0263671875 0.0390625 13
37 % 0.0400390625 0.0546875 15
38 & 0.0556640625 0.0693359375 14
39 ' 0.0703125 0.0732421875 3
40 ( 0.07421875 0.0791015625 5
41 ) 0.080078125 0.0849609375 5
42 * 0.0859375 0.091796875 6
43 + 0.0927734375 0.103515625 11
44 , 0.1044921875 0.107421875 3
45 - 0.1083984375 0.1142578125 6
46 . 0.115234375 0.1181640625 3
47 / 0.119140625 0.126953125 8
48 0 0.1279296875 0.1416015625 14
49 1 0.142578125 0.146484375 4
50 2 0.1474609375 0.1591796875 12
51 3 0.16015625 0.1708984375 11
52 4 0.171875 0.1845703125 13
53 5 0.185546875 0.1962890625 11
54 6 0.197265625 0.2099609375 13
55 7 0.2109375 0.22265625 12
56 8 0.2236328125 0.236328125 13
57 9 0.2373046875 0.2490234375 12
58 : 0.25 0.2529296875 3
59 ; 0.25390625 0.2568359375 3
60 < 0.2578125 0.267578125 10
61 = 0.2685546875 0.279296875 11
62 > 0.2802734375 0.2900390625 10
63 ? 0.291015625 0.302734375 12
64 @ 0.3037109375 0.3173828125 14
65 A 0.318359375 0.33203125 14
66 B 0.3330078125 0.3447265625 12
67 C 0.345703125 0.3564453125 11
68 D 0.357421875 0.3701171875 13
69 E 0.37109375 0.3818359375 11
70 F 0.3828125 0.3935546875 11
71 G 0.39453125 0.40625 12
72 H 0.4072265625 0.41796875 11
73 I 0.4189453125 0.421875 3
74 J 0.4228515625 0.4326171875 10
75 K 0.43359375 0.4443359375 11
76 L 0.4453125 0.4541015625 9
77 M 0.455078125 0.4697265625 15
78 N 0.470703125 0.482421875 12
79 O 0.4833984375 0.49609375 13
80 P 0.4970703125 0.5078125 12
81 Q 0.509765625 0.5224609375 13
82 R 0.5234375 0.53515625 12
83 S 0.5361328125 0.548828125 13
84 T 0.5498046875 0.5615234375 12
85 U 0.5625 0.57421875 12
86 V 0.5751953125 0.5888671875 14
87 W 0.58984375 0.609375 20
88 X 0.6103515625 0.6220703125 12
89 Y 0.623046875 0.6357421875 13
90 Z 0.63671875 0.6474609375 11
91 [ 0.6484375 0.654296875 6
92 \ 0.6552734375 0.6630859375 8
93 ] 0.6640625 0.6689453125 5
94 ^ 0.669921875 0.6806640625 11
95 _ 0.681640625 0.6904296875 9
96 ` 0.69140625 0.6962890625 5
97 a 0.697265625 0.70703125 10
98 b 0.7080078125 0.7177734375 10
99 c 0.71875 0.7275390625 9
100 d 0.728515625 0.73828125 10
101 e 0.7392578125 0.748046875 9
102 f 0.7490234375 0.755859375 7
103 g 0.7568359375 0.7666015625 10
104 h 0.767578125 0.7763671875 9
105 i 0.77734375 0.7802734375 3
106 j 0.78125 0.7861328125 5
107 k 0.787109375 0.796875 10
108 l 0.7978515625 0.80078125 3
109 m 0.8017578125 0.8154296875 14
110 n 0.81640625 0.826171875 10
111 o 0.8271484375 0.8369140625 10
112 p 0.837890625 0.84765625 10
113 q 0.8486328125 0.8583984375 10
114 r 0.859375 0.8671875 8
115 s 0.8681640625 0.8779296875 10
116 t 0.87890625 0.8857421875 7
117 u 0.88671875 0.8955078125 9
118 v 0.896484375 0.908203125 12
119 w 0.9091796875 0.9248046875 16
120 x 0.92578125 0.935546875 10
121 y 0.9365234375 0.9453125 9
122 z 0.9462890625 0.9560546875 10
123 { 0.95703125 0.9638671875 7
124 | 0.96484375 0.966796875 2
125 } 0.9677734375 0.974609375 7
126 ~ 0.9755859375 0.986328125 11

BIN
CoreLib/ground01.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

106
CoreLib/imgui.ini Normal file
View File

@ -0,0 +1,106 @@
[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0
[Window][Khaotic Engine]
Pos=1281,19
Size=303,842
Collapsed=0
DockId=0x0000000F,0
[Window][Objects]
Pos=0,19
Size=281,307
Collapsed=0
DockId=0x00000011,0
[Window][Terrain]
Pos=0,19
Size=280,842
Collapsed=0
DockId=0x00000007,0
[Window][Light]
Pos=0,19
Size=281,842
Collapsed=0
DockId=0x00000012,0
[Window][Shader Manager]
Pos=8,27
Size=330,487
Collapsed=0
DockId=0x00000001,2
[Window][Engine Settings]
Pos=1281,527
Size=303,334
Collapsed=0
DockId=0x00000010,0
[Window][DockSpace Demo]
Size=1584,861
Collapsed=0
[Window][Render Window]
Pos=8,27
Size=1559,974
Collapsed=0
DockId=0x00000011,0
[Window][DockSpace]
Pos=0,0
Size=1584,861
Collapsed=0
[Window][Add Object]
Pos=1188,0
Size=396,430
Collapsed=0
[Window][Log]
Pos=8,518
Size=1568,335
Collapsed=0
DockId=0x0000000C,0
[Window][Log Window]
Pos=0,636
Size=1279,225
Collapsed=0
DockId=0x00000006,0
[Window][Render Stats]
Pos=0,636
Size=1279,225
Collapsed=0
DockId=0x00000004,0
[Window][render Window]
Pos=16,718
Size=997,758
Collapsed=1
[Docking][Data]
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=X
DockNode ID=0x00000002 Parent=0xCCBD8CF7 SizeRef=1743,826 Split=Y
DockNode ID=0x0000000A Parent=0x00000002 SizeRef=1568,599 Split=X
DockNode ID=0x00000009 Parent=0x0000000A SizeRef=281,974 Split=Y Selected=0x031DC75C
DockNode ID=0x00000011 Parent=0x00000009 SizeRef=281,441 Selected=0x031DC75C
DockNode ID=0x00000012 Parent=0x00000009 SizeRef=281,440 Selected=0x321620B2
DockNode ID=0x0000000D Parent=0x0000000A SizeRef=1460,974 Split=Y
DockNode ID=0x0000000B Parent=0x0000000D SizeRef=1568,637 Split=X Selected=0x321620B2
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=280,883 Selected=0x393905AB
DockNode ID=0x00000008 Parent=0x0000000B SizeRef=1178,883 CentralNode=1 Selected=0x4FC83240
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=1568,335 Selected=0x139FDA3F
DockNode ID=0x0000000E Parent=0x00000002 SizeRef=1568,225 Split=X Selected=0xD99DEA49
DockNode ID=0x00000004 Parent=0x0000000E SizeRef=871,225 Selected=0xD99DEA49
DockNode ID=0x00000006 Parent=0x0000000E SizeRef=870,225 Selected=0xAB74BEE9
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=303,826 Split=Y Selected=0x9F035453
DockNode ID=0x0000000F Parent=0x00000005 SizeRef=303,667 Selected=0x9F035453
DockNode ID=0x00000010 Parent=0x00000005 SizeRef=303,441 Selected=0x0B098C4B

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,663 @@
/*************************************************************************
* GLFW 3.4 - www.glfw.org
* A library for OpenGL, window and input
*------------------------------------------------------------------------
* Copyright (c) 2002-2006 Marcus Geelnard
* Copyright (c) 2006-2018 Camilla Löwy <elmindreda@glfw.org>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*
*************************************************************************/
#ifndef _glfw3_native_h_
#define _glfw3_native_h_
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************
* Doxygen documentation
*************************************************************************/
/*! @file glfw3native.h
* @brief The header of the native access functions.
*
* This is the header file of the native access functions. See @ref native for
* more information.
*/
/*! @defgroup native Native access
* @brief Functions related to accessing native handles.
*
* **By using the native access functions you assert that you know what you're
* doing and how to fix problems caused by using them. If you don't, you
* shouldn't be using them.**
*
* Before the inclusion of @ref glfw3native.h, you may define zero or more
* window system API macro and zero or more context creation API macros.
*
* The chosen backends must match those the library was compiled for. Failure
* to do this will cause a link-time error.
*
* The available window API macros are:
* * `GLFW_EXPOSE_NATIVE_WIN32`
* * `GLFW_EXPOSE_NATIVE_COCOA`
* * `GLFW_EXPOSE_NATIVE_X11`
* * `GLFW_EXPOSE_NATIVE_WAYLAND`
*
* The available context API macros are:
* * `GLFW_EXPOSE_NATIVE_WGL`
* * `GLFW_EXPOSE_NATIVE_NSGL`
* * `GLFW_EXPOSE_NATIVE_GLX`
* * `GLFW_EXPOSE_NATIVE_EGL`
* * `GLFW_EXPOSE_NATIVE_OSMESA`
*
* These macros select which of the native access functions that are declared
* and which platform-specific headers to include. It is then up your (by
* definition platform-specific) code to handle which of these should be
* defined.
*
* If you do not want the platform-specific headers to be included, define
* `GLFW_NATIVE_INCLUDE_NONE` before including the @ref glfw3native.h header.
*
* @code
* #define GLFW_EXPOSE_NATIVE_WIN32
* #define GLFW_EXPOSE_NATIVE_WGL
* #define GLFW_NATIVE_INCLUDE_NONE
* #include <GLFW/glfw3native.h>
* @endcode
*/
/*************************************************************************
* System headers and types
*************************************************************************/
#if !defined(GLFW_NATIVE_INCLUDE_NONE)
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
/* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
* example to allow applications to correctly declare a GL_KHR_debug callback)
* but windows.h assumes no one will define APIENTRY before it does
*/
#if defined(GLFW_APIENTRY_DEFINED)
#undef APIENTRY
#undef GLFW_APIENTRY_DEFINED
#endif
#include <windows.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
#if defined(__OBJC__)
#import <Cocoa/Cocoa.h>
#else
#include <ApplicationServices/ApplicationServices.h>
#include <objc/objc.h>
#endif
#endif
#if defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
#include <wayland-client.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_WGL)
/* WGL is declared by windows.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
/* NSGL is declared by Cocoa.h */
#endif
#if defined(GLFW_EXPOSE_NATIVE_GLX)
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
* default it also acts as an OpenGL header
* However, glx.h will include gl.h, which will define it unconditionally
*/
#if defined(GLFW_GLAPIENTRY_DEFINED)
#undef GLAPIENTRY
#undef GLFW_GLAPIENTRY_DEFINED
#endif
#include <GL/glx.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
#include <EGL/egl.h>
#endif
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
/* This is a workaround for the fact that glfw3.h defines GLAPIENTRY because by
* default it also acts as an OpenGL header
* However, osmesa.h will include gl.h, which will define it unconditionally
*/
#if defined(GLFW_GLAPIENTRY_DEFINED)
#undef GLAPIENTRY
#undef GLFW_GLAPIENTRY_DEFINED
#endif
#include <GL/osmesa.h>
#endif
#endif /*GLFW_NATIVE_INCLUDE_NONE*/
/*************************************************************************
* Functions
*************************************************************************/
#if defined(GLFW_EXPOSE_NATIVE_WIN32)
/*! @brief Returns the adapter device name of the specified monitor.
*
* @return The UTF-8 encoded adapter device name (for example `\\.\DISPLAY1`)
* of the specified monitor, or `NULL` if an [error](@ref error_handling)
* occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetWin32Adapter(GLFWmonitor* monitor);
/*! @brief Returns the display device name of the specified monitor.
*
* @return The UTF-8 encoded display device name (for example
* `\\.\DISPLAY1\Monitor0`) of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetWin32Monitor(GLFWmonitor* monitor);
/*! @brief Returns the `HWND` of the specified window.
*
* @return The `HWND` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
* function.
* @code
* HDC dc = GetDC(glfwGetWin32Window(window));
* @endcode
* This DC is private and does not need to be released.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI HWND glfwGetWin32Window(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_WGL)
/*! @brief Returns the `HGLRC` of the specified window.
*
* @return The `HGLRC` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
*
* @remark The `HDC` associated with the window can be queried with the
* [GetDC](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getdc)
* function.
* @code
* HDC dc = GetDC(glfwGetWin32Window(window));
* @endcode
* This DC is private and does not need to be released.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI HGLRC glfwGetWGLContext(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_COCOA)
/*! @brief Returns the `CGDirectDisplayID` of the specified monitor.
*
* @return The `CGDirectDisplayID` of the specified monitor, or
* `kCGNullDirectDisplay` if an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* monitor);
/*! @brief Returns the `NSWindow` of the specified window.
*
* @return The `NSWindow` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI id glfwGetCocoaWindow(GLFWwindow* window);
/*! @brief Returns the `NSView` of the specified window.
*
* @return The `NSView` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.4.
*
* @ingroup native
*/
GLFWAPI id glfwGetCocoaView(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_NSGL)
/*! @brief Returns the `NSOpenGLContext` of the specified window.
*
* @return The `NSOpenGLContext` of the specified window, or `nil` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_NO_WINDOW_CONTEXT.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI id glfwGetNSGLContext(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_X11)
/*! @brief Returns the `Display` used by GLFW.
*
* @return The `Display` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI Display* glfwGetX11Display(void);
/*! @brief Returns the `RRCrtc` of the specified monitor.
*
* @return The `RRCrtc` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI RRCrtc glfwGetX11Adapter(GLFWmonitor* monitor);
/*! @brief Returns the `RROutput` of the specified monitor.
*
* @return The `RROutput` of the specified monitor, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.1.
*
* @ingroup native
*/
GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* monitor);
/*! @brief Returns the `Window` of the specified window.
*
* @return The `Window` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI Window glfwGetX11Window(GLFWwindow* window);
/*! @brief Sets the current primary selection to the specified string.
*
* @param[in] string A UTF-8 encoded string.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
*
* @pointer_lifetime The specified string is copied before this function
* returns.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref clipboard
* @sa glfwGetX11SelectionString
* @sa glfwSetClipboardString
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI void glfwSetX11SelectionString(const char* string);
/*! @brief Returns the contents of the current primary selection as a string.
*
* If the selection is empty or if its contents cannot be converted, `NULL`
* is returned and a @ref GLFW_FORMAT_UNAVAILABLE error is generated.
*
* @return The contents of the selection as a UTF-8 encoded string, or `NULL`
* if an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_UNAVAILABLE and @ref GLFW_PLATFORM_ERROR.
*
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
* should not free it yourself. It is valid until the next call to @ref
* glfwGetX11SelectionString or @ref glfwSetX11SelectionString, or until the
* library is terminated.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref clipboard
* @sa glfwSetX11SelectionString
* @sa glfwGetClipboardString
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI const char* glfwGetX11SelectionString(void);
#endif
#if defined(GLFW_EXPOSE_NATIVE_GLX)
/*! @brief Returns the `GLXContext` of the specified window.
*
* @return The `GLXContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
/*! @brief Returns the `GLXWindow` of the specified window.
*
* @return The `GLXWindow` of the specified window, or `None` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_NO_WINDOW_CONTEXT and @ref GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
/*! @brief Returns the `struct wl_display*` used by GLFW.
*
* @return The `struct wl_display*` used by GLFW, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_display* glfwGetWaylandDisplay(void);
/*! @brief Returns the `struct wl_output*` of the specified monitor.
*
* @return The `struct wl_output*` of the specified monitor, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_output* glfwGetWaylandMonitor(GLFWmonitor* monitor);
/*! @brief Returns the main `struct wl_surface*` of the specified window.
*
* @return The main `struct wl_surface*` of the specified window, or `NULL` if
* an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_UNAVAILABLE.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.2.
*
* @ingroup native
*/
GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_EGL)
/*! @brief Returns the `EGLDisplay` used by GLFW.
*
* @return The `EGLDisplay` used by GLFW, or `EGL_NO_DISPLAY` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
*
* @remark Because EGL is initialized on demand, this function will return
* `EGL_NO_DISPLAY` until the first context has been created via EGL.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLDisplay glfwGetEGLDisplay(void);
/*! @brief Returns the `EGLContext` of the specified window.
*
* @return The `EGLContext` of the specified window, or `EGL_NO_CONTEXT` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NO_WINDOW_CONTEXT.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
/*! @brief Returns the `EGLSurface` of the specified window.
*
* @return The `EGLSurface` of the specified window, or `EGL_NO_SURFACE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NO_WINDOW_CONTEXT.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)
/*! @brief Retrieves the color buffer associated with the specified window.
*
* @param[in] window The window whose color buffer to retrieve.
* @param[out] width Where to store the width of the color buffer, or `NULL`.
* @param[out] height Where to store the height of the color buffer, or `NULL`.
* @param[out] format Where to store the OSMesa pixel format of the color
* buffer, or `NULL`.
* @param[out] buffer Where to store the address of the color buffer, or
* `NULL`.
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NO_WINDOW_CONTEXT.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI int glfwGetOSMesaColorBuffer(GLFWwindow* window, int* width, int* height, int* format, void** buffer);
/*! @brief Retrieves the depth buffer associated with the specified window.
*
* @param[in] window The window whose depth buffer to retrieve.
* @param[out] width Where to store the width of the depth buffer, or `NULL`.
* @param[out] height Where to store the height of the depth buffer, or `NULL`.
* @param[out] bytesPerValue Where to store the number of bytes per depth
* buffer element, or `NULL`.
* @param[out] buffer Where to store the address of the depth buffer, or
* `NULL`.
* @return `GLFW_TRUE` if successful, or `GLFW_FALSE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NO_WINDOW_CONTEXT.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height, int* bytesPerValue, void** buffer);
/*! @brief Returns the `OSMesaContext` of the specified window.
*
* @return The `OSMesaContext` of the specified window, or `NULL` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_NO_WINDOW_CONTEXT.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.3.
*
* @ingroup native
*/
GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _glfw3_native_h_ */

832
CoreLib/include/Inc/Audio.h Normal file
View File

@ -0,0 +1,832 @@
//--------------------------------------------------------------------------------------
// File: Audio.h
//
// DirectXTK for Audio header
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
//--------------------------------------------------------------------------------------
#pragma once
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <vector>
#include <objbase.h>
#include <mmreg.h>
#include <Audioclient.h>
#if (defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX)
#include <xma2defs.h>
#ifdef _MSC_VER
#pragma comment(lib,"acphal.lib")
#endif
#endif
#ifndef XAUDIO2_HELPER_FUNCTIONS
#define XAUDIO2_HELPER_FUNCTIONS
#endif
#if defined(USING_XAUDIO2_REDIST) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/) || defined(_XBOX_ONE)
#define USING_XAUDIO2_9
#elif (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
#define USING_XAUDIO2_8
#elif (_WIN32_WINNT >= 0x0601 /*_WIN32_WINNT_WIN7*/)
#error Windows 7 SP1 requires the XAudio2Redist NuGet package https://aka.ms/xaudio2redist
#else
#error DirectX Tool Kit for Audio not supported on this platform
#endif
#include <xaudio2.h>
#include <xaudio2fx.h>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4619 4616 5246)
#endif
#include <x3daudio.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include <xapofx.h>
#if !defined(USING_XAUDIO2_REDIST) && defined(_MSC_VER)
#if defined(USING_XAUDIO2_8) && defined(NTDDI_WIN10) && !defined(_M_IX86)
// The xaudio2_8.lib in the Windows 10 SDK for x86 is incorrectly annotated as __cdecl instead of __stdcall, so avoid using it in this case.
#pragma comment(lib,"xaudio2_8.lib")
#else
#pragma comment(lib,"xaudio2.lib")
#endif
#endif
#include <DirectXMath.h>
namespace DirectX
{
class SoundEffectInstance;
class SoundStreamInstance;
//----------------------------------------------------------------------------------
struct AudioStatistics
{
size_t playingOneShots; // Number of one-shot sounds currently playing
size_t playingInstances; // Number of sound effect instances currently playing
size_t allocatedInstances; // Number of SoundEffectInstance allocated
size_t allocatedVoices; // Number of XAudio2 voices allocated (standard, 3D, one-shots, and idle one-shots)
size_t allocatedVoices3d; // Number of XAudio2 voices allocated for 3D
size_t allocatedVoicesOneShot; // Number of XAudio2 voices allocated for one-shot sounds
size_t allocatedVoicesIdle; // Number of XAudio2 voices allocated for one-shot sounds but not currently in use
size_t audioBytes; // Total wave data (in bytes) in SoundEffects and in-memory WaveBanks
#if (defined(_XBOX_ONE) && defined(_TITLE)) || defined(_GAMING_XBOX)
size_t xmaAudioBytes; // Total wave data (in bytes) in SoundEffects and in-memory WaveBanks allocated with ApuAlloc
#endif
size_t streamingBytes; // Total size of streaming buffers (in bytes) in streaming WaveBanks
};
//----------------------------------------------------------------------------------
class IVoiceNotify
{
public:
virtual ~IVoiceNotify() = default;
IVoiceNotify(const IVoiceNotify&) = delete;
IVoiceNotify& operator=(const IVoiceNotify&) = delete;
IVoiceNotify(IVoiceNotify&&) = default;
IVoiceNotify& operator=(IVoiceNotify&&) = default;
virtual void __cdecl OnBufferEnd() = 0;
// Notfication that a voice buffer has finished
// Note this is called from XAudio2's worker thread, so it should perform very minimal and thread-safe operations
virtual void __cdecl OnCriticalError() = 0;
// Notification that the audio engine encountered a critical error
virtual void __cdecl OnReset() = 0;
// Notification of an audio engine reset
virtual void __cdecl OnUpdate() = 0;
// Notification of an audio engine per-frame update (opt-in)
virtual void __cdecl OnDestroyEngine() noexcept = 0;
// Notification that the audio engine is being destroyed
virtual void __cdecl OnTrim() = 0;
// Notification of a request to trim the voice pool
virtual void __cdecl GatherStatistics(AudioStatistics& stats) const = 0;
// Contribute to statistics request
virtual void __cdecl OnDestroyParent() noexcept = 0;
// Optional notification used by some objects
protected:
IVoiceNotify() = default;
};
//----------------------------------------------------------------------------------
enum AUDIO_ENGINE_FLAGS : uint32_t
{
AudioEngine_Default = 0x0,
AudioEngine_EnvironmentalReverb = 0x1,
AudioEngine_ReverbUseFilters = 0x2,
AudioEngine_UseMasteringLimiter = 0x4,
AudioEngine_Debug = 0x10000,
AudioEngine_ThrowOnNoAudioHW = 0x20000,
AudioEngine_DisableVoiceReuse = 0x40000,
};
enum SOUND_EFFECT_INSTANCE_FLAGS : uint32_t
{
SoundEffectInstance_Default = 0x0,
SoundEffectInstance_Use3D = 0x1,
SoundEffectInstance_ReverbUseFilters = 0x2,
SoundEffectInstance_NoSetPitch = 0x4,
SoundEffectInstance_UseRedirectLFE = 0x10000,
};
enum AUDIO_ENGINE_REVERB : unsigned int
{
Reverb_Off,
Reverb_Default,
Reverb_Generic,
Reverb_Forest,
Reverb_PaddedCell,
Reverb_Room,
Reverb_Bathroom,
Reverb_LivingRoom,
Reverb_StoneRoom,
Reverb_Auditorium,
Reverb_ConcertHall,
Reverb_Cave,
Reverb_Arena,
Reverb_Hangar,
Reverb_CarpetedHallway,
Reverb_Hallway,
Reverb_StoneCorridor,
Reverb_Alley,
Reverb_City,
Reverb_Mountains,
Reverb_Quarry,
Reverb_Plain,
Reverb_ParkingLot,
Reverb_SewerPipe,
Reverb_Underwater,
Reverb_SmallRoom,
Reverb_MediumRoom,
Reverb_LargeRoom,
Reverb_MediumHall,
Reverb_LargeHall,
Reverb_Plate,
Reverb_MAX
};
enum SoundState
{
STOPPED = 0,
PLAYING,
PAUSED
};
//----------------------------------------------------------------------------------
class AudioEngine
{
public:
explicit AudioEngine(
AUDIO_ENGINE_FLAGS flags = AudioEngine_Default,
_In_opt_ const WAVEFORMATEX* wfx = nullptr,
_In_opt_z_ const wchar_t* deviceId = nullptr,
AUDIO_STREAM_CATEGORY category = AudioCategory_GameEffects) noexcept(false);
AudioEngine(AudioEngine&&) noexcept;
AudioEngine& operator= (AudioEngine&&) noexcept;
AudioEngine(AudioEngine const&) = delete;
AudioEngine& operator= (AudioEngine const&) = delete;
virtual ~AudioEngine();
bool __cdecl Update();
// Performs per-frame processing for the audio engine, returns false if in 'silent mode'
bool __cdecl Reset(_In_opt_ const WAVEFORMATEX* wfx = nullptr, _In_opt_z_ const wchar_t* deviceId = nullptr);
// Reset audio engine from critical error/silent mode using a new device; can also 'migrate' the graph
// Returns true if succesfully reset, false if in 'silent mode' due to no default device
// Note: One shots are lost, all SoundEffectInstances are in the STOPPED state after successful reset
void __cdecl Suspend() noexcept;
void __cdecl Resume();
// Suspend/resumes audio processing (i.e. global pause/resume)
float __cdecl GetMasterVolume() const noexcept;
void __cdecl SetMasterVolume(float volume);
// Master volume property for all sounds
void __cdecl SetReverb(AUDIO_ENGINE_REVERB reverb);
void __cdecl SetReverb(_In_opt_ const XAUDIO2FX_REVERB_PARAMETERS* native);
// Sets environmental reverb for 3D positional audio (if active)
void __cdecl SetMasteringLimit(int release, int loudness);
// Sets the mastering volume limiter properties (if active)
AudioStatistics __cdecl GetStatistics() const;
// Gathers audio engine statistics
WAVEFORMATEXTENSIBLE __cdecl GetOutputFormat() const noexcept;
// Returns the format of the audio output device associated with the mastering voice.
uint32_t __cdecl GetChannelMask() const noexcept;
// Returns the output channel mask
int __cdecl GetOutputSampleRate() const noexcept;
// Returns the sample rate going into the mastering voice
unsigned int __cdecl GetOutputChannels() const noexcept;
// Returns the number of channels going into the mastering voice
bool __cdecl IsAudioDevicePresent() const noexcept;
// Returns true if the audio graph is operating normally, false if in 'silent mode'
bool __cdecl IsCriticalError() const noexcept;
// Returns true if the audio graph is halted due to a critical error (which also places the engine into 'silent mode')
// Voice pool management.
void __cdecl SetDefaultSampleRate(int sampleRate);
// Sample rate for voices in the reuse pool (defaults to 44100)
void __cdecl SetMaxVoicePool(size_t maxOneShots, size_t maxInstances);
// Maximum number of voices to allocate for one-shots and instances
// Note: one-shots over this limit are ignored; too many instance voices throws an exception
void __cdecl TrimVoicePool();
// Releases any currently unused voices
// Internal-use functions
void __cdecl AllocateVoice(_In_ const WAVEFORMATEX* wfx,
SOUND_EFFECT_INSTANCE_FLAGS flags, bool oneshot, _Outptr_result_maybenull_ IXAudio2SourceVoice** voice);
void __cdecl DestroyVoice(_In_ IXAudio2SourceVoice* voice) noexcept;
// Should only be called for instance voices, not one-shots
void __cdecl RegisterNotify(_In_ IVoiceNotify* notify, bool usesUpdate);
void __cdecl UnregisterNotify(_In_ IVoiceNotify* notify, bool usesOneShots, bool usesUpdate);
// XAudio2 interface access
IXAudio2* __cdecl GetInterface() const noexcept;
IXAudio2MasteringVoice* __cdecl GetMasterVoice() const noexcept;
IXAudio2SubmixVoice* __cdecl GetReverbVoice() const noexcept;
X3DAUDIO_HANDLE& __cdecl Get3DHandle() const noexcept;
// Static functions
struct RendererDetail
{
std::wstring deviceId;
std::wstring description;
};
static std::vector<RendererDetail> __cdecl GetRendererDetails();
// Returns a list of valid audio endpoint devices
#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)
explicit AudioEngine(
AUDIO_ENGINE_FLAGS flags = AudioEngine_Default,
_In_opt_ const WAVEFORMATEX* wfx = nullptr,
_In_opt_z_ const __wchar_t* deviceId = nullptr,
AUDIO_STREAM_CATEGORY category = AudioCategory_GameEffects) noexcept(false);
bool __cdecl Reset(_In_opt_ const WAVEFORMATEX* wfx = nullptr, _In_opt_z_ const __wchar_t* deviceId = nullptr);
#endif
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
//----------------------------------------------------------------------------------
class WaveBank
{
public:
WaveBank(_In_ AudioEngine* engine, _In_z_ const wchar_t* wbFileName);
WaveBank(WaveBank&&) noexcept;
WaveBank& operator= (WaveBank&&) noexcept;
WaveBank(WaveBank const&) = delete;
WaveBank& operator= (WaveBank const&) = delete;
virtual ~WaveBank();
void __cdecl Play(unsigned int index);
void __cdecl Play(unsigned int index, float volume, float pitch, float pan);
void __cdecl Play(_In_z_ const char* name);
void __cdecl Play(_In_z_ const char* name, float volume, float pitch, float pan);
std::unique_ptr<SoundEffectInstance> __cdecl CreateInstance(unsigned int index,
SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default);
std::unique_ptr<SoundEffectInstance> __cdecl CreateInstance(_In_z_ const char* name,
SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default);
std::unique_ptr<SoundStreamInstance> __cdecl CreateStreamInstance(unsigned int index,
SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default);
std::unique_ptr<SoundStreamInstance> __cdecl CreateStreamInstance(_In_z_ const char* name,
SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default);
bool __cdecl IsPrepared() const noexcept;
bool __cdecl IsInUse() const noexcept;
bool __cdecl IsStreamingBank() const noexcept;
bool __cdecl IsAdvancedFormat() const noexcept;
size_t __cdecl GetSampleSizeInBytes(unsigned int index) const noexcept;
// Returns size of wave audio data
size_t __cdecl GetSampleDuration(unsigned int index) const noexcept;
// Returns the duration in samples
size_t __cdecl GetSampleDurationMS(unsigned int index) const noexcept;
// Returns the duration in milliseconds
const WAVEFORMATEX* __cdecl GetFormat(unsigned int index, _Out_writes_bytes_(maxsize) WAVEFORMATEX* wfx, size_t maxsize) const noexcept;
int __cdecl Find(_In_z_ const char* name) const;
#ifdef USING_XAUDIO2_9
bool __cdecl FillSubmitBuffer(unsigned int index, _Out_ XAUDIO2_BUFFER& buffer, _Out_ XAUDIO2_BUFFER_WMA& wmaBuffer) const;
#else
void __cdecl FillSubmitBuffer(unsigned int index, _Out_ XAUDIO2_BUFFER& buffer) const;
#endif
void __cdecl UnregisterInstance(_In_ IVoiceNotify* instance);
HANDLE __cdecl GetAsyncHandle() const noexcept;
bool __cdecl GetPrivateData(unsigned int index, _Out_writes_bytes_(datasize) void* data, size_t datasize);
#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)
WaveBank(_In_ AudioEngine* engine, _In_z_ const __wchar_t* wbFileName);
#endif
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
//----------------------------------------------------------------------------------
class SoundEffect
{
public:
SoundEffect(_In_ AudioEngine* engine, _In_z_ const wchar_t* waveFileName);
SoundEffect(_In_ AudioEngine* engine, _Inout_ std::unique_ptr<uint8_t[]>& wavData,
_In_ const WAVEFORMATEX* wfx, _In_reads_bytes_(audioBytes) const uint8_t* startAudio, size_t audioBytes);
SoundEffect(_In_ AudioEngine* engine, _Inout_ std::unique_ptr<uint8_t[]>& wavData,
_In_ const WAVEFORMATEX* wfx, _In_reads_bytes_(audioBytes) const uint8_t* startAudio, size_t audioBytes,
uint32_t loopStart, uint32_t loopLength);
#ifdef USING_XAUDIO2_9
SoundEffect(_In_ AudioEngine* engine, _Inout_ std::unique_ptr<uint8_t[]>& wavData,
_In_ const WAVEFORMATEX* wfx, _In_reads_bytes_(audioBytes) const uint8_t* startAudio, size_t audioBytes,
_In_reads_(seekCount) const uint32_t* seekTable, size_t seekCount);
#endif
SoundEffect(SoundEffect&&) noexcept;
SoundEffect& operator= (SoundEffect&&) noexcept;
SoundEffect(SoundEffect const&) = delete;
SoundEffect& operator= (SoundEffect const&) = delete;
virtual ~SoundEffect();
void __cdecl Play();
void __cdecl Play(float volume, float pitch, float pan);
std::unique_ptr<SoundEffectInstance> __cdecl CreateInstance(SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default);
bool __cdecl IsInUse() const noexcept;
size_t __cdecl GetSampleSizeInBytes() const noexcept;
// Returns size of wave audio data
size_t __cdecl GetSampleDuration() const noexcept;
// Returns the duration in samples
size_t __cdecl GetSampleDurationMS() const noexcept;
// Returns the duration in milliseconds
const WAVEFORMATEX* __cdecl GetFormat() const noexcept;
#ifdef USING_XAUDIO2_9
bool __cdecl FillSubmitBuffer(_Out_ XAUDIO2_BUFFER& buffer, _Out_ XAUDIO2_BUFFER_WMA& wmaBuffer) const;
#else
void __cdecl FillSubmitBuffer(_Out_ XAUDIO2_BUFFER& buffer) const;
#endif
void __cdecl UnregisterInstance(_In_ IVoiceNotify* instance);
#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)
SoundEffect(_In_ AudioEngine* engine, _In_z_ const __wchar_t* waveFileName);
#endif
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
//----------------------------------------------------------------------------------
struct AudioListener : public X3DAUDIO_LISTENER
{
X3DAUDIO_CONE ListenerCone;
AudioListener() noexcept :
X3DAUDIO_LISTENER{},
ListenerCone{}
{
OrientFront.z = -1.f;
OrientTop.y = 1.f;
}
void XM_CALLCONV SetPosition(FXMVECTOR v) noexcept
{
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&Position), v);
}
void __cdecl SetPosition(const XMFLOAT3& pos) noexcept
{
Position.x = pos.x;
Position.y = pos.y;
Position.z = pos.z;
}
void XM_CALLCONV SetVelocity(FXMVECTOR v) noexcept
{
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&Velocity), v);
}
void __cdecl SetVelocity(const XMFLOAT3& vel) noexcept
{
Velocity.x = vel.x;
Velocity.y = vel.y;
Velocity.z = vel.z;
}
void XM_CALLCONV SetOrientation(FXMVECTOR forward, FXMVECTOR up) noexcept
{
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientFront), forward);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientTop), up);
}
void __cdecl SetOrientation(const XMFLOAT3& forward, const XMFLOAT3& up) noexcept
{
OrientFront.x = forward.x; OrientTop.x = up.x;
OrientFront.y = forward.y; OrientTop.y = up.y;
OrientFront.z = forward.z; OrientTop.z = up.z;
}
void XM_CALLCONV SetOrientationFromQuaternion(FXMVECTOR quat) noexcept
{
const XMVECTOR forward = XMVector3Rotate(g_XMIdentityR2, quat);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientFront), forward);
const XMVECTOR up = XMVector3Rotate(g_XMIdentityR1, quat);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientTop), up);
}
// Updates velocity and orientation by tracking changes in position over time.
void XM_CALLCONV Update(FXMVECTOR newPos, XMVECTOR upDir, float dt) noexcept
{
if (dt > 0.f)
{
const XMVECTOR lastPos = XMLoadFloat3(reinterpret_cast<const XMFLOAT3*>(&Position));
XMVECTOR vDelta = XMVectorSubtract(newPos, lastPos);
const XMVECTOR vt = XMVectorReplicate(dt);
XMVECTOR v = XMVectorDivide(vDelta, vt);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&Velocity), v);
vDelta = XMVector3Normalize(vDelta);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientFront), vDelta);
v = XMVector3Cross(upDir, vDelta);
v = XMVector3Normalize(v);
v = XMVector3Cross(vDelta, v);
v = XMVector3Normalize(v);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientTop), v);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&Position), newPos);
}
}
void __cdecl SetOmnidirectional() noexcept
{
pCone = nullptr;
}
void __cdecl SetCone(const X3DAUDIO_CONE& listenerCone);
bool __cdecl IsValid() const;
};
//----------------------------------------------------------------------------------
struct AudioEmitter : public X3DAUDIO_EMITTER
{
X3DAUDIO_CONE EmitterCone;
float EmitterAzimuths[XAUDIO2_MAX_AUDIO_CHANNELS];
AudioEmitter() noexcept :
X3DAUDIO_EMITTER{},
EmitterCone{},
EmitterAzimuths{}
{
OrientFront.z = -1.f;
OrientTop.y =
ChannelRadius =
CurveDistanceScaler =
DopplerScaler = 1.f;
ChannelCount = 1;
pChannelAzimuths = EmitterAzimuths;
InnerRadiusAngle = X3DAUDIO_PI / 4.0f;
}
void XM_CALLCONV SetPosition(FXMVECTOR v) noexcept
{
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&Position), v);
}
void __cdecl SetPosition(const XMFLOAT3& pos) noexcept
{
Position.x = pos.x;
Position.y = pos.y;
Position.z = pos.z;
}
void XM_CALLCONV SetVelocity(FXMVECTOR v) noexcept
{
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&Velocity), v);
}
void __cdecl SetVelocity(const XMFLOAT3& vel) noexcept
{
Velocity.x = vel.x;
Velocity.y = vel.y;
Velocity.z = vel.z;
}
void XM_CALLCONV SetOrientation(FXMVECTOR forward, FXMVECTOR up) noexcept
{
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientFront), forward);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientTop), up);
}
void __cdecl SetOrientation(const XMFLOAT3& forward, const XMFLOAT3& up) noexcept
{
OrientFront.x = forward.x; OrientTop.x = up.x;
OrientFront.y = forward.y; OrientTop.y = up.y;
OrientFront.z = forward.z; OrientTop.z = up.z;
}
void XM_CALLCONV SetOrientationFromQuaternion(FXMVECTOR quat) noexcept
{
const XMVECTOR forward = XMVector3Rotate(g_XMIdentityR2, quat);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientFront), forward);
const XMVECTOR up = XMVector3Rotate(g_XMIdentityR1, quat);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientTop), up);
}
// Updates velocity and orientation by tracking changes in position over time.
void XM_CALLCONV Update(FXMVECTOR newPos, XMVECTOR upDir, float dt) noexcept
{
if (dt > 0.f)
{
const XMVECTOR lastPos = XMLoadFloat3(reinterpret_cast<const XMFLOAT3*>(&Position));
XMVECTOR vDelta = XMVectorSubtract(newPos, lastPos);
const XMVECTOR vt = XMVectorReplicate(dt);
XMVECTOR v = XMVectorDivide(vDelta, vt);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&Velocity), v);
vDelta = XMVector3Normalize(vDelta);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientFront), vDelta);
v = XMVector3Cross(upDir, vDelta);
v = XMVector3Normalize(v);
v = XMVector3Cross(vDelta, v);
v = XMVector3Normalize(v);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&OrientTop), v);
XMStoreFloat3(reinterpret_cast<XMFLOAT3*>(&Position), newPos);
}
}
void __cdecl SetOmnidirectional() noexcept
{
pCone = nullptr;
}
// Only used for single-channel emitters.
void __cdecl SetCone(const X3DAUDIO_CONE& emitterCone);
// Set multi-channel emitter azimuths based on speaker configuration geometry.
void __cdecl EnableDefaultMultiChannel(unsigned int channels, float radius = 1.f);
// Set default volume, LFE, LPF, and reverb curves.
void __cdecl EnableDefaultCurves() noexcept;
void __cdecl EnableLinearCurves() noexcept;
void __cdecl EnableInverseSquareCurves() noexcept
{
pVolumeCurve = nullptr;
pLFECurve = nullptr;
pLPFDirectCurve = nullptr;
pLPFReverbCurve = nullptr;
pReverbCurve = nullptr;
}
bool __cdecl IsValid() const;
};
//----------------------------------------------------------------------------------
class SoundEffectInstance
{
public:
SoundEffectInstance(SoundEffectInstance&&) noexcept;
SoundEffectInstance& operator= (SoundEffectInstance&&) noexcept;
SoundEffectInstance(SoundEffectInstance const&) = delete;
SoundEffectInstance& operator= (SoundEffectInstance const&) = delete;
virtual ~SoundEffectInstance();
void __cdecl Play(bool loop = false);
void __cdecl Stop(bool immediate = true) noexcept;
void __cdecl Pause() noexcept;
void __cdecl Resume();
void __cdecl SetVolume(float volume);
void __cdecl SetPitch(float pitch);
void __cdecl SetPan(float pan);
void __cdecl Apply3D(const X3DAUDIO_LISTENER& listener, const X3DAUDIO_EMITTER& emitter, bool rhcoords = true);
bool __cdecl IsLooped() const noexcept;
SoundState __cdecl GetState() noexcept;
unsigned int __cdecl GetChannelCount() const noexcept;
IVoiceNotify* __cdecl GetVoiceNotify() const noexcept;
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
// Private constructors
SoundEffectInstance(_In_ AudioEngine* engine, _In_ SoundEffect* effect, SOUND_EFFECT_INSTANCE_FLAGS flags);
SoundEffectInstance(_In_ AudioEngine* engine, _In_ WaveBank* effect, unsigned int index, SOUND_EFFECT_INSTANCE_FLAGS flags);
friend std::unique_ptr<SoundEffectInstance> __cdecl SoundEffect::CreateInstance(SOUND_EFFECT_INSTANCE_FLAGS);
friend std::unique_ptr<SoundEffectInstance> __cdecl WaveBank::CreateInstance(unsigned int, SOUND_EFFECT_INSTANCE_FLAGS);
};
//----------------------------------------------------------------------------------
class SoundStreamInstance
{
public:
SoundStreamInstance(SoundStreamInstance&&) noexcept;
SoundStreamInstance& operator= (SoundStreamInstance&&) noexcept;
SoundStreamInstance(SoundStreamInstance const&) = delete;
SoundStreamInstance& operator= (SoundStreamInstance const&) = delete;
virtual ~SoundStreamInstance();
void __cdecl Play(bool loop = false);
void __cdecl Stop(bool immediate = true) noexcept;
void __cdecl Pause() noexcept;
void __cdecl Resume();
void __cdecl SetVolume(float volume);
void __cdecl SetPitch(float pitch);
void __cdecl SetPan(float pan);
void __cdecl Apply3D(const X3DAUDIO_LISTENER& listener, const X3DAUDIO_EMITTER& emitter, bool rhcoords = true);
bool __cdecl IsLooped() const noexcept;
SoundState __cdecl GetState() noexcept;
unsigned int __cdecl GetChannelCount() const noexcept;
IVoiceNotify* __cdecl GetVoiceNotify() const noexcept;
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
// Private constructors
SoundStreamInstance(_In_ AudioEngine* engine, _In_ WaveBank* effect, unsigned int index, SOUND_EFFECT_INSTANCE_FLAGS flags);
friend std::unique_ptr<SoundStreamInstance> __cdecl WaveBank::CreateStreamInstance(unsigned int, SOUND_EFFECT_INSTANCE_FLAGS);
};
//----------------------------------------------------------------------------------
class DynamicSoundEffectInstance
{
public:
DynamicSoundEffectInstance(_In_ AudioEngine* engine,
_In_ std::function<void __cdecl(DynamicSoundEffectInstance*)> bufferNeeded,
int sampleRate, int channels, int sampleBits = 16,
SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default);
DynamicSoundEffectInstance(DynamicSoundEffectInstance&&) noexcept;
DynamicSoundEffectInstance& operator= (DynamicSoundEffectInstance&&) noexcept;
DynamicSoundEffectInstance(DynamicSoundEffectInstance const&) = delete;
DynamicSoundEffectInstance& operator= (DynamicSoundEffectInstance const&) = delete;
virtual ~DynamicSoundEffectInstance();
void __cdecl Play();
void __cdecl Stop(bool immediate = true) noexcept;
void __cdecl Pause() noexcept;
void __cdecl Resume();
void __cdecl SetVolume(float volume);
void __cdecl SetPitch(float pitch);
void __cdecl SetPan(float pan);
void __cdecl Apply3D(const X3DAUDIO_LISTENER& listener, const X3DAUDIO_EMITTER& emitter, bool rhcoords = true);
void __cdecl SubmitBuffer(_In_reads_bytes_(audioBytes) const uint8_t* pAudioData, size_t audioBytes);
void __cdecl SubmitBuffer(_In_reads_bytes_(audioBytes) const uint8_t* pAudioData, uint32_t offset, size_t audioBytes);
SoundState __cdecl GetState() noexcept;
size_t __cdecl GetSampleDuration(size_t bytes) const noexcept;
// Returns duration in samples of a buffer of a given size
size_t __cdecl GetSampleDurationMS(size_t bytes) const noexcept;
// Returns duration in milliseconds of a buffer of a given size
size_t __cdecl GetSampleSizeInBytes(uint64_t duration) const noexcept;
// Returns size of a buffer for a duration given in milliseconds
int __cdecl GetPendingBufferCount() const noexcept;
const WAVEFORMATEX* __cdecl GetFormat() const noexcept;
unsigned int __cdecl GetChannelCount() const noexcept;
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#endif
DEFINE_ENUM_FLAG_OPERATORS(AUDIO_ENGINE_FLAGS);
DEFINE_ENUM_FLAG_OPERATORS(SOUND_EFFECT_INSTANCE_FLAGS);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}

View File

@ -0,0 +1,164 @@
//--------------------------------------------------------------------------------------
// File: BufferHelpers.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#include <cassert>
#include <cstddef>
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#include "GraphicsMemory.h"
#else
#include <d3d11_1.h>
#endif
#include <wrl\client.h>
namespace DirectX
{
// Helpers for creating initialized Direct3D buffer resources.
HRESULT __cdecl CreateStaticBuffer(_In_ ID3D11Device* device,
_In_reads_bytes_(count* stride) const void* ptr,
size_t count,
size_t stride,
unsigned int bindFlags,
_COM_Outptr_ ID3D11Buffer** pBuffer) noexcept;
template<typename T>
HRESULT CreateStaticBuffer(_In_ ID3D11Device* device,
_In_reads_(count) T const* data,
size_t count,
unsigned int bindFlags,
_COM_Outptr_ ID3D11Buffer** pBuffer) noexcept
{
return CreateStaticBuffer(device, data, count, sizeof(T), bindFlags, pBuffer);
}
template<typename T>
HRESULT CreateStaticBuffer(_In_ ID3D11Device* device,
T const& data,
unsigned int bindFlags,
_COM_Outptr_ ID3D11Buffer** pBuffer) noexcept
{
return CreateStaticBuffer(device, data.data(), data.size(), sizeof(typename T::value_type), bindFlags, pBuffer);
}
// Helpers for creating texture from memory arrays.
HRESULT __cdecl CreateTextureFromMemory(_In_ ID3D11Device* device,
size_t width,
DXGI_FORMAT format,
const D3D11_SUBRESOURCE_DATA& initData,
_COM_Outptr_opt_ ID3D11Texture1D** texture,
_COM_Outptr_opt_ ID3D11ShaderResourceView** textureView,
unsigned int bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept;
HRESULT __cdecl CreateTextureFromMemory(_In_ ID3D11Device* device,
size_t width, size_t height,
DXGI_FORMAT format,
const D3D11_SUBRESOURCE_DATA& initData,
_COM_Outptr_opt_ ID3D11Texture2D** texture,
_COM_Outptr_opt_ ID3D11ShaderResourceView** textureView,
unsigned int bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept;
HRESULT __cdecl CreateTextureFromMemory(
#if defined(_XBOX_ONE) && defined(_TITLE)
_In_ ID3D11DeviceX* d3dDeviceX,
_In_ ID3D11DeviceContextX* d3dContextX,
#else
_In_ ID3D11Device* device,
_In_ ID3D11DeviceContext* d3dContext,
#endif
size_t width, size_t height,
DXGI_FORMAT format,
const D3D11_SUBRESOURCE_DATA& initData,
_COM_Outptr_opt_ ID3D11Texture2D** texture,
_COM_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
HRESULT __cdecl CreateTextureFromMemory(_In_ ID3D11Device* device,
size_t width, size_t height, size_t depth,
DXGI_FORMAT format,
const D3D11_SUBRESOURCE_DATA& initData,
_COM_Outptr_opt_ ID3D11Texture3D** texture,
_COM_Outptr_opt_ ID3D11ShaderResourceView** textureView,
unsigned int bindFlags = D3D11_BIND_SHADER_RESOURCE) noexcept;
// Strongly typed wrapper around a Direct3D constant buffer.
inline namespace DX11
{
namespace Private
{
// Base class, not to be used directly: clients should access this via the derived PrimitiveBatch<T>.
class ConstantBufferBase
{
protected:
void __cdecl CreateBuffer(_In_ ID3D11Device* device, size_t bytes, _Outptr_ ID3D11Buffer** pBuffer);
};
}
}
template<typename T>
class ConstantBuffer : public DX11::Private::ConstantBufferBase
{
public:
// Constructor.
ConstantBuffer() = default;
explicit ConstantBuffer(_In_ ID3D11Device* device) noexcept(false)
{
CreateBuffer(device, sizeof(T), mConstantBuffer.GetAddressOf());
}
ConstantBuffer(ConstantBuffer&&) = default;
ConstantBuffer& operator= (ConstantBuffer&&) = default;
ConstantBuffer(ConstantBuffer const&) = delete;
ConstantBuffer& operator= (ConstantBuffer const&) = delete;
void Create(_In_ ID3D11Device* device)
{
CreateBuffer(device, sizeof(T), mConstantBuffer.ReleaseAndGetAddressOf());
}
// Writes new data into the constant buffer.
#if defined(_XBOX_ONE) && defined(_TITLE)
void __cdecl SetData(_In_ ID3D11DeviceContext* deviceContext, T const& value, void** grfxMemory)
{
assert(grfxMemory != nullptr);
void* ptr = GraphicsMemory::Get().Allocate(deviceContext, sizeof(T), 64);
assert(ptr != nullptr);
*(T*)ptr = value;
*grfxMemory = ptr;
}
#else
void __cdecl SetData(_In_ ID3D11DeviceContext* deviceContext, T const& value) noexcept
{
assert(mConstantBuffer);
D3D11_MAPPED_SUBRESOURCE mappedResource;
if (SUCCEEDED(deviceContext->Map(mConstantBuffer.Get(), 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource)))
{
*static_cast<T*>(mappedResource.pData) = value;
deviceContext->Unmap(mConstantBuffer.Get(), 0);
}
}
#endif // _XBOX_ONE && _TITLE
// Looks up the underlying D3D constant buffer.
ID3D11Buffer* GetBuffer() const noexcept { return mConstantBuffer.Get(); }
private:
Microsoft::WRL::ComPtr<ID3D11Buffer> mConstantBuffer;
};
}

View File

@ -0,0 +1,72 @@
//--------------------------------------------------------------------------------------
// File: CommonStates.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#endif
#include <memory>
namespace DirectX
{
inline namespace DX11
{
class CommonStates
{
public:
explicit CommonStates(_In_ ID3D11Device* device);
CommonStates(CommonStates&&) noexcept;
CommonStates& operator= (CommonStates&&) noexcept;
CommonStates(CommonStates const&) = delete;
CommonStates& operator= (CommonStates const&) = delete;
virtual ~CommonStates();
// Blend states.
ID3D11BlendState* __cdecl Opaque() const;
ID3D11BlendState* __cdecl AlphaBlend() const;
ID3D11BlendState* __cdecl Additive() const;
ID3D11BlendState* __cdecl NonPremultiplied() const;
// Depth stencil states.
ID3D11DepthStencilState* __cdecl DepthNone() const;
ID3D11DepthStencilState* __cdecl DepthDefault() const;
ID3D11DepthStencilState* __cdecl DepthRead() const;
ID3D11DepthStencilState* __cdecl DepthReverseZ() const;
ID3D11DepthStencilState* __cdecl DepthReadReverseZ() const;
// Rasterizer states.
ID3D11RasterizerState* __cdecl CullNone() const;
ID3D11RasterizerState* __cdecl CullClockwise() const;
ID3D11RasterizerState* __cdecl CullCounterClockwise() const;
ID3D11RasterizerState* __cdecl Wireframe() const;
// Sampler states.
ID3D11SamplerState* __cdecl PointWrap() const;
ID3D11SamplerState* __cdecl PointClamp() const;
ID3D11SamplerState* __cdecl LinearWrap() const;
ID3D11SamplerState* __cdecl LinearClamp() const;
ID3D11SamplerState* __cdecl AnisotropicWrap() const;
ID3D11SamplerState* __cdecl AnisotropicClamp() const;
private:
// Private implementation.
class Impl;
std::shared_ptr<Impl> pImpl;
};
}
}

View File

@ -0,0 +1,182 @@
//--------------------------------------------------------------------------------------
// File: DDSTextureLoader.h
//
// Functions for loading a DDS texture and creating a Direct3D runtime resource for it
//
// Note these functions are useful as a light-weight runtime loader for DDS files. For
// a full-featured DDS file reader, writer, and texture processing pipeline see
// the 'Texconv' sample and the 'DirectXTex' library.
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248926
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#endif
#include <cstddef>
#include <cstdint>
namespace DirectX
{
#ifndef DDS_ALPHA_MODE_DEFINED
#define DDS_ALPHA_MODE_DEFINED
enum DDS_ALPHA_MODE : uint32_t
{
DDS_ALPHA_MODE_UNKNOWN = 0,
DDS_ALPHA_MODE_STRAIGHT = 1,
DDS_ALPHA_MODE_PREMULTIPLIED = 2,
DDS_ALPHA_MODE_OPAQUE = 3,
DDS_ALPHA_MODE_CUSTOM = 4,
};
#endif
inline namespace DX11
{
enum DDS_LOADER_FLAGS : uint32_t
{
DDS_LOADER_DEFAULT = 0,
DDS_LOADER_FORCE_SRGB = 0x1,
DDS_LOADER_IGNORE_SRGB = 0x2,
};
}
// Standard version
HRESULT __cdecl CreateDDSTextureFromMemory(
_In_ ID3D11Device* d3dDevice,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_In_ size_t maxsize = 0,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept;
HRESULT __cdecl CreateDDSTextureFromFile(
_In_ ID3D11Device* d3dDevice,
_In_z_ const wchar_t* szFileName,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_In_ size_t maxsize = 0,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept;
// Standard version with optional auto-gen mipmap support
HRESULT __cdecl CreateDDSTextureFromMemory(
#if defined(_XBOX_ONE) && defined(_TITLE)
_In_ ID3D11DeviceX* d3dDevice,
_In_opt_ ID3D11DeviceContextX* d3dContext,
#else
_In_ ID3D11Device* d3dDevice,
_In_opt_ ID3D11DeviceContext* d3dContext,
#endif
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_In_ size_t maxsize = 0,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept;
HRESULT __cdecl CreateDDSTextureFromFile(
#if defined(_XBOX_ONE) && defined(_TITLE)
_In_ ID3D11DeviceX* d3dDevice,
_In_opt_ ID3D11DeviceContextX* d3dContext,
#else
_In_ ID3D11Device* d3dDevice,
_In_opt_ ID3D11DeviceContext* d3dContext,
#endif
_In_z_ const wchar_t* szFileName,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_In_ size_t maxsize = 0,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept;
// Extended version
HRESULT __cdecl CreateDDSTextureFromMemoryEx(
_In_ ID3D11Device* d3dDevice,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
_In_ size_t maxsize,
_In_ D3D11_USAGE usage,
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ DDS_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept;
HRESULT __cdecl CreateDDSTextureFromFileEx(
_In_ ID3D11Device* d3dDevice,
_In_z_ const wchar_t* szFileName,
_In_ size_t maxsize,
_In_ D3D11_USAGE usage,
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ DDS_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept;
// Extended version with optional auto-gen mipmap support
HRESULT __cdecl CreateDDSTextureFromMemoryEx(
#if defined(_XBOX_ONE) && defined(_TITLE)
_In_ ID3D11DeviceX* d3dDevice,
_In_opt_ ID3D11DeviceContextX* d3dContext,
#else
_In_ ID3D11Device* d3dDevice,
_In_opt_ ID3D11DeviceContext* d3dContext,
#endif
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
_In_ size_t maxsize,
_In_ D3D11_USAGE usage,
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ DDS_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept;
HRESULT __cdecl CreateDDSTextureFromFileEx(
#if defined(_XBOX_ONE) && defined(_TITLE)
_In_ ID3D11DeviceX* d3dDevice,
_In_opt_ ID3D11DeviceContextX* d3dContext,
#else
_In_ ID3D11Device* d3dDevice,
_In_opt_ ID3D11DeviceContext* d3dContext,
#endif
_In_z_ const wchar_t* szFileName,
_In_ size_t maxsize,
_In_ D3D11_USAGE usage,
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ DDS_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr) noexcept;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#endif
inline namespace DX11
{
DEFINE_ENUM_FLAG_OPERATORS(DDS_LOADER_FLAGS);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}

View File

@ -0,0 +1,232 @@
//--------------------------------------------------------------------------------------
// File: DirectXHelpers.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#endif
#ifdef _MSC_VER
#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
#if !defined(_XBOX_ONE) || !defined(_TITLE)
#pragma comment(lib,"dxguid.lib")
#endif
#endif
#endif
#ifndef IID_GRAPHICS_PPV_ARGS
#define IID_GRAPHICS_PPV_ARGS(x) IID_PPV_ARGS(x)
#endif
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <exception>
//
// The core Direct3D headers provide the following helper C++ classes
// CD3D11_RECT
// CD3D11_BOX
// CD3D11_DEPTH_STENCIL_DESC
// CD3D11_BLEND_DESC, CD3D11_BLEND_DESC1
// CD3D11_RASTERIZER_DESC, CD3D11_RASTERIZER_DESC1
// CD3D11_BUFFER_DESC
// CD3D11_TEXTURE1D_DESC
// CD3D11_TEXTURE2D_DESC
// CD3D11_TEXTURE3D_DESC
// CD3D11_SHADER_RESOURCE_VIEW_DESC
// CD3D11_RENDER_TARGET_VIEW_DESC
// CD3D11_VIEWPORT
// CD3D11_DEPTH_STENCIL_VIEW_DESC
// CD3D11_UNORDERED_ACCESS_VIEW_DESC
// CD3D11_SAMPLER_DESC
// CD3D11_QUERY_DESC
// CD3D11_COUNTER_DESC
//
namespace DirectX
{
inline namespace DX11
{
class IEffect;
}
// simliar to std::lock_guard for exception-safe Direct3D resource locking
class MapGuard : public D3D11_MAPPED_SUBRESOURCE
{
public:
MapGuard(_In_ ID3D11DeviceContext* context,
_In_ ID3D11Resource *resource,
_In_ unsigned int subresource,
_In_ D3D11_MAP mapType,
_In_ unsigned int mapFlags) noexcept(false)
: mContext(context), mResource(resource), mSubresource(subresource)
{
HRESULT hr = mContext->Map(resource, subresource, mapType, mapFlags, this);
if (FAILED(hr))
{
throw std::exception();
}
}
MapGuard(MapGuard&&) = delete;
MapGuard& operator= (MapGuard&&) = delete;
MapGuard(MapGuard const&) = delete;
MapGuard& operator= (MapGuard const&) = delete;
~MapGuard()
{
mContext->Unmap(mResource, mSubresource);
}
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-warning-option"
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif
uint8_t* get() const noexcept
{
return static_cast<uint8_t*>(pData);
}
uint8_t* get(size_t slice) const noexcept
{
return static_cast<uint8_t*>(pData) + (slice * DepthPitch);
}
uint8_t* scanline(size_t row) const noexcept
{
return static_cast<uint8_t*>(pData) + (row * RowPitch);
}
uint8_t* scanline(size_t slice, size_t row) const noexcept
{
return static_cast<uint8_t*>(pData) + (slice * DepthPitch) + (row * RowPitch);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
template<typename T>
void copy(_In_reads_(count) T const* data, size_t count) noexcept
{
memcpy(pData, data, count * sizeof(T));
}
template<typename T>
void copy(T const& data) noexcept
{
memcpy(pData, data.data(), data.size() * sizeof(typename T::value_type));
}
private:
ID3D11DeviceContext* mContext;
ID3D11Resource* mResource;
unsigned int mSubresource;
};
// Helper sets a D3D resource name string (used by PIX and debug layer leak reporting).
#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_z_ const char(&name)[TNameLength]) noexcept
{
#if defined(_XBOX_ONE) && defined(_TITLE)
wchar_t wname[MAX_PATH];
int result = MultiByteToWideChar(CP_UTF8, 0, name, TNameLength, wname, MAX_PATH);
if (result > 0)
{
resource->SetName(wname);
}
#else
resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, name);
#endif
}
#else
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D11DeviceChild*, _In_z_ const char(&)[TNameLength]) noexcept
{
}
#endif
#if !defined(NO_D3D11_DEBUG_NAME) && ( defined(_DEBUG) || defined(PROFILE) )
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D11DeviceChild* resource, _In_z_ const wchar_t(&name)[TNameLength])
{
#if defined(_XBOX_ONE) && defined(_TITLE)
resource->SetName(name);
#else
char aname[MAX_PATH];
int result = WideCharToMultiByte(CP_UTF8, 0, name, TNameLength, aname, MAX_PATH, nullptr, nullptr);
if (result > 0)
{
resource->SetPrivateData(WKPDID_D3DDebugObjectName, TNameLength - 1, aname);
}
#endif
}
#else
template<UINT TNameLength>
inline void SetDebugObjectName(_In_ ID3D11DeviceChild*, _In_z_ const wchar_t(&)[TNameLength])
{
}
#endif
inline namespace DX11
{
// Helper to check for power-of-2
template<typename T>
constexpr bool IsPowerOf2(T x) noexcept { return ((x != 0) && !(x & (x - 1))); }
// Helpers for aligning values by a power of 2
template<typename T>
inline T AlignDown(T size, size_t alignment) noexcept
{
if (alignment > 0)
{
assert(((alignment - 1) & alignment) == 0);
auto mask = static_cast<T>(alignment - 1);
return size & ~mask;
}
return size;
}
template<typename T>
inline T AlignUp(T size, size_t alignment) noexcept
{
if (alignment > 0)
{
assert(((alignment - 1) & alignment) == 0);
auto mask = static_cast<T>(alignment - 1);
return (size + mask) & ~mask;
}
return size;
}
}
// Helper for creating a Direct3D input layout to match a shader from an IEffect
HRESULT __cdecl CreateInputLayoutFromEffect(_In_ ID3D11Device* device,
_In_ IEffect* effect,
_In_reads_(count) const D3D11_INPUT_ELEMENT_DESC* desc,
size_t count,
_COM_Outptr_ ID3D11InputLayout** pInputLayout) noexcept;
template<typename T>
HRESULT CreateInputLayoutFromEffect(_In_ ID3D11Device* device,
_In_ IEffect* effect,
_COM_Outptr_ ID3D11InputLayout** pInputLayout) noexcept
{
return CreateInputLayoutFromEffect(device, effect, T::InputElements, T::InputElementCount, pInputLayout);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,329 @@
//--------------------------------------------------------------------------------------
// File: GamePad.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
//--------------------------------------------------------------------------------------
#pragma once
#if !defined(USING_XINPUT) && !defined(USING_GAMEINPUT) && !defined(USING_WINDOWS_GAMING_INPUT)
#ifdef _GAMING_DESKTOP
#include <grdk.h>
#endif
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600))
#define USING_GAMEINPUT
#elif (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/) && !defined(_GAMING_DESKTOP) && !defined(__MINGW32__)
#define USING_WINDOWS_GAMING_INPUT
#elif !defined(_XBOX_ONE)
#define USING_XINPUT
#endif
#endif // !USING_XINPUT && !USING_GAMEINPUT && !USING_WINDOWS_GAMING_INPUT
#ifdef USING_GAMEINPUT
#include <GameInput.h>
#if !defined(_GAMING_XBOX) && defined(_MSC_VER)
#pragma comment(lib,"gameinput.lib")
#endif
#elif defined(USING_WINDOWS_GAMING_INPUT)
#ifdef _MSC_VER
#pragma comment(lib,"runtimeobject.lib")
#endif
#include <string>
#elif defined(_XBOX_ONE)
// Legacy Xbox One XDK uses Windows::Xbox::Input
#elif defined(USING_XINPUT)
#ifdef _MSC_VER
#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/ )
#pragma comment(lib,"xinput.lib")
#else
#pragma comment(lib,"xinput9_1_0.lib")
#endif
#endif
#endif
#include <cstdint>
#include <memory>
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#endif
namespace DirectX
{
class GamePad
{
public:
GamePad() noexcept(false);
GamePad(GamePad&&) noexcept;
GamePad& operator= (GamePad&&) noexcept;
GamePad(GamePad const&) = delete;
GamePad& operator=(GamePad const&) = delete;
virtual ~GamePad();
#if defined(USING_GAMEINPUT) || defined(USING_WINDOWS_GAMING_INPUT) || defined(_XBOX_ONE)
static constexpr int MAX_PLAYER_COUNT = 8;
#else
static constexpr int MAX_PLAYER_COUNT = 4;
#endif
static constexpr int c_MostRecent = -1;
#ifdef USING_GAMEINPUT
static constexpr int c_MergedInput = -2;
#endif
enum DeadZone
{
DEAD_ZONE_INDEPENDENT_AXES = 0,
DEAD_ZONE_CIRCULAR,
DEAD_ZONE_NONE,
};
struct Buttons
{
bool a;
bool b;
bool x;
bool y;
bool leftStick;
bool rightStick;
bool leftShoulder;
bool rightShoulder;
union
{
bool back;
bool view;
};
union
{
bool start;
bool menu;
};
};
struct DPad
{
bool up;
bool down;
bool right;
bool left;
};
struct ThumbSticks
{
float leftX;
float leftY;
float rightX;
float rightY;
};
struct Triggers
{
float left;
float right;
};
struct State
{
bool connected;
uint64_t packet;
Buttons buttons;
DPad dpad;
ThumbSticks thumbSticks;
Triggers triggers;
bool __cdecl IsConnected() const noexcept { return connected; }
// Is the button pressed currently?
bool __cdecl IsAPressed() const noexcept { return buttons.a; }
bool __cdecl IsBPressed() const noexcept { return buttons.b; }
bool __cdecl IsXPressed() const noexcept { return buttons.x; }
bool __cdecl IsYPressed() const noexcept { return buttons.y; }
bool __cdecl IsLeftStickPressed() const noexcept { return buttons.leftStick; }
bool __cdecl IsRightStickPressed() const noexcept { return buttons.rightStick; }
bool __cdecl IsLeftShoulderPressed() const noexcept { return buttons.leftShoulder; }
bool __cdecl IsRightShoulderPressed() const noexcept { return buttons.rightShoulder; }
bool __cdecl IsBackPressed() const noexcept { return buttons.back; }
bool __cdecl IsViewPressed() const noexcept { return buttons.view; }
bool __cdecl IsStartPressed() const noexcept { return buttons.start; }
bool __cdecl IsMenuPressed() const noexcept { return buttons.menu; }
bool __cdecl IsDPadDownPressed() const noexcept { return dpad.down; }
bool __cdecl IsDPadUpPressed() const noexcept { return dpad.up; }
bool __cdecl IsDPadLeftPressed() const noexcept { return dpad.left; }
bool __cdecl IsDPadRightPressed() const noexcept { return dpad.right; }
bool __cdecl IsLeftThumbStickUp() const noexcept { return (thumbSticks.leftY > 0.5f) != 0; }
bool __cdecl IsLeftThumbStickDown() const noexcept { return (thumbSticks.leftY < -0.5f) != 0; }
bool __cdecl IsLeftThumbStickLeft() const noexcept { return (thumbSticks.leftX < -0.5f) != 0; }
bool __cdecl IsLeftThumbStickRight() const noexcept { return (thumbSticks.leftX > 0.5f) != 0; }
bool __cdecl IsRightThumbStickUp() const noexcept { return (thumbSticks.rightY > 0.5f) != 0; }
bool __cdecl IsRightThumbStickDown() const noexcept { return (thumbSticks.rightY < -0.5f) != 0; }
bool __cdecl IsRightThumbStickLeft() const noexcept { return (thumbSticks.rightX < -0.5f) != 0; }
bool __cdecl IsRightThumbStickRight() const noexcept { return (thumbSticks.rightX > 0.5f) != 0; }
bool __cdecl IsLeftTriggerPressed() const noexcept { return (triggers.left > 0.5f) != 0; }
bool __cdecl IsRightTriggerPressed() const noexcept { return (triggers.right > 0.5f) != 0; }
};
struct Capabilities
{
enum Type
{
UNKNOWN = 0,
GAMEPAD,
WHEEL,
ARCADE_STICK,
FLIGHT_STICK,
DANCE_PAD,
GUITAR,
GUITAR_ALTERNATE,
DRUM_KIT,
GUITAR_BASS = 11,
ARCADE_PAD = 19,
};
bool connected;
Type gamepadType;
#ifdef USING_GAMEINPUT
APP_LOCAL_DEVICE_ID id;
#elif defined(USING_WINDOWS_GAMING_INPUT)
std::wstring id;
#else
uint64_t id;
#endif
uint16_t vid;
uint16_t pid;
Capabilities() noexcept : connected(false), gamepadType(UNKNOWN), id{}, vid(0), pid(0) {}
bool __cdecl IsConnected() const noexcept { return connected; }
};
class ButtonStateTracker
{
public:
enum ButtonState
{
UP = 0, // Button is up
HELD = 1, // Button is held down
RELEASED = 2, // Button was just released
PRESSED = 3, // Buton was just pressed
};
ButtonState a;
ButtonState b;
ButtonState x;
ButtonState y;
ButtonState leftStick;
ButtonState rightStick;
ButtonState leftShoulder;
ButtonState rightShoulder;
union
{
ButtonState back;
ButtonState view;
};
union
{
ButtonState start;
ButtonState menu;
};
ButtonState dpadUp;
ButtonState dpadDown;
ButtonState dpadLeft;
ButtonState dpadRight;
ButtonState leftStickUp;
ButtonState leftStickDown;
ButtonState leftStickLeft;
ButtonState leftStickRight;
ButtonState rightStickUp;
ButtonState rightStickDown;
ButtonState rightStickLeft;
ButtonState rightStickRight;
ButtonState leftTrigger;
ButtonState rightTrigger;
#ifdef _PREFAST_
#pragma prefast(push)
#pragma prefast(disable : 26495, "Reset() performs the initialization")
#endif
ButtonStateTracker() noexcept { Reset(); }
#ifdef _PREFAST_
#pragma prefast(pop)
#endif
void __cdecl Update(const State& state) noexcept;
void __cdecl Reset() noexcept;
State __cdecl GetLastState() const noexcept { return lastState; }
private:
State lastState;
};
// Retrieve the current state of the gamepad of the associated player index
State __cdecl GetState(int player, DeadZone deadZoneMode = DEAD_ZONE_INDEPENDENT_AXES);
// Retrieve the current capabilities of the gamepad of the associated player index
Capabilities __cdecl GetCapabilities(int player);
// Set the vibration motor speeds of the gamepad
bool __cdecl SetVibration(int player, float leftMotor, float rightMotor, float leftTrigger = 0.f, float rightTrigger = 0.f) noexcept;
// Handle suspending/resuming
void __cdecl Suspend() noexcept;
void __cdecl Resume() noexcept;
#ifdef USING_GAMEINPUT
void __cdecl RegisterEvents(void* ctrlChanged) noexcept;
// Underlying device access
_Success_(return)
bool __cdecl GetDevice(int player, _Outptr_ IGameInputDevice * *device) noexcept;
#elif defined(USING_WINDOWS_GAMING_INPUT) || defined(_XBOX_ONE)
void __cdecl RegisterEvents(void* ctrlChanged, void* userChanged) noexcept;
#endif
// Singleton
static GamePad& __cdecl Get();
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -0,0 +1,111 @@
//--------------------------------------------------------------------------------------
// File: GeometricPrimitive.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#include "VertexTypes.h"
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>
#include <vector>
#include <DirectXColors.h>
namespace DirectX
{
inline namespace DX11
{
class IEffect;
class GeometricPrimitive
{
public:
GeometricPrimitive(GeometricPrimitive&&) = default;
GeometricPrimitive& operator= (GeometricPrimitive&&) = default;
GeometricPrimitive(GeometricPrimitive const&) = delete;
GeometricPrimitive& operator= (GeometricPrimitive const&) = delete;
using VertexType = VertexPositionNormalTexture;
using VertexCollection = std::vector<VertexType>;
using IndexCollection = std::vector<uint16_t>;
virtual ~GeometricPrimitive();
// Factory methods.
static std::unique_ptr<GeometricPrimitive> __cdecl CreateCube(_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateBox(_In_ ID3D11DeviceContext* deviceContext, const XMFLOAT3& size, bool rhcoords = true, bool invertn = false);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateSphere(_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, size_t tessellation = 16, bool rhcoords = true, bool invertn = false);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateGeoSphere(_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, size_t tessellation = 3, bool rhcoords = true);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateCylinder(_In_ ID3D11DeviceContext* deviceContext, float height = 1, float diameter = 1, size_t tessellation = 32, bool rhcoords = true);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateCone(_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, float height = 1, size_t tessellation = 32, bool rhcoords = true);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateTorus(_In_ ID3D11DeviceContext* deviceContext, float diameter = 1, float thickness = 0.333f, size_t tessellation = 32, bool rhcoords = true);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateTetrahedron(_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateOctahedron(_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateDodecahedron(_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateIcosahedron(_In_ ID3D11DeviceContext* deviceContext, float size = 1, bool rhcoords = true);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateTeapot(_In_ ID3D11DeviceContext* deviceContext, float size = 1, size_t tessellation = 8, bool rhcoords = true);
static std::unique_ptr<GeometricPrimitive> __cdecl CreateCustom(_In_ ID3D11DeviceContext* deviceContext, const VertexCollection& vertices, const IndexCollection& indices);
static void __cdecl CreateCube(VertexCollection& vertices, IndexCollection& indices, float size = 1, bool rhcoords = true);
static void __cdecl CreateBox(VertexCollection& vertices, IndexCollection& indices, const XMFLOAT3& size, bool rhcoords = true, bool invertn = false);
static void __cdecl CreateSphere(VertexCollection& vertices, IndexCollection& indices, float diameter = 1, size_t tessellation = 16, bool rhcoords = true, bool invertn = false);
static void __cdecl CreateGeoSphere(VertexCollection& vertices, IndexCollection& indices, float diameter = 1, size_t tessellation = 3, bool rhcoords = true);
static void __cdecl CreateCylinder(VertexCollection& vertices, IndexCollection& indices, float height = 1, float diameter = 1, size_t tessellation = 32, bool rhcoords = true);
static void __cdecl CreateCone(VertexCollection& vertices, IndexCollection& indices, float diameter = 1, float height = 1, size_t tessellation = 32, bool rhcoords = true);
static void __cdecl CreateTorus(VertexCollection& vertices, IndexCollection& indices, float diameter = 1, float thickness = 0.333f, size_t tessellation = 32, bool rhcoords = true);
static void __cdecl CreateTetrahedron(VertexCollection& vertices, IndexCollection& indices, float size = 1, bool rhcoords = true);
static void __cdecl CreateOctahedron(VertexCollection& vertices, IndexCollection& indices, float size = 1, bool rhcoords = true);
static void __cdecl CreateDodecahedron(VertexCollection& vertices, IndexCollection& indices, float size = 1, bool rhcoords = true);
static void __cdecl CreateIcosahedron(VertexCollection& vertices, IndexCollection& indices, float size = 1, bool rhcoords = true);
static void __cdecl CreateTeapot(VertexCollection& vertices, IndexCollection& indices, float size = 1, size_t tessellation = 8, bool rhcoords = true);
// Draw the primitive.
void XM_CALLCONV Draw(FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
FXMVECTOR color = Colors::White,
_In_opt_ ID3D11ShaderResourceView* texture = nullptr,
bool wireframe = false,
_In_ std::function<void __cdecl()> setCustomState = nullptr) const;
// Draw the primitive using a custom effect.
void __cdecl Draw(_In_ IEffect* effect,
_In_ ID3D11InputLayout* inputLayout,
bool alpha = false, bool wireframe = false,
_In_ std::function<void __cdecl()> setCustomState = nullptr) const;
void __cdecl DrawInstanced(_In_ IEffect* effect,
_In_ ID3D11InputLayout* inputLayout,
uint32_t instanceCount,
bool alpha = false, bool wireframe = false,
uint32_t startInstanceLocation = 0,
_In_ std::function<void __cdecl()> setCustomState = nullptr) const;
// Create input layout for drawing with a custom effect.
void __cdecl CreateInputLayout(_In_ IEffect* effect, _Outptr_ ID3D11InputLayout** inputLayout) const;
static void SetDepthBufferMode(bool reverseZ)
{
s_reversez = reverseZ;
}
private:
static bool s_reversez;
GeometricPrimitive() noexcept(false);
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
}
}

View File

@ -0,0 +1,57 @@
//--------------------------------------------------------------------------------------
// File: GraphicsMemory.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#endif
#include <cstddef>
#include <memory>
namespace DirectX
{
inline namespace DX11
{
class GraphicsMemory
{
public:
#if defined(_XBOX_ONE) && defined(_TITLE)
GraphicsMemory(_In_ ID3D11DeviceX* device, unsigned int backBufferCount = 2);
#else
GraphicsMemory(_In_ ID3D11Device* device, unsigned int backBufferCount = 2);
#endif
GraphicsMemory(GraphicsMemory&&) noexcept;
GraphicsMemory& operator= (GraphicsMemory&&) noexcept;
GraphicsMemory(GraphicsMemory const&) = delete;
GraphicsMemory& operator=(GraphicsMemory const&) = delete;
virtual ~GraphicsMemory();
void* __cdecl Allocate(_In_opt_ ID3D11DeviceContext* context, size_t size, int alignment);
void __cdecl Commit();
// Singleton
static GraphicsMemory& __cdecl Get();
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
}
}

View File

@ -0,0 +1,532 @@
//--------------------------------------------------------------------------------------
// File: Keyboard.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
//--------------------------------------------------------------------------------------
#pragma once
#if !defined(USING_XINPUT) && !defined(USING_GAMEINPUT) && !defined(USING_COREWINDOW)
#ifdef _GAMING_DESKTOP
#include <grdk.h>
#endif
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600))
#define USING_GAMEINPUT
#elif (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) || (defined(_XBOX_ONE) && defined(_TITLE))
#define USING_COREWINDOW
#endif
#endif // !USING_XINPUT && !USING_GAMEINPUT && !USING_WINDOWS_GAMING_INPUT
#if defined(USING_GAMEINPUT) && !defined(_GAMING_XBOX) && defined(_MSC_VER)
#pragma comment(lib,"gameinput.lib")
#endif
#include <cstdint>
#include <memory>
#ifdef USING_COREWINDOW
namespace ABI { namespace Windows { namespace UI { namespace Core { struct ICoreWindow; } } } }
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#endif
namespace DirectX
{
class Keyboard
{
public:
Keyboard() noexcept(false);
Keyboard(Keyboard&&) noexcept;
Keyboard& operator= (Keyboard&&) noexcept;
Keyboard(Keyboard const&) = delete;
Keyboard& operator=(Keyboard const&) = delete;
virtual ~Keyboard();
enum Keys : unsigned char
{
None = 0,
Back = 0x8,
Tab = 0x9,
Enter = 0xd,
Pause = 0x13,
CapsLock = 0x14,
Kana = 0x15,
ImeOn = 0x16,
Kanji = 0x19,
ImeOff = 0x1a,
Escape = 0x1b,
ImeConvert = 0x1c,
ImeNoConvert = 0x1d,
Space = 0x20,
PageUp = 0x21,
PageDown = 0x22,
End = 0x23,
Home = 0x24,
Left = 0x25,
Up = 0x26,
Right = 0x27,
Down = 0x28,
Select = 0x29,
Print = 0x2a,
Execute = 0x2b,
PrintScreen = 0x2c,
Insert = 0x2d,
Delete = 0x2e,
Help = 0x2f,
D0 = 0x30,
D1 = 0x31,
D2 = 0x32,
D3 = 0x33,
D4 = 0x34,
D5 = 0x35,
D6 = 0x36,
D7 = 0x37,
D8 = 0x38,
D9 = 0x39,
A = 0x41,
B = 0x42,
C = 0x43,
D = 0x44,
E = 0x45,
F = 0x46,
G = 0x47,
H = 0x48,
I = 0x49,
J = 0x4a,
K = 0x4b,
L = 0x4c,
M = 0x4d,
N = 0x4e,
O = 0x4f,
P = 0x50,
Q = 0x51,
R = 0x52,
S = 0x53,
T = 0x54,
U = 0x55,
V = 0x56,
W = 0x57,
X = 0x58,
Y = 0x59,
Z = 0x5a,
LeftWindows = 0x5b,
RightWindows = 0x5c,
Apps = 0x5d,
Sleep = 0x5f,
NumPad0 = 0x60,
NumPad1 = 0x61,
NumPad2 = 0x62,
NumPad3 = 0x63,
NumPad4 = 0x64,
NumPad5 = 0x65,
NumPad6 = 0x66,
NumPad7 = 0x67,
NumPad8 = 0x68,
NumPad9 = 0x69,
Multiply = 0x6a,
Add = 0x6b,
Separator = 0x6c,
Subtract = 0x6d,
Decimal = 0x6e,
Divide = 0x6f,
F1 = 0x70,
F2 = 0x71,
F3 = 0x72,
F4 = 0x73,
F5 = 0x74,
F6 = 0x75,
F7 = 0x76,
F8 = 0x77,
F9 = 0x78,
F10 = 0x79,
F11 = 0x7a,
F12 = 0x7b,
F13 = 0x7c,
F14 = 0x7d,
F15 = 0x7e,
F16 = 0x7f,
F17 = 0x80,
F18 = 0x81,
F19 = 0x82,
F20 = 0x83,
F21 = 0x84,
F22 = 0x85,
F23 = 0x86,
F24 = 0x87,
NumLock = 0x90,
Scroll = 0x91,
LeftShift = 0xa0,
RightShift = 0xa1,
LeftControl = 0xa2,
RightControl = 0xa3,
LeftAlt = 0xa4,
RightAlt = 0xa5,
BrowserBack = 0xa6,
BrowserForward = 0xa7,
BrowserRefresh = 0xa8,
BrowserStop = 0xa9,
BrowserSearch = 0xaa,
BrowserFavorites = 0xab,
BrowserHome = 0xac,
VolumeMute = 0xad,
VolumeDown = 0xae,
VolumeUp = 0xaf,
MediaNextTrack = 0xb0,
MediaPreviousTrack = 0xb1,
MediaStop = 0xb2,
MediaPlayPause = 0xb3,
LaunchMail = 0xb4,
SelectMedia = 0xb5,
LaunchApplication1 = 0xb6,
LaunchApplication2 = 0xb7,
OemSemicolon = 0xba,
OemPlus = 0xbb,
OemComma = 0xbc,
OemMinus = 0xbd,
OemPeriod = 0xbe,
OemQuestion = 0xbf,
OemTilde = 0xc0,
OemOpenBrackets = 0xdb,
OemPipe = 0xdc,
OemCloseBrackets = 0xdd,
OemQuotes = 0xde,
Oem8 = 0xdf,
OemBackslash = 0xe2,
ProcessKey = 0xe5,
OemCopy = 0xf2,
OemAuto = 0xf3,
OemEnlW = 0xf4,
Attn = 0xf6,
Crsel = 0xf7,
Exsel = 0xf8,
EraseEof = 0xf9,
Play = 0xfa,
Zoom = 0xfb,
Pa1 = 0xfd,
OemClear = 0xfe,
};
struct State
{
bool Reserved0 : 8;
bool Back : 1; // VK_BACK, 0x8
bool Tab : 1; // VK_TAB, 0x9
bool Reserved1 : 3;
bool Enter : 1; // VK_RETURN, 0xD
bool Reserved2 : 2;
bool Reserved3 : 3;
bool Pause : 1; // VK_PAUSE, 0x13
bool CapsLock : 1; // VK_CAPITAL, 0x14
bool Kana : 1; // VK_KANA, 0x15
bool ImeOn : 1; // VK_IME_ON, 0x16
bool Reserved4 : 1;
bool Reserved5 : 1;
bool Kanji : 1; // VK_KANJI, 0x19
bool ImeOff : 1; // VK_IME_OFF, 0X1A
bool Escape : 1; // VK_ESCAPE, 0x1B
bool ImeConvert : 1; // VK_CONVERT, 0x1C
bool ImeNoConvert : 1; // VK_NONCONVERT, 0x1D
bool Reserved7 : 2;
bool Space : 1; // VK_SPACE, 0x20
bool PageUp : 1; // VK_PRIOR, 0x21
bool PageDown : 1; // VK_NEXT, 0x22
bool End : 1; // VK_END, 0x23
bool Home : 1; // VK_HOME, 0x24
bool Left : 1; // VK_LEFT, 0x25
bool Up : 1; // VK_UP, 0x26
bool Right : 1; // VK_RIGHT, 0x27
bool Down : 1; // VK_DOWN, 0x28
bool Select : 1; // VK_SELECT, 0x29
bool Print : 1; // VK_PRINT, 0x2A
bool Execute : 1; // VK_EXECUTE, 0x2B
bool PrintScreen : 1; // VK_SNAPSHOT, 0x2C
bool Insert : 1; // VK_INSERT, 0x2D
bool Delete : 1; // VK_DELETE, 0x2E
bool Help : 1; // VK_HELP, 0x2F
bool D0 : 1; // 0x30
bool D1 : 1; // 0x31
bool D2 : 1; // 0x32
bool D3 : 1; // 0x33
bool D4 : 1; // 0x34
bool D5 : 1; // 0x35
bool D6 : 1; // 0x36
bool D7 : 1; // 0x37
bool D8 : 1; // 0x38
bool D9 : 1; // 0x39
bool Reserved8 : 6;
bool Reserved9 : 1;
bool A : 1; // 0x41
bool B : 1; // 0x42
bool C : 1; // 0x43
bool D : 1; // 0x44
bool E : 1; // 0x45
bool F : 1; // 0x46
bool G : 1; // 0x47
bool H : 1; // 0x48
bool I : 1; // 0x49
bool J : 1; // 0x4A
bool K : 1; // 0x4B
bool L : 1; // 0x4C
bool M : 1; // 0x4D
bool N : 1; // 0x4E
bool O : 1; // 0x4F
bool P : 1; // 0x50
bool Q : 1; // 0x51
bool R : 1; // 0x52
bool S : 1; // 0x53
bool T : 1; // 0x54
bool U : 1; // 0x55
bool V : 1; // 0x56
bool W : 1; // 0x57
bool X : 1; // 0x58
bool Y : 1; // 0x59
bool Z : 1; // 0x5A
bool LeftWindows : 1; // VK_LWIN, 0x5B
bool RightWindows : 1; // VK_RWIN, 0x5C
bool Apps : 1; // VK_APPS, 0x5D
bool Reserved10 : 1;
bool Sleep : 1; // VK_SLEEP, 0x5F
bool NumPad0 : 1; // VK_NUMPAD0, 0x60
bool NumPad1 : 1; // VK_NUMPAD1, 0x61
bool NumPad2 : 1; // VK_NUMPAD2, 0x62
bool NumPad3 : 1; // VK_NUMPAD3, 0x63
bool NumPad4 : 1; // VK_NUMPAD4, 0x64
bool NumPad5 : 1; // VK_NUMPAD5, 0x65
bool NumPad6 : 1; // VK_NUMPAD6, 0x66
bool NumPad7 : 1; // VK_NUMPAD7, 0x67
bool NumPad8 : 1; // VK_NUMPAD8, 0x68
bool NumPad9 : 1; // VK_NUMPAD9, 0x69
bool Multiply : 1; // VK_MULTIPLY, 0x6A
bool Add : 1; // VK_ADD, 0x6B
bool Separator : 1; // VK_SEPARATOR, 0x6C
bool Subtract : 1; // VK_SUBTRACT, 0x6D
bool Decimal : 1; // VK_DECIMANL, 0x6E
bool Divide : 1; // VK_DIVIDE, 0x6F
bool F1 : 1; // VK_F1, 0x70
bool F2 : 1; // VK_F2, 0x71
bool F3 : 1; // VK_F3, 0x72
bool F4 : 1; // VK_F4, 0x73
bool F5 : 1; // VK_F5, 0x74
bool F6 : 1; // VK_F6, 0x75
bool F7 : 1; // VK_F7, 0x76
bool F8 : 1; // VK_F8, 0x77
bool F9 : 1; // VK_F9, 0x78
bool F10 : 1; // VK_F10, 0x79
bool F11 : 1; // VK_F11, 0x7A
bool F12 : 1; // VK_F12, 0x7B
bool F13 : 1; // VK_F13, 0x7C
bool F14 : 1; // VK_F14, 0x7D
bool F15 : 1; // VK_F15, 0x7E
bool F16 : 1; // VK_F16, 0x7F
bool F17 : 1; // VK_F17, 0x80
bool F18 : 1; // VK_F18, 0x81
bool F19 : 1; // VK_F19, 0x82
bool F20 : 1; // VK_F20, 0x83
bool F21 : 1; // VK_F21, 0x84
bool F22 : 1; // VK_F22, 0x85
bool F23 : 1; // VK_F23, 0x86
bool F24 : 1; // VK_F24, 0x87
bool Reserved11 : 8;
bool NumLock : 1; // VK_NUMLOCK, 0x90
bool Scroll : 1; // VK_SCROLL, 0x91
bool Reserved12 : 6;
bool Reserved13 : 8;
bool LeftShift : 1; // VK_LSHIFT, 0xA0
bool RightShift : 1; // VK_RSHIFT, 0xA1
bool LeftControl : 1; // VK_LCONTROL, 0xA2
bool RightControl : 1; // VK_RCONTROL, 0xA3
bool LeftAlt : 1; // VK_LMENU, 0xA4
bool RightAlt : 1; // VK_RMENU, 0xA5
bool BrowserBack : 1; // VK_BROWSER_BACK, 0xA6
bool BrowserForward : 1; // VK_BROWSER_FORWARD, 0xA7
bool BrowserRefresh : 1; // VK_BROWSER_REFRESH, 0xA8
bool BrowserStop : 1; // VK_BROWSER_STOP, 0xA9
bool BrowserSearch : 1; // VK_BROWSER_SEARCH, 0xAA
bool BrowserFavorites : 1; // VK_BROWSER_FAVORITES, 0xAB
bool BrowserHome : 1; // VK_BROWSER_HOME, 0xAC
bool VolumeMute : 1; // VK_VOLUME_MUTE, 0xAD
bool VolumeDown : 1; // VK_VOLUME_DOWN, 0xAE
bool VolumeUp : 1; // VK_VOLUME_UP, 0xAF
bool MediaNextTrack : 1; // VK_MEDIA_NEXT_TRACK, 0xB0
bool MediaPreviousTrack : 1;// VK_MEDIA_PREV_TRACK, 0xB1
bool MediaStop : 1; // VK_MEDIA_STOP, 0xB2
bool MediaPlayPause : 1; // VK_MEDIA_PLAY_PAUSE, 0xB3
bool LaunchMail : 1; // VK_LAUNCH_MAIL, 0xB4
bool SelectMedia : 1; // VK_LAUNCH_MEDIA_SELECT, 0xB5
bool LaunchApplication1 : 1;// VK_LAUNCH_APP1, 0xB6
bool LaunchApplication2 : 1;// VK_LAUNCH_APP2, 0xB7
bool Reserved14 : 2;
bool OemSemicolon : 1; // VK_OEM_1, 0xBA
bool OemPlus : 1; // VK_OEM_PLUS, 0xBB
bool OemComma : 1; // VK_OEM_COMMA, 0xBC
bool OemMinus : 1; // VK_OEM_MINUS, 0xBD
bool OemPeriod : 1; // VK_OEM_PERIOD, 0xBE
bool OemQuestion : 1; // VK_OEM_2, 0xBF
bool OemTilde : 1; // VK_OEM_3, 0xC0
bool Reserved15 : 7;
bool Reserved16 : 8;
bool Reserved17 : 8;
bool Reserved18 : 3;
bool OemOpenBrackets : 1; // VK_OEM_4, 0xDB
bool OemPipe : 1; // VK_OEM_5, 0xDC
bool OemCloseBrackets : 1; // VK_OEM_6, 0xDD
bool OemQuotes : 1; // VK_OEM_7, 0xDE
bool Oem8 : 1; // VK_OEM_8, 0xDF
bool Reserved19 : 2;
bool OemBackslash : 1; // VK_OEM_102, 0xE2
bool Reserved20 : 2;
bool ProcessKey : 1; // VK_PROCESSKEY, 0xE5
bool Reserved21 : 2;
bool Reserved22 : 8;
bool Reserved23 : 2;
bool OemCopy : 1; // 0XF2
bool OemAuto : 1; // 0xF3
bool OemEnlW : 1; // 0xF4
bool Reserved24 : 1;
bool Attn : 1; // VK_ATTN, 0xF6
bool Crsel : 1; // VK_CRSEL, 0xF7
bool Exsel : 1; // VK_EXSEL, 0xF8
bool EraseEof : 1; // VK_EREOF, 0xF9
bool Play : 1; // VK_PLAY, 0xFA
bool Zoom : 1; // VK_ZOOM, 0xFB
bool Reserved25 : 1;
bool Pa1 : 1; // VK_PA1, 0xFD
bool OemClear : 1; // VK_OEM_CLEAR, 0xFE
bool Reserved26 : 1;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-warning-option"
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif
bool __cdecl IsKeyDown(Keys key) const noexcept
{
if (key <= 0xfe)
{
auto ptr = reinterpret_cast<const uint32_t*>(this);
const unsigned int bf = 1u << (key & 0x1f);
return (ptr[(key >> 5)] & bf) != 0;
}
return false;
}
bool __cdecl IsKeyUp(Keys key) const noexcept
{
if (key <= 0xfe)
{
auto ptr = reinterpret_cast<const uint32_t*>(this);
const unsigned int bf = 1u << (key & 0x1f);
return (ptr[(key >> 5)] & bf) == 0;
}
return false;
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
};
class KeyboardStateTracker
{
public:
State released;
State pressed;
#ifdef _PREFAST_
#pragma prefast(push)
#pragma prefast(disable : 26495, "Reset() performs the initialization")
#endif
KeyboardStateTracker() noexcept { Reset(); }
#ifdef _PREFAST_
#pragma prefast(pop)
#endif
void __cdecl Update(const State& state) noexcept;
void __cdecl Reset() noexcept;
bool __cdecl IsKeyPressed(Keys key) const noexcept { return pressed.IsKeyDown(key); }
bool __cdecl IsKeyReleased(Keys key) const noexcept { return released.IsKeyDown(key); }
State __cdecl GetLastState() const noexcept { return lastState; }
public:
State lastState;
};
// Retrieve the current state of the keyboard
State __cdecl GetState() const;
// Reset the keyboard state
void __cdecl Reset() noexcept;
// Feature detection
bool __cdecl IsConnected() const;
#ifdef USING_COREWINDOW
void __cdecl SetWindow(ABI::Windows::UI::Core::ICoreWindow* window);
#ifdef __cplusplus_winrt
void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window)
{
// See https://msdn.microsoft.com/en-us/library/hh755802.aspx
SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(window));
}
#endif
#ifdef CPPWINRT_VERSION
void __cdecl SetWindow(winrt::Windows::UI::Core::CoreWindow window)
{
// See https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/interop-winrt-abi
SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(winrt::get_abi(window)));
}
#endif
#elif defined(WM_USER)
static void __cdecl ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam);
#endif
// Singleton
static Keyboard& __cdecl Get();
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif

372
CoreLib/include/Inc/Model.h Normal file
View File

@ -0,0 +1,372 @@
//--------------------------------------------------------------------------------------
// File: Model.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#include <dxgiformat.h>
#endif
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>
#include <new>
#include <set>
#include <string>
#include <vector>
#include <malloc.h>
#include <wrl\client.h>
#include <DirectXMath.h>
#include <DirectXCollision.h>
namespace DirectX
{
inline namespace DX11
{
class IEffect;
class IEffectFactory;
class CommonStates;
class ModelMesh;
//------------------------------------------------------------------------------
// Model loading options
enum ModelLoaderFlags : uint32_t
{
ModelLoader_Clockwise = 0x0,
ModelLoader_CounterClockwise = 0x1,
ModelLoader_PremultipledAlpha = 0x2,
ModelLoader_MaterialColorsSRGB = 0x4,
ModelLoader_AllowLargeModels = 0x8,
ModelLoader_IncludeBones = 0x10,
ModelLoader_DisableSkinning = 0x20,
};
//------------------------------------------------------------------------------
// Frame hierarchy for rigid body and skeletal animation
struct ModelBone
{
ModelBone() noexcept :
parentIndex(c_Invalid),
childIndex(c_Invalid),
siblingIndex(c_Invalid)
{
}
ModelBone(uint32_t parent, uint32_t child, uint32_t sibling) noexcept :
parentIndex(parent),
childIndex(child),
siblingIndex(sibling)
{
}
uint32_t parentIndex;
uint32_t childIndex;
uint32_t siblingIndex;
std::wstring name;
using Collection = std::vector<ModelBone>;
static constexpr uint32_t c_Invalid = uint32_t(-1);
struct aligned_deleter { void operator()(void* p) noexcept { _aligned_free(p); } };
using TransformArray = std::unique_ptr<XMMATRIX[], aligned_deleter>;
static TransformArray MakeArray(size_t count)
{
void* temp = _aligned_malloc(sizeof(XMMATRIX) * count, 16);
if (!temp)
throw std::bad_alloc();
return TransformArray(static_cast<XMMATRIX*>(temp));
}
};
//------------------------------------------------------------------------------
// Each mesh part is a submesh with a single effect
class ModelMeshPart
{
public:
ModelMeshPart() noexcept;
ModelMeshPart(ModelMeshPart&&) = default;
ModelMeshPart& operator= (ModelMeshPart&&) = default;
ModelMeshPart(ModelMeshPart const&) = default;
ModelMeshPart& operator= (ModelMeshPart const&) = default;
virtual ~ModelMeshPart();
using Collection = std::vector<std::unique_ptr<ModelMeshPart>>;
using InputLayoutCollection = std::vector<D3D11_INPUT_ELEMENT_DESC>;
uint32_t indexCount;
uint32_t startIndex;
int32_t vertexOffset;
uint32_t vertexStride;
D3D_PRIMITIVE_TOPOLOGY primitiveType;
DXGI_FORMAT indexFormat;
Microsoft::WRL::ComPtr<ID3D11InputLayout> inputLayout;
Microsoft::WRL::ComPtr<ID3D11Buffer> indexBuffer;
Microsoft::WRL::ComPtr<ID3D11Buffer> vertexBuffer;
std::shared_ptr<IEffect> effect;
std::shared_ptr<InputLayoutCollection> vbDecl;
bool isAlpha;
// Draw mesh part with custom effect
void __cdecl Draw(
_In_ ID3D11DeviceContext* deviceContext,
_In_ IEffect* ieffect,
_In_ ID3D11InputLayout* iinputLayout,
_In_ std::function<void __cdecl()> setCustomState = nullptr) const;
void __cdecl DrawInstanced(
_In_ ID3D11DeviceContext* deviceContext,
_In_ IEffect* ieffect,
_In_ ID3D11InputLayout* iinputLayout,
uint32_t instanceCount,
uint32_t startInstanceLocation = 0,
_In_ std::function<void __cdecl()> setCustomState = nullptr) const;
// Create input layout for drawing with a custom effect.
void __cdecl CreateInputLayout(_In_ ID3D11Device* device, _In_ IEffect* ieffect, _Outptr_ ID3D11InputLayout** iinputLayout) const;
// Change effect used by part and regenerate input layout (be sure to call Model::Modified as well)
void __cdecl ModifyEffect(_In_ ID3D11Device* device, _In_ const std::shared_ptr<IEffect>& ieffect, bool isalpha = false);
};
//------------------------------------------------------------------------------
// A mesh consists of one or more model mesh parts
class ModelMesh
{
public:
ModelMesh() noexcept;
ModelMesh(ModelMesh&&) = default;
ModelMesh& operator= (ModelMesh&&) = default;
ModelMesh(ModelMesh const&) = default;
ModelMesh& operator= (ModelMesh const&) = default;
virtual ~ModelMesh();
BoundingSphere boundingSphere;
BoundingBox boundingBox;
ModelMeshPart::Collection meshParts;
uint32_t boneIndex;
std::vector<uint32_t> boneInfluences;
std::wstring name;
bool ccw;
bool pmalpha;
using Collection = std::vector<std::shared_ptr<ModelMesh>>;
// Setup states for drawing mesh
void __cdecl PrepareForRendering(
_In_ ID3D11DeviceContext* deviceContext,
const CommonStates& states,
bool alpha = false,
bool wireframe = false) const;
// Draw the mesh
void XM_CALLCONV Draw(
_In_ ID3D11DeviceContext* deviceContext,
FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
bool alpha = false,
_In_ std::function<void __cdecl()> setCustomState = nullptr) const;
// Draw the mesh using model bones
void XM_CALLCONV Draw(
_In_ ID3D11DeviceContext* deviceContext,
size_t nbones, _In_reads_(nbones) const XMMATRIX* boneTransforms,
FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
bool alpha = false,
_In_ std::function<void __cdecl()> setCustomState = nullptr) const;
// Draw the mesh using skinning
void XM_CALLCONV DrawSkinned(
_In_ ID3D11DeviceContext* deviceContext,
size_t nbones, _In_reads_(nbones) const XMMATRIX* boneTransforms,
FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
bool alpha = false,
_In_ std::function<void __cdecl()> setCustomState = nullptr) const;
static void SetDepthBufferMode(bool reverseZ)
{
s_reversez = reverseZ;
}
private:
static bool s_reversez;
};
//------------------------------------------------------------------------------
// A model consists of one or more meshes
class Model
{
public:
Model() = default;
Model(Model&&) = default;
Model& operator= (Model&&) = default;
Model(Model const& other);
Model& operator= (Model const& rhs);
virtual ~Model();
ModelMesh::Collection meshes;
ModelBone::Collection bones;
ModelBone::TransformArray boneMatrices;
ModelBone::TransformArray invBindPoseMatrices;
std::wstring name;
// Draw all the meshes in the model
void XM_CALLCONV Draw(
_In_ ID3D11DeviceContext* deviceContext,
const CommonStates& states,
FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
bool wireframe = false,
_In_ std::function<void __cdecl()> setCustomState = nullptr) const;
// Draw all the meshes using model bones
void XM_CALLCONV Draw(
_In_ ID3D11DeviceContext* deviceContext,
const CommonStates& states,
size_t nbones, _In_reads_(nbones) const XMMATRIX* boneTransforms,
FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
bool wireframe = false,
_In_ std::function<void __cdecl()> setCustomState = nullptr) const;
// Draw all the meshes using skinning
void XM_CALLCONV DrawSkinned(
_In_ ID3D11DeviceContext* deviceContext,
const CommonStates& states,
size_t nbones, _In_reads_(nbones) const XMMATRIX* boneTransforms,
FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
bool wireframe = false,
_In_ std::function<void __cdecl()> setCustomState = nullptr) const;
// Compute bone positions based on heirarchy and transform matrices
void __cdecl CopyAbsoluteBoneTransformsTo(
size_t nbones,
_Out_writes_(nbones) XMMATRIX* boneTransforms) const;
void __cdecl CopyAbsoluteBoneTransforms(
size_t nbones,
_In_reads_(nbones) const XMMATRIX* inBoneTransforms,
_Out_writes_(nbones) XMMATRIX* outBoneTransforms) const;
// Set bone matrices to a set of relative tansforms
void __cdecl CopyBoneTransformsFrom(
size_t nbones,
_In_reads_(nbones) const XMMATRIX* boneTransforms);
// Copies the relative bone matrices to a transform array
void __cdecl CopyBoneTransformsTo(
size_t nbones,
_Out_writes_(nbones) XMMATRIX* boneTransforms) const;
// Notify model that effects, parts list, or mesh list has changed
void __cdecl Modified() noexcept { mEffectCache.clear(); }
// Update all effects used by the model
void __cdecl UpdateEffects(_In_ std::function<void __cdecl(IEffect*)> setEffect);
// Loads a model from a Visual Studio Starter Kit .CMO file
static std::unique_ptr<Model> __cdecl CreateFromCMO(
_In_ ID3D11Device* device,
_In_reads_bytes_(dataSize) const uint8_t* meshData, size_t dataSize,
_In_ IEffectFactory& fxFactory,
ModelLoaderFlags flags = ModelLoader_CounterClockwise,
_Out_opt_ size_t* animsOffset = nullptr);
static std::unique_ptr<Model> __cdecl CreateFromCMO(
_In_ ID3D11Device* device,
_In_z_ const wchar_t* szFileName,
_In_ IEffectFactory& fxFactory,
ModelLoaderFlags flags = ModelLoader_CounterClockwise,
_Out_opt_ size_t* animsOffset = nullptr);
// Loads a model from a DirectX SDK .SDKMESH file
static std::unique_ptr<Model> __cdecl CreateFromSDKMESH(
_In_ ID3D11Device* device,
_In_reads_bytes_(dataSize) const uint8_t* meshData, _In_ size_t dataSize,
_In_ IEffectFactory& fxFactory,
ModelLoaderFlags flags = ModelLoader_Clockwise);
static std::unique_ptr<Model> __cdecl CreateFromSDKMESH(
_In_ ID3D11Device* device,
_In_z_ const wchar_t* szFileName,
_In_ IEffectFactory& fxFactory,
ModelLoaderFlags flags = ModelLoader_Clockwise);
// Loads a model from a .VBO file
static std::unique_ptr<Model> __cdecl CreateFromVBO(
_In_ ID3D11Device* device,
_In_reads_bytes_(dataSize) const uint8_t* meshData, _In_ size_t dataSize,
_In_ std::shared_ptr<IEffect> ieffect = nullptr,
ModelLoaderFlags flags = ModelLoader_Clockwise);
static std::unique_ptr<Model> __cdecl CreateFromVBO(
_In_ ID3D11Device* device,
_In_z_ const wchar_t* szFileName,
_In_ std::shared_ptr<IEffect> ieffect = nullptr,
ModelLoaderFlags flags = ModelLoader_Clockwise);
#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)
static std::unique_ptr<Model> __cdecl CreateFromCMO(
_In_ ID3D11Device* device,
_In_z_ const __wchar_t* szFileName,
_In_ IEffectFactory& fxFactory,
ModelLoaderFlags flags = ModelLoader_CounterClockwise,
_Out_opt_ size_t* animsOffset = nullptr);
static std::unique_ptr<Model> __cdecl CreateFromSDKMESH(
_In_ ID3D11Device* device,
_In_z_ const __wchar_t* szFileName,
_In_ IEffectFactory& fxFactory,
ModelLoaderFlags flags = ModelLoader_Clockwise);
static std::unique_ptr<Model> __cdecl CreateFromVBO(
_In_ ID3D11Device* device,
_In_z_ const __wchar_t* szFileName,
_In_ std::shared_ptr<IEffect> ieffect = nullptr,
ModelLoaderFlags flags = ModelLoader_Clockwise);
#endif // !_NATIVE_WCHAR_T_DEFINED
private:
std::set<IEffect*> mEffectCache;
void __cdecl ComputeAbsolute(uint32_t index,
CXMMATRIX local, size_t nbones,
_In_reads_(nbones) const XMMATRIX* inBoneTransforms,
_Inout_updates_(nbones) XMMATRIX* outBoneTransforms,
size_t& visited) const;
};
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#endif
DEFINE_ENUM_FLAG_OPERATORS(ModelLoaderFlags);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}
}

172
CoreLib/include/Inc/Mouse.h Normal file
View File

@ -0,0 +1,172 @@
//--------------------------------------------------------------------------------------
// File: Mouse.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
//--------------------------------------------------------------------------------------
#pragma once
#if !defined(USING_XINPUT) && !defined(USING_GAMEINPUT) && !defined(USING_COREWINDOW)
#ifdef _GAMING_DESKTOP
#include <grdk.h>
#endif
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600))
#define USING_GAMEINPUT
#elif (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) || (defined(_XBOX_ONE) && defined(_TITLE))
#define USING_COREWINDOW
#endif
#endif // !USING_XINPUT && !USING_GAMEINPUT && !USING_WINDOWS_GAMING_INPUT
#if defined(USING_GAMEINPUT) && !defined(_GAMING_XBOX) && defined(_MSC_VER)
#pragma comment(lib,"gameinput.lib")
#endif
#include <memory>
#ifdef USING_COREWINDOW
namespace ABI { namespace Windows { namespace UI { namespace Core { struct ICoreWindow; } } } }
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#endif
namespace DirectX
{
class Mouse
{
public:
Mouse() noexcept(false);
Mouse(Mouse&&) noexcept;
Mouse& operator= (Mouse&&) noexcept;
Mouse(Mouse const&) = delete;
Mouse& operator=(Mouse const&) = delete;
virtual ~Mouse();
enum Mode
{
MODE_ABSOLUTE = 0,
MODE_RELATIVE,
};
struct State
{
bool leftButton;
bool middleButton;
bool rightButton;
bool xButton1;
bool xButton2;
int x;
int y;
int scrollWheelValue;
Mode positionMode;
};
class ButtonStateTracker
{
public:
enum ButtonState
{
UP = 0, // Button is up
HELD = 1, // Button is held down
RELEASED = 2, // Button was just released
PRESSED = 3, // Buton was just pressed
};
ButtonState leftButton;
ButtonState middleButton;
ButtonState rightButton;
ButtonState xButton1;
ButtonState xButton2;
#ifdef _PREFAST_
#pragma prefast(push)
#pragma prefast(disable : 26495, "Reset() performs the initialization")
#endif
ButtonStateTracker() noexcept { Reset(); }
#ifdef _PREFAST_
#pragma prefast(pop)
#endif
void __cdecl Update(const State& state) noexcept;
void __cdecl Reset() noexcept;
State __cdecl GetLastState() const noexcept { return lastState; }
private:
State lastState;
};
// Retrieve the current state of the mouse
State __cdecl GetState() const;
// Resets the accumulated scroll wheel value
void __cdecl ResetScrollWheelValue() noexcept;
// Sets mouse mode (defaults to absolute)
void __cdecl SetMode(Mode mode);
// Signals the end of frame (recommended, but optional)
void __cdecl EndOfInputFrame() noexcept;
// Feature detection
bool __cdecl IsConnected() const;
// Cursor visibility
bool __cdecl IsVisible() const noexcept;
void __cdecl SetVisible(bool visible);
#ifdef USING_COREWINDOW
void __cdecl SetWindow(ABI::Windows::UI::Core::ICoreWindow* window);
#ifdef __cplusplus_winrt
void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window)
{
// See https://msdn.microsoft.com/en-us/library/hh755802.aspx
SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(window));
}
#endif
#ifdef CPPWINRT_VERSION
void __cdecl SetWindow(winrt::Windows::UI::Core::CoreWindow window)
{
// See https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/interop-winrt-abi
SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(winrt::get_abi(window)));
}
#endif
static void __cdecl SetDpi(float dpi);
#elif defined(WM_USER)
void __cdecl SetWindow(HWND window);
static void __cdecl ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam);
#ifdef _GAMING_XBOX
static void __cdecl SetResolution(float scale);
#endif
#endif
// Singleton
static Mouse& __cdecl Get();
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -0,0 +1,227 @@
//--------------------------------------------------------------------------------------
// File: PostProcess.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#endif
#include <memory>
#include <functional>
#include <DirectXMath.h>
namespace DirectX
{
inline namespace DX11
{
//------------------------------------------------------------------------------
// Abstract interface representing a post-process pass
class IPostProcess
{
public:
virtual ~IPostProcess() = default;
IPostProcess(const IPostProcess&) = delete;
IPostProcess& operator=(const IPostProcess&) = delete;
virtual void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext,
_In_ std::function<void __cdecl()> setCustomState = nullptr) = 0;
protected:
IPostProcess() = default;
IPostProcess(IPostProcess&&) = default;
IPostProcess& operator=(IPostProcess&&) = default;
};
//------------------------------------------------------------------------------
// Basic post-process
class BasicPostProcess : public IPostProcess
{
public:
enum Effect : unsigned int
{
Copy,
Monochrome,
Sepia,
DownScale_2x2,
DownScale_4x4,
GaussianBlur_5x5,
BloomExtract,
BloomBlur,
Effect_Max
};
explicit BasicPostProcess(_In_ ID3D11Device* device);
BasicPostProcess(BasicPostProcess&&) noexcept;
BasicPostProcess& operator= (BasicPostProcess&&) noexcept;
BasicPostProcess(BasicPostProcess const&) = delete;
BasicPostProcess& operator= (BasicPostProcess const&) = delete;
~BasicPostProcess() override;
// IPostProcess methods.
void __cdecl Process(
_In_ ID3D11DeviceContext* deviceContext,
_In_ std::function<void __cdecl()> setCustomState = nullptr) override;
// Shader control
void __cdecl SetEffect(Effect fx);
// Properties
void __cdecl SetSourceTexture(_In_opt_ ID3D11ShaderResourceView* value);
// Sets multiplier for GaussianBlur_5x5
void __cdecl SetGaussianParameter(float multiplier);
// Sets parameters for BloomExtract
void __cdecl SetBloomExtractParameter(float threshold);
// Sets parameters for BloomBlur
void __cdecl SetBloomBlurParameters(bool horizontal, float size, float brightness);
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
//------------------------------------------------------------------------------
// Dual-texure post-process
class DualPostProcess : public IPostProcess
{
public:
enum Effect : unsigned int
{
Merge,
BloomCombine,
Effect_Max
};
explicit DualPostProcess(_In_ ID3D11Device* device);
DualPostProcess(DualPostProcess&&) noexcept;
DualPostProcess& operator= (DualPostProcess&&) noexcept;
DualPostProcess(DualPostProcess const&) = delete;
DualPostProcess& operator= (DualPostProcess const&) = delete;
~DualPostProcess() override;
// IPostProcess methods.
void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext,
_In_ std::function<void __cdecl()> setCustomState = nullptr) override;
// Shader control
void __cdecl SetEffect(Effect fx);
// Properties
void __cdecl SetSourceTexture(_In_opt_ ID3D11ShaderResourceView* value);
void __cdecl SetSourceTexture2(_In_opt_ ID3D11ShaderResourceView* value);
// Sets parameters for Merge
void __cdecl SetMergeParameters(float weight1, float weight2);
// Sets parameters for BloomCombine
void __cdecl SetBloomCombineParameters(float bloom, float base, float bloomSaturation, float baseSaturation);
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
//------------------------------------------------------------------------------
// Tone-map post-process
class ToneMapPostProcess : public IPostProcess
{
public:
// Tone-mapping operator
enum Operator : unsigned int
{
None, // Pass-through
Saturate, // Clamp [0,1]
Reinhard, // x/(1+x)
ACESFilmic,
Operator_Max
};
// Electro-Optical Transfer Function (EOTF)
enum TransferFunction : unsigned int
{
Linear, // Pass-through
SRGB, // sRGB (Rec.709 and approximate sRGB display curve)
ST2084, // HDR10 (Rec.2020 color primaries and ST.2084 display curve)
TransferFunction_Max
};
// Color Rotation Transform for HDR10
enum ColorPrimaryRotation : unsigned int
{
HDTV_to_UHDTV, // Rec.709 to Rec.2020
DCI_P3_D65_to_UHDTV, // DCI-P3-D65 (a.k.a Display P3 or P3D65) to Rec.2020
HDTV_to_DCI_P3_D65, // Rec.709 to DCI-P3-D65 (a.k.a Display P3 or P3D65)
};
explicit ToneMapPostProcess(_In_ ID3D11Device* device);
ToneMapPostProcess(ToneMapPostProcess&&) noexcept;
ToneMapPostProcess& operator= (ToneMapPostProcess&&) noexcept;
ToneMapPostProcess(ToneMapPostProcess const&) = delete;
ToneMapPostProcess& operator= (ToneMapPostProcess const&) = delete;
~ToneMapPostProcess() override;
// IPostProcess methods.
void __cdecl Process(_In_ ID3D11DeviceContext* deviceContext,
_In_ std::function<void __cdecl()> setCustomState = nullptr) override;
// Shader control
void __cdecl SetOperator(Operator op);
void __cdecl SetTransferFunction(TransferFunction func);
#if defined(_XBOX_ONE) && defined(_TITLE)
// Uses Multiple Render Targets to generate both HDR10 and GameDVR SDR signals
void __cdecl SetMRTOutput(bool value = true);
#endif
// Properties
void __cdecl SetHDRSourceTexture(_In_opt_ ID3D11ShaderResourceView* value);
// Sets the Color Rotation Transform for HDR10 signal output
void __cdecl SetColorRotation(ColorPrimaryRotation value);
void __cdecl SetColorRotation(CXMMATRIX value);
// Sets exposure value for LDR tonemap operators
void __cdecl SetExposure(float exposureValue);
// Sets ST.2084 parameter for how bright white should be in nits
void __cdecl SetST2084Parameter(float paperWhiteNits);
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
}
}

View File

@ -0,0 +1,140 @@
//--------------------------------------------------------------------------------------
// File: PrimitiveBatch.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#endif
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <memory>
#include <utility>
namespace DirectX
{
inline namespace DX11
{
namespace Private
{
// Base class, not to be used directly: clients should access this via the derived PrimitiveBatch<T>.
class PrimitiveBatchBase
{
protected:
PrimitiveBatchBase(_In_ ID3D11DeviceContext* deviceContext, size_t maxIndices, size_t maxVertices, size_t vertexSize);
PrimitiveBatchBase(PrimitiveBatchBase&&) noexcept;
PrimitiveBatchBase& operator= (PrimitiveBatchBase&&) noexcept;
PrimitiveBatchBase(PrimitiveBatchBase const&) = delete;
PrimitiveBatchBase& operator= (PrimitiveBatchBase const&) = delete;
virtual ~PrimitiveBatchBase();
public:
// Begin/End a batch of primitive drawing operations.
void __cdecl Begin();
void __cdecl End();
protected:
// Internal, untyped drawing method.
void __cdecl Draw(D3D11_PRIMITIVE_TOPOLOGY topology, bool isIndexed, _In_opt_count_(indexCount) uint16_t const* indices, size_t indexCount, size_t vertexCount, _Out_ void** pMappedVertices);
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
};
}
// Template makes the API typesafe, eg. PrimitiveBatch<VertexPositionColor>.
template<typename TVertex>
class PrimitiveBatch : public Private::PrimitiveBatchBase
{
static constexpr size_t DefaultBatchSize = 2048;
public:
explicit PrimitiveBatch(_In_ ID3D11DeviceContext* deviceContext, size_t maxIndices = DefaultBatchSize * 3, size_t maxVertices = DefaultBatchSize)
: PrimitiveBatchBase(deviceContext, maxIndices, maxVertices, sizeof(TVertex))
{
}
PrimitiveBatch(PrimitiveBatch&&) = default;
PrimitiveBatch& operator= (PrimitiveBatch&&) = default;
PrimitiveBatch(PrimitiveBatch const&) = delete;
PrimitiveBatch& operator= (PrimitiveBatch const&) = delete;
// Similar to the D3D9 API DrawPrimitiveUP.
void Draw(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount)
{
void* mappedVertices;
PrimitiveBatchBase::Draw(topology, false, nullptr, 0, vertexCount, &mappedVertices);
memcpy(mappedVertices, vertices, vertexCount * sizeof(TVertex));
}
// Similar to the D3D9 API DrawIndexedPrimitiveUP.
void DrawIndexed(D3D11_PRIMITIVE_TOPOLOGY topology, _In_reads_(indexCount) uint16_t const* indices, size_t indexCount, _In_reads_(vertexCount) TVertex const* vertices, size_t vertexCount)
{
void* mappedVertices;
PrimitiveBatchBase::Draw(topology, true, indices, indexCount, vertexCount, &mappedVertices);
memcpy(mappedVertices, vertices, vertexCount * sizeof(TVertex));
}
void DrawLine(TVertex const& v1, TVertex const& v2)
{
TVertex* mappedVertices;
PrimitiveBatchBase::Draw(D3D11_PRIMITIVE_TOPOLOGY_LINELIST, false, nullptr, 0, 2, reinterpret_cast<void**>(&mappedVertices));
mappedVertices[0] = v1;
mappedVertices[1] = v2;
}
void DrawTriangle(TVertex const& v1, TVertex const& v2, TVertex const& v3)
{
TVertex* mappedVertices;
PrimitiveBatchBase::Draw(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, false, nullptr, 0, 3, reinterpret_cast<void**>(&mappedVertices));
mappedVertices[0] = v1;
mappedVertices[1] = v2;
mappedVertices[2] = v3;
}
void DrawQuad(TVertex const& v1, TVertex const& v2, TVertex const& v3, TVertex const& v4)
{
static const uint16_t quadIndices[] = { 0, 1, 2, 0, 2, 3 };
TVertex* mappedVertices;
PrimitiveBatchBase::Draw(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, true, quadIndices, 6, 4, reinterpret_cast<void**>(&mappedVertices));
mappedVertices[0] = v1;
mappedVertices[1] = v2;
mappedVertices[2] = v3;
mappedVertices[3] = v4;
}
};
}
}

View File

@ -0,0 +1,54 @@
//--------------------------------------------------------------------------------------
// File: ScreenGrab.h
//
// Function for capturing a 2D texture and saving it to a file (aka a 'screenshot'
// when used on a Direct3D Render Target).
//
// Note these functions are useful as a light-weight runtime screen grabber. For
// full-featured texture capture, DDS writer, and texture processing pipeline,
// see the 'Texconv' sample and the 'DirectXTex' library.
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248926
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#endif
#include <functional>
#if defined(NTDDI_WIN10_FE) || defined(__MINGW32__)
#include <ocidl.h>
#else
#include <OCIdl.h>
#endif
#ifdef _MSC_VER
#pragma comment(lib,"uuid.lib")
#endif
namespace DirectX
{
HRESULT __cdecl SaveDDSTextureToFile(
_In_ ID3D11DeviceContext* pContext,
_In_ ID3D11Resource* pSource,
_In_z_ const wchar_t* fileName) noexcept;
HRESULT __cdecl SaveWICTextureToFile(
_In_ ID3D11DeviceContext* pContext,
_In_ ID3D11Resource* pSource,
_In_ REFGUID guidContainerFormat,
_In_z_ const wchar_t* fileName,
_In_opt_ const GUID* targetFormat = nullptr,
_In_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr,
_In_ bool forceSRGB = false);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,102 @@
//--------------------------------------------------------------------------------------
// File: SpriteBatch.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#include <dxgi1_2.h>
#endif
#include <cstdint>
#include <functional>
#include <memory>
#include <DirectXMath.h>
#include <DirectXColors.h>
namespace DirectX
{
inline namespace DX11
{
enum SpriteSortMode
{
SpriteSortMode_Deferred,
SpriteSortMode_Immediate,
SpriteSortMode_Texture,
SpriteSortMode_BackToFront,
SpriteSortMode_FrontToBack,
};
enum SpriteEffects : uint32_t
{
SpriteEffects_None = 0,
SpriteEffects_FlipHorizontally = 1,
SpriteEffects_FlipVertically = 2,
SpriteEffects_FlipBoth = SpriteEffects_FlipHorizontally | SpriteEffects_FlipVertically,
};
class SpriteBatch
{
public:
explicit SpriteBatch(_In_ ID3D11DeviceContext* deviceContext);
SpriteBatch(SpriteBatch&&) noexcept;
SpriteBatch& operator= (SpriteBatch&&) noexcept;
SpriteBatch(SpriteBatch const&) = delete;
SpriteBatch& operator= (SpriteBatch const&) = delete;
virtual ~SpriteBatch();
// Begin/End a batch of sprite drawing operations.
void XM_CALLCONV Begin(SpriteSortMode sortMode = SpriteSortMode_Deferred,
_In_opt_ ID3D11BlendState* blendState = nullptr,
_In_opt_ ID3D11SamplerState* samplerState = nullptr,
_In_opt_ ID3D11DepthStencilState* depthStencilState = nullptr,
_In_opt_ ID3D11RasterizerState* rasterizerState = nullptr,
_In_ std::function<void __cdecl()> setCustomShaders = nullptr,
FXMMATRIX transformMatrix = MatrixIdentity);
void __cdecl End();
// Draw overloads specifying position, origin and scale as XMFLOAT2.
void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, XMFLOAT2 const& position, FXMVECTOR color = Colors::White);
void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, XMFLOAT2 const& position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
// Draw overloads specifying position, origin and scale via the first two components of an XMVECTOR.
void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, FXMVECTOR position, FXMVECTOR color = Colors::White);
void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, FXMVECTOR position, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
// Draw overloads specifying position as a RECT.
void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, RECT const& destinationRectangle, FXMVECTOR color = Colors::White);
void XM_CALLCONV Draw(_In_ ID3D11ShaderResourceView* texture, RECT const& destinationRectangle, _In_opt_ RECT const* sourceRectangle, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0);
// Rotation mode to be applied to the sprite transformation
void __cdecl SetRotation(DXGI_MODE_ROTATION mode);
DXGI_MODE_ROTATION __cdecl GetRotation() const noexcept;
// Set viewport for sprite transformation
void __cdecl SetViewport(const D3D11_VIEWPORT& viewPort);
private:
// Private implementation.
struct Impl;
std::unique_ptr<Impl> pImpl;
static const XMMATRIX MatrixIdentity;
static const XMFLOAT2 Float2Zero;
};
}
}

View File

@ -0,0 +1,116 @@
//--------------------------------------------------------------------------------------
// File: SpriteFont.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#include "SpriteBatch.h"
#include <cstddef>
#include <cstdint>
#include <memory>
namespace DirectX
{
inline namespace DX11
{
class SpriteFont
{
public:
struct Glyph;
SpriteFont(_In_ ID3D11Device* device, _In_z_ wchar_t const* fileName, bool forceSRGB = false);
SpriteFont(_In_ ID3D11Device* device, _In_reads_bytes_(dataSize) uint8_t const* dataBlob, _In_ size_t dataSize, bool forceSRGB = false);
SpriteFont(_In_ ID3D11ShaderResourceView* texture, _In_reads_(glyphCount) Glyph const* glyphs, _In_ size_t glyphCount, _In_ float lineSpacing);
SpriteFont(SpriteFont&&) noexcept;
SpriteFont& operator= (SpriteFont&&) noexcept;
SpriteFont(SpriteFont const&) = delete;
SpriteFont& operator= (SpriteFont const&) = delete;
virtual ~SpriteFont();
// Wide-character / UTF-16LE
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, FXMVECTOR position, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
XMVECTOR XM_CALLCONV MeasureString(_In_z_ wchar_t const* text, bool ignoreWhitespace = true) const;
RECT __cdecl MeasureDrawBounds(_In_z_ wchar_t const* text, XMFLOAT2 const& position, bool ignoreWhitespace = true) const;
RECT XM_CALLCONV MeasureDrawBounds(_In_z_ wchar_t const* text, FXMVECTOR position, bool ignoreWhitespace = true) const;
// UTF-8
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ char const* text, XMFLOAT2 const& position, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ char const* text, XMFLOAT2 const& position, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ char const* text, FXMVECTOR position, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ char const* text, FXMVECTOR position, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
XMVECTOR XM_CALLCONV MeasureString(_In_z_ char const* text, bool ignoreWhitespace = true) const;
RECT __cdecl MeasureDrawBounds(_In_z_ char const* text, XMFLOAT2 const& position, bool ignoreWhitespace = true) const;
RECT XM_CALLCONV MeasureDrawBounds(_In_z_ char const* text, FXMVECTOR position, bool ignoreWhitespace = true) const;
// Spacing properties
float __cdecl GetLineSpacing() const noexcept;
void __cdecl SetLineSpacing(float spacing);
// Font properties
wchar_t __cdecl GetDefaultCharacter() const noexcept;
void __cdecl SetDefaultCharacter(wchar_t character);
bool __cdecl ContainsCharacter(wchar_t character) const;
// Custom layout/rendering
Glyph const* __cdecl FindGlyph(wchar_t character) const;
void __cdecl GetSpriteSheet(ID3D11ShaderResourceView** texture) const;
// Describes a single character glyph.
struct Glyph
{
uint32_t Character;
RECT Subrect;
float XOffset;
float YOffset;
float XAdvance;
};
#if defined(_MSC_VER) && !defined(_NATIVE_WCHAR_T_DEFINED)
SpriteFont(_In_ ID3D11Device* device, _In_z_ __wchar_t const* fileName, bool forceSRGB = false);
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ __wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ __wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color, float rotation, XMFLOAT2 const& origin, XMFLOAT2 const& scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ __wchar_t const* text, FXMVECTOR position, FXMVECTOR color = Colors::White, float rotation = 0, FXMVECTOR origin = g_XMZero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ __wchar_t const* text, FXMVECTOR position, FXMVECTOR color, float rotation, FXMVECTOR origin, GXMVECTOR scale, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
XMVECTOR XM_CALLCONV MeasureString(_In_z_ __wchar_t const* text, bool ignoreWhitespace = true) const;
RECT __cdecl MeasureDrawBounds(_In_z_ __wchar_t const* text, XMFLOAT2 const& position, bool ignoreWhitespace = true) const;
RECT XM_CALLCONV MeasureDrawBounds(_In_z_ __wchar_t const* text, FXMVECTOR position, bool ignoreWhitespace = true) const;
void __cdecl SetDefaultCharacter(__wchar_t character);
bool __cdecl ContainsCharacter(__wchar_t character) const;
Glyph const* __cdecl FindGlyph(__wchar_t character) const;
#endif // !_NATIVE_WCHAR_T_DEFINED
private:
// Private implementation.
class Impl;
std::unique_ptr<Impl> pImpl;
static const XMFLOAT2 Float2Zero;
};
}
}

View File

@ -0,0 +1,504 @@
//--------------------------------------------------------------------------------------
// File: VertexTypes.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#endif
#include <cstdint>
#include <DirectXMath.h>
namespace DirectX
{
inline namespace DX11
{
// Vertex struct holding position information.
struct VertexPosition
{
VertexPosition() = default;
VertexPosition(const VertexPosition&) = default;
VertexPosition& operator=(const VertexPosition&) = default;
VertexPosition(VertexPosition&&) = default;
VertexPosition& operator=(VertexPosition&&) = default;
VertexPosition(XMFLOAT3 const& iposition) noexcept
: position(iposition)
{
}
VertexPosition(FXMVECTOR iposition) noexcept
{
XMStoreFloat3(&this->position, iposition);
}
XMFLOAT3 position;
static constexpr unsigned int InputElementCount = 1;
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
};
// Vertex struct holding position and color information.
struct VertexPositionColor
{
VertexPositionColor() = default;
VertexPositionColor(const VertexPositionColor&) = default;
VertexPositionColor& operator=(const VertexPositionColor&) = default;
VertexPositionColor(VertexPositionColor&&) = default;
VertexPositionColor& operator=(VertexPositionColor&&) = default;
VertexPositionColor(XMFLOAT3 const& iposition, XMFLOAT4 const& icolor) noexcept
: position(iposition),
color(icolor)
{
}
VertexPositionColor(FXMVECTOR iposition, FXMVECTOR icolor) noexcept
{
XMStoreFloat3(&this->position, iposition);
XMStoreFloat4(&this->color, icolor);
}
XMFLOAT3 position;
XMFLOAT4 color;
static constexpr unsigned int InputElementCount = 2;
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
};
// Vertex struct holding position and texture mapping information.
struct VertexPositionTexture
{
VertexPositionTexture() = default;
VertexPositionTexture(const VertexPositionTexture&) = default;
VertexPositionTexture& operator=(const VertexPositionTexture&) = default;
VertexPositionTexture(VertexPositionTexture&&) = default;
VertexPositionTexture& operator=(VertexPositionTexture&&) = default;
VertexPositionTexture(XMFLOAT3 const& iposition, XMFLOAT2 const& itextureCoordinate) noexcept
: position(iposition),
textureCoordinate(itextureCoordinate)
{
}
VertexPositionTexture(FXMVECTOR iposition, FXMVECTOR itextureCoordinate) noexcept
{
XMStoreFloat3(&this->position, iposition);
XMStoreFloat2(&this->textureCoordinate, itextureCoordinate);
}
XMFLOAT3 position;
XMFLOAT2 textureCoordinate;
static constexpr unsigned int InputElementCount = 2;
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
};
// Vertex struct holding position and dual texture mapping information.
struct VertexPositionDualTexture
{
VertexPositionDualTexture() = default;
VertexPositionDualTexture(const VertexPositionDualTexture&) = default;
VertexPositionDualTexture& operator=(const VertexPositionDualTexture&) = default;
VertexPositionDualTexture(VertexPositionDualTexture&&) = default;
VertexPositionDualTexture& operator=(VertexPositionDualTexture&&) = default;
VertexPositionDualTexture(
XMFLOAT3 const& iposition,
XMFLOAT2 const& itextureCoordinate0,
XMFLOAT2 const& itextureCoordinate1) noexcept
: position(iposition),
textureCoordinate0(itextureCoordinate0),
textureCoordinate1(itextureCoordinate1)
{
}
VertexPositionDualTexture(
FXMVECTOR iposition,
FXMVECTOR itextureCoordinate0,
FXMVECTOR itextureCoordinate1) noexcept
{
XMStoreFloat3(&this->position, iposition);
XMStoreFloat2(&this->textureCoordinate0, itextureCoordinate0);
XMStoreFloat2(&this->textureCoordinate1, itextureCoordinate1);
}
XMFLOAT3 position;
XMFLOAT2 textureCoordinate0;
XMFLOAT2 textureCoordinate1;
static constexpr unsigned int InputElementCount = 3;
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
};
// Vertex struct holding position and normal vector.
struct VertexPositionNormal
{
VertexPositionNormal() = default;
VertexPositionNormal(const VertexPositionNormal&) = default;
VertexPositionNormal& operator=(const VertexPositionNormal&) = default;
VertexPositionNormal(VertexPositionNormal&&) = default;
VertexPositionNormal& operator=(VertexPositionNormal&&) = default;
VertexPositionNormal(XMFLOAT3 const& iposition, XMFLOAT3 const& inormal) noexcept
: position(iposition),
normal(inormal)
{
}
VertexPositionNormal(FXMVECTOR iposition, FXMVECTOR inormal) noexcept
{
XMStoreFloat3(&this->position, iposition);
XMStoreFloat3(&this->normal, inormal);
}
XMFLOAT3 position;
XMFLOAT3 normal;
static constexpr unsigned int InputElementCount = 2;
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
};
// Vertex struct holding position, color, and texture mapping information.
struct VertexPositionColorTexture
{
VertexPositionColorTexture() = default;
VertexPositionColorTexture(const VertexPositionColorTexture&) = default;
VertexPositionColorTexture& operator=(const VertexPositionColorTexture&) = default;
VertexPositionColorTexture(VertexPositionColorTexture&&) = default;
VertexPositionColorTexture& operator=(VertexPositionColorTexture&&) = default;
VertexPositionColorTexture(XMFLOAT3 const& iposition, XMFLOAT4 const& icolor, XMFLOAT2 const& itextureCoordinate) noexcept
: position(iposition),
color(icolor),
textureCoordinate(itextureCoordinate)
{
}
VertexPositionColorTexture(FXMVECTOR iposition, FXMVECTOR icolor, FXMVECTOR itextureCoordinate) noexcept
{
XMStoreFloat3(&this->position, iposition);
XMStoreFloat4(&this->color, icolor);
XMStoreFloat2(&this->textureCoordinate, itextureCoordinate);
}
XMFLOAT3 position;
XMFLOAT4 color;
XMFLOAT2 textureCoordinate;
static constexpr unsigned int InputElementCount = 3;
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
};
// Vertex struct holding position, normal vector, and color information.
struct VertexPositionNormalColor
{
VertexPositionNormalColor() = default;
VertexPositionNormalColor(const VertexPositionNormalColor&) = default;
VertexPositionNormalColor& operator=(const VertexPositionNormalColor&) = default;
VertexPositionNormalColor(VertexPositionNormalColor&&) = default;
VertexPositionNormalColor& operator=(VertexPositionNormalColor&&) = default;
VertexPositionNormalColor(XMFLOAT3 const& iposition, XMFLOAT3 const& inormal, XMFLOAT4 const& icolor) noexcept
: position(iposition),
normal(inormal),
color(icolor)
{
}
VertexPositionNormalColor(FXMVECTOR iposition, FXMVECTOR inormal, FXMVECTOR icolor) noexcept
{
XMStoreFloat3(&this->position, iposition);
XMStoreFloat3(&this->normal, inormal);
XMStoreFloat4(&this->color, icolor);
}
XMFLOAT3 position;
XMFLOAT3 normal;
XMFLOAT4 color;
static constexpr unsigned int InputElementCount = 3;
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
};
// Vertex struct holding position, normal vector, and texture mapping information.
struct VertexPositionNormalTexture
{
VertexPositionNormalTexture() = default;
VertexPositionNormalTexture(const VertexPositionNormalTexture&) = default;
VertexPositionNormalTexture& operator=(const VertexPositionNormalTexture&) = default;
VertexPositionNormalTexture(VertexPositionNormalTexture&&) = default;
VertexPositionNormalTexture& operator=(VertexPositionNormalTexture&&) = default;
VertexPositionNormalTexture(XMFLOAT3 const& iposition, XMFLOAT3 const& inormal, XMFLOAT2 const& itextureCoordinate) noexcept
: position(iposition),
normal(inormal),
textureCoordinate(itextureCoordinate)
{
}
VertexPositionNormalTexture(FXMVECTOR iposition, FXMVECTOR inormal, FXMVECTOR itextureCoordinate) noexcept
{
XMStoreFloat3(&this->position, iposition);
XMStoreFloat3(&this->normal, inormal);
XMStoreFloat2(&this->textureCoordinate, itextureCoordinate);
}
XMFLOAT3 position;
XMFLOAT3 normal;
XMFLOAT2 textureCoordinate;
static constexpr unsigned int InputElementCount = 3;
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
};
// Vertex struct holding position, normal vector, color, and texture mapping information.
struct VertexPositionNormalColorTexture
{
VertexPositionNormalColorTexture() = default;
VertexPositionNormalColorTexture(const VertexPositionNormalColorTexture&) = default;
VertexPositionNormalColorTexture& operator=(const VertexPositionNormalColorTexture&) = default;
VertexPositionNormalColorTexture(VertexPositionNormalColorTexture&&) = default;
VertexPositionNormalColorTexture& operator=(VertexPositionNormalColorTexture&&) = default;
VertexPositionNormalColorTexture(
XMFLOAT3 const& iposition,
XMFLOAT3 const& inormal,
XMFLOAT4 const& icolor,
XMFLOAT2 const& itextureCoordinate) noexcept
: position(iposition),
normal(inormal),
color(icolor),
textureCoordinate(itextureCoordinate)
{
}
VertexPositionNormalColorTexture(FXMVECTOR iposition, FXMVECTOR inormal, FXMVECTOR icolor, CXMVECTOR itextureCoordinate) noexcept
{
XMStoreFloat3(&this->position, iposition);
XMStoreFloat3(&this->normal, inormal);
XMStoreFloat4(&this->color, icolor);
XMStoreFloat2(&this->textureCoordinate, itextureCoordinate);
}
XMFLOAT3 position;
XMFLOAT3 normal;
XMFLOAT4 color;
XMFLOAT2 textureCoordinate;
static constexpr unsigned int InputElementCount = 4;
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
};
// Vertex struct for Visual Studio Shader Designer (DGSL) holding position, normal,
// tangent, color (RGBA), and texture mapping information
struct VertexPositionNormalTangentColorTexture
{
VertexPositionNormalTangentColorTexture() = default;
VertexPositionNormalTangentColorTexture(const VertexPositionNormalTangentColorTexture&) = default;
VertexPositionNormalTangentColorTexture& operator=(const VertexPositionNormalTangentColorTexture&) = default;
VertexPositionNormalTangentColorTexture(VertexPositionNormalTangentColorTexture&&) = default;
VertexPositionNormalTangentColorTexture& operator=(VertexPositionNormalTangentColorTexture&&) = default;
XMFLOAT3 position;
XMFLOAT3 normal;
XMFLOAT4 tangent;
uint32_t color;
XMFLOAT2 textureCoordinate;
VertexPositionNormalTangentColorTexture(
XMFLOAT3 const& iposition,
XMFLOAT3 const& inormal,
XMFLOAT4 const& itangent,
uint32_t irgba,
XMFLOAT2 const& itextureCoordinate) noexcept
: position(iposition),
normal(inormal),
tangent(itangent),
color(irgba),
textureCoordinate(itextureCoordinate)
{
}
VertexPositionNormalTangentColorTexture(
FXMVECTOR iposition,
FXMVECTOR inormal,
FXMVECTOR itangent,
uint32_t irgba,
CXMVECTOR itextureCoordinate) noexcept
: color(irgba)
{
XMStoreFloat3(&this->position, iposition);
XMStoreFloat3(&this->normal, inormal);
XMStoreFloat4(&this->tangent, itangent);
XMStoreFloat2(&this->textureCoordinate, itextureCoordinate);
}
VertexPositionNormalTangentColorTexture(
XMFLOAT3 const& iposition,
XMFLOAT3 const& inormal,
XMFLOAT4 const& itangent,
XMFLOAT4 const& icolor,
XMFLOAT2 const& itextureCoordinate) noexcept
: position(iposition),
normal(inormal),
tangent(itangent),
color{},
textureCoordinate(itextureCoordinate)
{
SetColor(icolor);
}
VertexPositionNormalTangentColorTexture(
FXMVECTOR iposition,
FXMVECTOR inormal,
FXMVECTOR itangent,
CXMVECTOR icolor,
CXMVECTOR itextureCoordinate) noexcept
: color{}
{
XMStoreFloat3(&this->position, iposition);
XMStoreFloat3(&this->normal, inormal);
XMStoreFloat4(&this->tangent, itangent);
XMStoreFloat2(&this->textureCoordinate, itextureCoordinate);
SetColor(icolor);
}
void __cdecl SetColor(XMFLOAT4 const& icolor) noexcept { SetColor(XMLoadFloat4(&icolor)); }
void XM_CALLCONV SetColor(FXMVECTOR icolor) noexcept;
static constexpr unsigned int InputElementCount = 5;
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
};
// Vertex struct for Visual Studio Shader Designer (DGSL) holding position, normal,
// tangent, color (RGBA), texture mapping information, and skinning weights
struct VertexPositionNormalTangentColorTextureSkinning : public VertexPositionNormalTangentColorTexture
{
VertexPositionNormalTangentColorTextureSkinning() = default;
VertexPositionNormalTangentColorTextureSkinning(const VertexPositionNormalTangentColorTextureSkinning&) = default;
VertexPositionNormalTangentColorTextureSkinning& operator=(const VertexPositionNormalTangentColorTextureSkinning&) = default;
VertexPositionNormalTangentColorTextureSkinning(VertexPositionNormalTangentColorTextureSkinning&&) = default;
VertexPositionNormalTangentColorTextureSkinning& operator=(VertexPositionNormalTangentColorTextureSkinning&&) = default;
uint32_t indices;
uint32_t weights;
VertexPositionNormalTangentColorTextureSkinning(
XMFLOAT3 const& iposition,
XMFLOAT3 const& inormal,
XMFLOAT4 const& itangent,
uint32_t irgba,
XMFLOAT2 const& itextureCoordinate,
XMUINT4 const& iindices,
XMFLOAT4 const& iweights) noexcept
: VertexPositionNormalTangentColorTexture(iposition, inormal, itangent, irgba, itextureCoordinate),
indices{},
weights{}
{
SetBlendIndices(iindices);
SetBlendWeights(iweights);
}
VertexPositionNormalTangentColorTextureSkinning(
FXMVECTOR iposition,
FXMVECTOR inormal,
FXMVECTOR itangent,
uint32_t irgba,
CXMVECTOR itextureCoordinate,
XMUINT4 const& iindices,
CXMVECTOR iweights) noexcept
: VertexPositionNormalTangentColorTexture(iposition, inormal, itangent, irgba, itextureCoordinate),
indices{},
weights{}
{
SetBlendIndices(iindices);
SetBlendWeights(iweights);
}
VertexPositionNormalTangentColorTextureSkinning(
XMFLOAT3 const& iposition,
XMFLOAT3 const& inormal,
XMFLOAT4 const& itangent,
XMFLOAT4 const& icolor,
XMFLOAT2 const& itextureCoordinate,
XMUINT4 const& iindices,
XMFLOAT4 const& iweights) noexcept
: VertexPositionNormalTangentColorTexture(iposition, inormal, itangent, icolor, itextureCoordinate),
indices{},
weights{}
{
SetBlendIndices(iindices);
SetBlendWeights(iweights);
}
VertexPositionNormalTangentColorTextureSkinning(
FXMVECTOR iposition,
FXMVECTOR inormal,
FXMVECTOR itangent,
CXMVECTOR icolor,
CXMVECTOR itextureCoordinate,
XMUINT4 const& iindices,
CXMVECTOR iweights) noexcept
: VertexPositionNormalTangentColorTexture(iposition, inormal, itangent, icolor, itextureCoordinate),
indices{},
weights{}
{
SetBlendIndices(iindices);
SetBlendWeights(iweights);
}
void __cdecl SetBlendIndices(XMUINT4 const& iindices) noexcept;
void __cdecl SetBlendWeights(XMFLOAT4 const& iweights) noexcept { SetBlendWeights(XMLoadFloat4(&iweights)); }
void XM_CALLCONV SetBlendWeights(FXMVECTOR iweights) noexcept;
static constexpr unsigned int InputElementCount = 7;
static const D3D11_INPUT_ELEMENT_DESC InputElements[InputElementCount];
};
}
}

View File

@ -0,0 +1,177 @@
//--------------------------------------------------------------------------------------
// File: WICTextureLoader.h
//
// Function for loading a WIC image and creating a Direct3D runtime texture for it
// (auto-generating mipmaps if possible)
//
// Note: Assumes application has already called CoInitializeEx
//
// Warning: CreateWICTexture* functions are not thread-safe if given a d3dContext instance for
// auto-gen mipmap support.
//
// Note these functions are useful for images created as simple 2D textures. For
// more complex resources, DDSTextureLoader is an excellent light-weight runtime loader.
// For a full-featured DDS file reader, writer, and texture processing pipeline see
// the 'Texconv' sample and the 'DirectXTex' library.
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248926
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if defined(_XBOX_ONE) && defined(_TITLE)
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#endif
#include <cstddef>
#include <cstdint>
#ifdef _MSC_VER
#pragma comment(lib,"uuid.lib")
#endif
namespace DirectX
{
inline namespace DX11
{
enum WIC_LOADER_FLAGS : uint32_t
{
WIC_LOADER_DEFAULT = 0,
WIC_LOADER_FORCE_SRGB = 0x1,
WIC_LOADER_IGNORE_SRGB = 0x2,
WIC_LOADER_SRGB_DEFAULT = 0x4,
WIC_LOADER_FIT_POW2 = 0x20,
WIC_LOADER_MAKE_SQUARE = 0x40,
WIC_LOADER_FORCE_RGBA32 = 0x80,
};
}
// Standard version
HRESULT __cdecl CreateWICTextureFromMemory(
_In_ ID3D11Device* d3dDevice,
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
_In_ size_t wicDataSize,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_In_ size_t maxsize = 0) noexcept;
HRESULT __cdecl CreateWICTextureFromFile(
_In_ ID3D11Device* d3dDevice,
_In_z_ const wchar_t* szFileName,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_In_ size_t maxsize = 0) noexcept;
// Standard version with optional auto-gen mipmap support
HRESULT __cdecl CreateWICTextureFromMemory(
#if defined(_XBOX_ONE) && defined(_TITLE)
_In_ ID3D11DeviceX* d3dDevice,
_In_opt_ ID3D11DeviceContextX* d3dContext,
#else
_In_ ID3D11Device* d3dDevice,
_In_opt_ ID3D11DeviceContext* d3dContext,
#endif
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
_In_ size_t wicDataSize,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_In_ size_t maxsize = 0) noexcept;
HRESULT __cdecl CreateWICTextureFromFile(
#if defined(_XBOX_ONE) && defined(_TITLE)
_In_ ID3D11DeviceX* d3dDevice,
_In_opt_ ID3D11DeviceContextX* d3dContext,
#else
_In_ ID3D11Device* d3dDevice,
_In_opt_ ID3D11DeviceContext* d3dContext,
#endif
_In_z_ const wchar_t* szFileName,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_In_ size_t maxsize = 0) noexcept;
// Extended version
HRESULT __cdecl CreateWICTextureFromMemoryEx(
_In_ ID3D11Device* d3dDevice,
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
_In_ size_t wicDataSize,
_In_ size_t maxsize,
_In_ D3D11_USAGE usage,
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ WIC_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
HRESULT __cdecl CreateWICTextureFromFileEx(
_In_ ID3D11Device* d3dDevice,
_In_z_ const wchar_t* szFileName,
_In_ size_t maxsize,
_In_ D3D11_USAGE usage,
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ WIC_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
// Extended version with optional auto-gen mipmap support
HRESULT __cdecl CreateWICTextureFromMemoryEx(
#if defined(_XBOX_ONE) && defined(_TITLE)
_In_ ID3D11DeviceX* d3dDevice,
_In_opt_ ID3D11DeviceContextX* d3dContext,
#else
_In_ ID3D11Device* d3dDevice,
_In_opt_ ID3D11DeviceContext* d3dContext,
#endif
_In_reads_bytes_(wicDataSize) const uint8_t* wicData,
_In_ size_t wicDataSize,
_In_ size_t maxsize,
_In_ D3D11_USAGE usage,
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ WIC_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
HRESULT __cdecl CreateWICTextureFromFileEx(
#if defined(_XBOX_ONE) && defined(_TITLE)
_In_ ID3D11DeviceX* d3dDevice,
_In_opt_ ID3D11DeviceContextX* d3dContext,
#else
_In_ ID3D11Device* d3dDevice,
_In_opt_ ID3D11DeviceContext* d3dContext,
#endif
_In_z_ const wchar_t* szFileName,
_In_ size_t maxsize,
_In_ D3D11_USAGE usage,
_In_ unsigned int bindFlags,
_In_ unsigned int cpuAccessFlags,
_In_ unsigned int miscFlags,
_In_ WIC_LOADER_FLAGS loadFlags,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView) noexcept;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-dynamic-exception-spec"
#endif
inline namespace DX11
{
DEFINE_ENUM_FLAG_OPERATORS(WIC_LOADER_FLAGS);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}

View File

@ -0,0 +1,67 @@
//--------------------------------------------------------------------------------------
// File: XboxDDSTextureLoader.h
//
// Functions for loading a DDS texture using the XBOX extended header and creating a
// Direct3D11.X runtime resource for it via the CreatePlacement APIs
//
// Note these functions will not load standard DDS files. Use the DDSTextureLoader
// module in the DirectXTex package or as part of the DirectXTK library to load
// these files which use standard Direct3D resource creation APIs.
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248926
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#if !defined(_XBOX_ONE) || !defined(_TITLE)
#error This module only supports Xbox One exclusive apps
#endif
#include <d3d11_x.h>
#include <cstddef>
#include <cstdint>
#ifndef DDS_ALPHA_MODE_DEFINED
#define DDS_ALPHA_MODE_DEFINED
namespace DirectX
{
enum DDS_ALPHA_MODE : uint32_t
{
DDS_ALPHA_MODE_UNKNOWN = 0,
DDS_ALPHA_MODE_STRAIGHT = 1,
DDS_ALPHA_MODE_PREMULTIPLIED = 2,
DDS_ALPHA_MODE_OPAQUE = 3,
DDS_ALPHA_MODE_CUSTOM = 4,
};
}
#endif
namespace Xbox
{
using DirectX::DDS_ALPHA_MODE;
HRESULT __cdecl CreateDDSTextureFromMemory(
_In_ ID3D11DeviceX* d3dDevice,
_In_reads_bytes_(ddsDataSize) const uint8_t* ddsData,
_In_ size_t ddsDataSize,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_Outptr_ void** grfxMemory,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_In_ bool forceSRGB = false) noexcept;
HRESULT __cdecl CreateDDSTextureFromFile( _In_ ID3D11DeviceX* d3dDevice,
_In_z_ const wchar_t* szFileName,
_Outptr_opt_ ID3D11Resource** texture,
_Outptr_opt_ ID3D11ShaderResourceView** textureView,
_Outptr_ void** grfxMemory,
_Out_opt_ DDS_ALPHA_MODE* alphaMode = nullptr,
_In_ bool forceSRGB = false) noexcept;
void FreeDDSTextureMemory( _In_opt_ void* grfxMemory ) noexcept;
}

181
CoreLib/include/Src/CMO.h Normal file
View File

@ -0,0 +1,181 @@
//--------------------------------------------------------------------------------------
// File: CMO.h
//
// .CMO files are built by Visual Studio's MeshContentTask and an example renderer was
// provided in the VS Direct3D Starter Kit
// https://devblogs.microsoft.com/cppblog/developing-an-app-with-the-visual-studio-3d-starter-kit-part-1-of-3/
// https://devblogs.microsoft.com/cppblog/developing-an-app-with-the-visual-studio-3d-starter-kit-part-2-of-3/
// https://devblogs.microsoft.com/cppblog/developing-an-app-with-the-visual-studio-3d-starter-kit-part-3-of-3/
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
//--------------------------------------------------------------------------------------
#pragma once
#include <DirectXMath.h>
#include <cstdint>
namespace VSD3DStarter
{
// .CMO files
// UINT - Mesh count
// { [Mesh count]
// UINT - Length of name
// wchar_t[] - Name of mesh (if length > 0)
// UINT - Material count
// { [Material count]
// UINT - Length of material name
// wchar_t[] - Name of material (if length > 0)
// Material structure
// UINT - Length of pixel shader name
// wchar_t[] - Name of pixel shader (if length > 0)
// { [8]
// UINT - Length of texture name
// wchar_t[] - Name of texture (if length > 0)
// }
// }
// BYTE - 1 if there is skeletal animation data present
// UINT - SubMesh count
// { [SubMesh count]
// SubMesh structure
// }
// UINT - IB Count
// { [IB Count]
// UINT - Number of USHORTs in IB
// USHORT[] - Array of indices
// }
// UINT - VB Count
// { [VB Count]
// UINT - Number of verts in VB
// Vertex[] - Array of vertices
// }
// UINT - Skinning VB Count
// { [Skinning VB Count]
// UINT - Number of verts in Skinning VB
// SkinningVertex[] - Array of skinning verts
// }
// MeshExtents structure
// [If skeleton animation data is not present, file ends here]
// UINT - Bone count
// { [Bone count]
// UINT - Length of bone name
// wchar_t[] - Bone name (if length > 0)
// Bone structure
// }
// UINT - Animation clip count
// { [Animation clip count]
// UINT - Length of clip name
// wchar_t[] - Clip name (if length > 0)
// float - Start time
// float - End time
// UINT - Keyframe count
// { [Keyframe count]
// Keyframe structure
// }
// }
// }
#pragma pack(push,1)
struct Material
{
DirectX::XMFLOAT4 Ambient;
DirectX::XMFLOAT4 Diffuse;
DirectX::XMFLOAT4 Specular;
float SpecularPower;
DirectX::XMFLOAT4 Emissive;
DirectX::XMFLOAT4X4 UVTransform;
};
constexpr uint32_t MAX_TEXTURE = 8;
struct SubMesh
{
uint32_t MaterialIndex;
uint32_t IndexBufferIndex;
uint32_t VertexBufferIndex;
uint32_t StartIndex;
uint32_t PrimCount;
};
constexpr uint32_t NUM_BONE_INFLUENCES = 4;
// Vertex struct for Visual Studio Shader Designer (DGSL) holding position, normal,
// tangent, color (RGBA), and texture mapping information
struct VertexPositionNormalTangentColorTexture
{
DirectX::XMFLOAT3 position;
DirectX::XMFLOAT3 normal;
DirectX::XMFLOAT4 tangent;
uint32_t color;
DirectX::XMFLOAT2 textureCoordinate;
};
struct SkinningVertex
{
uint32_t boneIndex[NUM_BONE_INFLUENCES];
float boneWeight[NUM_BONE_INFLUENCES];
};
struct MeshExtents
{
float CenterX, CenterY, CenterZ;
float Radius;
float MinX, MinY, MinZ;
float MaxX, MaxY, MaxZ;
};
struct Bone
{
int32_t ParentIndex;
DirectX::XMFLOAT4X4 InvBindPos;
DirectX::XMFLOAT4X4 BindPos;
DirectX::XMFLOAT4X4 LocalTransform;
};
struct Clip
{
float StartTime;
float EndTime;
uint32_t keys;
};
struct Keyframe
{
uint32_t BoneIndex;
float Time;
DirectX::XMFLOAT4X4 Transform;
};
#pragma pack(pop)
const Material s_defMaterial =
{
{ 0.2f, 0.2f, 0.2f, 1.f },
{ 0.8f, 0.8f, 0.8f, 1.f },
{ 0.0f, 0.0f, 0.0f, 1.f },
1.f,
{ 0.0f, 0.0f, 0.0f, 1.0f },
{ 1.f, 0.f, 0.f, 0.f,
0.f, 1.f, 0.f, 0.f,
0.f, 0.f, 1.f, 0.f,
0.f, 0.f, 0.f, 1.f },
};
} // namespace
static_assert(sizeof(VSD3DStarter::Material) == 132, "CMO Mesh structure size incorrect");
static_assert(sizeof(VSD3DStarter::SubMesh) == 20, "CMO Mesh structure size incorrect");
static_assert(sizeof(VSD3DStarter::VertexPositionNormalTangentColorTexture) == 52, "CMO Mesh structure size incorrect");
static_assert(sizeof(VSD3DStarter::SkinningVertex) == 32, "CMO Mesh structure size incorrect");
static_assert(sizeof(VSD3DStarter::MeshExtents) == 40, "CMO Mesh structure size incorrect");
static_assert(sizeof(VSD3DStarter::Bone) == 196, "CMO Mesh structure size incorrect");
static_assert(sizeof(VSD3DStarter::Clip) == 12, "CMO Mesh structure size incorrect");
static_assert(sizeof(VSD3DStarter::Keyframe) == 72, "CMO Mesh structure size incorrect");

330
CoreLib/include/Src/DDS.h Normal file
View File

@ -0,0 +1,330 @@
//--------------------------------------------------------------------------------------
// DDS.h
//
// This header defines constants and structures that are useful when parsing
// DDS files. DDS files were originally designed to use several structures
// and constants that are native to DirectDraw and are defined in ddraw.h,
// such as DDSURFACEDESC2 and DDSCAPS2. This file defines similar
// (compatible) constants and structures so that one can use DDS files
// without needing to include ddraw.h.
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248926
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
//--------------------------------------------------------------------------------------
#pragma once
#include <cstdint>
namespace DirectX
{
#pragma pack(push,1)
constexpr uint32_t DDS_MAGIC = 0x20534444; // "DDS "
struct DDS_PIXELFORMAT
{
uint32_t size;
uint32_t flags;
uint32_t fourCC;
uint32_t RGBBitCount;
uint32_t RBitMask;
uint32_t GBitMask;
uint32_t BBitMask;
uint32_t ABitMask;
};
#define DDS_FOURCC 0x00000004 // DDPF_FOURCC
#define DDS_RGB 0x00000040 // DDPF_RGB
#define DDS_RGBA 0x00000041 // DDPF_RGB | DDPF_ALPHAPIXELS
#define DDS_LUMINANCE 0x00020000 // DDPF_LUMINANCE
#define DDS_LUMINANCEA 0x00020001 // DDPF_LUMINANCE | DDPF_ALPHAPIXELS
#define DDS_ALPHAPIXELS 0x00000001 // DDPF_ALPHAPIXELS
#define DDS_ALPHA 0x00000002 // DDPF_ALPHA
#define DDS_PAL8 0x00000020 // DDPF_PALETTEINDEXED8
#define DDS_PAL8A 0x00000021 // DDPF_PALETTEINDEXED8 | DDPF_ALPHAPIXELS
#define DDS_BUMPLUMINANCE 0x00040000 // DDPF_BUMPLUMINANCE
#define DDS_BUMPDUDV 0x00080000 // DDPF_BUMPDUDV
#define DDS_BUMPDUDVA 0x00080001 // DDPF_BUMPDUDV | DDPF_ALPHAPIXELS
#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
(static_cast<uint32_t>(static_cast<uint8_t>(ch0)) \
| (static_cast<uint32_t>(static_cast<uint8_t>(ch1)) << 8) \
| (static_cast<uint32_t>(static_cast<uint8_t>(ch2)) << 16) \
| (static_cast<uint32_t>(static_cast<uint8_t>(ch3)) << 24))
#endif /* MAKEFOURCC */
#ifndef DDSGLOBALCONST
#if defined(__GNUC__) && !defined(__MINGW32__)
#define DDSGLOBALCONST extern const __attribute__((weak))
#else
#define DDSGLOBALCONST extern const __declspec(selectany)
#endif
#endif /* DDSGLOBALCONST */
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DXT1 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','1'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DXT2 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','2'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DXT3 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','3'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DXT4 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','4'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DXT5 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','T','5'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_BC4_UNORM =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','4','U'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_BC4_SNORM =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','4','S'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_BC5_UNORM =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','5','U'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_BC5_SNORM =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('B','C','5','S'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_R8G8_B8G8 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('R','G','B','G'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_G8R8_G8B8 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('G','R','G','B'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_YUY2 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('Y','U','Y','2'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_UYVY =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('U','Y','V','Y'), 0, 0, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8R8G8B8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X8R8G8B8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8B8G8R8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X8B8G8R8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_G16R16 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 32, 0x0000ffff, 0xffff0000, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_R5G6B5 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0xf800, 0x07e0, 0x001f, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A1R5G5B5 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x7c00, 0x03e0, 0x001f, 0x8000 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X1R5G5B5 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0x7c00, 0x03e0, 0x001f, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A4R4G4B4 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x0f00, 0x00f0, 0x000f, 0xf000 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X4R4G4B4 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0x0f00, 0x00f0, 0x000f, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_R8G8B8 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 24, 0xff0000, 0x00ff00, 0x0000ff, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8R3G3B2 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00e0, 0x001c, 0x0003, 0xff00 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_R3G3B2 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 8, 0xe0, 0x1c, 0x03, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A4L4 =
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 8, 0x0f, 0, 0, 0xf0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L8 =
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 8, 0xff, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L16 =
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCE, 0, 16, 0xffff, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8L8 =
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 16, 0x00ff, 0, 0, 0xff00 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8L8_ALT =
{ sizeof(DDS_PIXELFORMAT), DDS_LUMINANCEA, 0, 8, 0x00ff, 0, 0, 0xff00 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L8_NVTT1 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 8, 0xff, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L16_NVTT1 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGB, 0, 16, 0xffff, 0, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8L8_NVTT1 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 16, 0x00ff, 0, 0, 0xff00 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A8 =
{ sizeof(DDS_PIXELFORMAT), DDS_ALPHA, 0, 8, 0, 0, 0, 0xff };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_V8U8 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 16, 0x00ff, 0xff00, 0, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_Q8W8V8U8 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_V16U16 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDV, 0, 32, 0x0000ffff, 0xffff0000, 0, 0 };
// D3DFMT_A2R10G10B10/D3DFMT_A2B10G10R10 should be written using DX10 extension to avoid D3DX 10:10:10:2 reversal issue
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A2R10G10B10 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A2B10G10R10 =
{ sizeof(DDS_PIXELFORMAT), DDS_RGBA, 0, 32, 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000 };
// The following legacy Direct3D 9 formats use 'mixed' signed & unsigned channels so requires special handling
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_A2W10V10U10 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPDUDVA, 0, 32, 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_L6V5U5 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPLUMINANCE, 0, 16, 0x001f, 0x03e0, 0xfc00, 0 };
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_X8L8V8U8 =
{ sizeof(DDS_PIXELFORMAT), DDS_BUMPLUMINANCE, 0, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0 };
// This indicates the DDS_HEADER_DXT10 extension is present (the format is in dxgiFormat)
DDSGLOBALCONST DDS_PIXELFORMAT DDSPF_DX10 =
{ sizeof(DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('D','X','1','0'), 0, 0, 0, 0, 0 };
#define DDS_HEADER_FLAGS_TEXTURE 0x00001007 // DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT
#define DDS_HEADER_FLAGS_MIPMAP 0x00020000 // DDSD_MIPMAPCOUNT
#define DDS_HEADER_FLAGS_VOLUME 0x00800000 // DDSD_DEPTH
#define DDS_HEADER_FLAGS_PITCH 0x00000008 // DDSD_PITCH
#define DDS_HEADER_FLAGS_LINEARSIZE 0x00080000 // DDSD_LINEARSIZE
#define DDS_HEIGHT 0x00000002 // DDSD_HEIGHT
#define DDS_WIDTH 0x00000004 // DDSD_WIDTH
#define DDS_SURFACE_FLAGS_TEXTURE 0x00001000 // DDSCAPS_TEXTURE
#define DDS_SURFACE_FLAGS_MIPMAP 0x00400008 // DDSCAPS_COMPLEX | DDSCAPS_MIPMAP
#define DDS_SURFACE_FLAGS_CUBEMAP 0x00000008 // DDSCAPS_COMPLEX
#define DDS_CUBEMAP_POSITIVEX 0x00000600 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEX
#define DDS_CUBEMAP_NEGATIVEX 0x00000a00 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEX
#define DDS_CUBEMAP_POSITIVEY 0x00001200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEY
#define DDS_CUBEMAP_NEGATIVEY 0x00002200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEY
#define DDS_CUBEMAP_POSITIVEZ 0x00004200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEZ
#define DDS_CUBEMAP_NEGATIVEZ 0x00008200 // DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEZ
#define DDS_CUBEMAP_ALLFACES ( DDS_CUBEMAP_POSITIVEX | DDS_CUBEMAP_NEGATIVEX |\
DDS_CUBEMAP_POSITIVEY | DDS_CUBEMAP_NEGATIVEY |\
DDS_CUBEMAP_POSITIVEZ | DDS_CUBEMAP_NEGATIVEZ )
#define DDS_CUBEMAP 0x00000200 // DDSCAPS2_CUBEMAP
#define DDS_FLAGS_VOLUME 0x00200000 // DDSCAPS2_VOLUME
// Subset here matches D3D10_RESOURCE_DIMENSION and D3D11_RESOURCE_DIMENSION
enum DDS_RESOURCE_DIMENSION : uint32_t
{
DDS_DIMENSION_TEXTURE1D = 2,
DDS_DIMENSION_TEXTURE2D = 3,
DDS_DIMENSION_TEXTURE3D = 4,
};
// Subset here matches D3D10_RESOURCE_MISC_FLAG and D3D11_RESOURCE_MISC_FLAG
enum DDS_RESOURCE_MISC_FLAG : uint32_t
{
DDS_RESOURCE_MISC_TEXTURECUBE = 0x4L,
};
enum DDS_MISC_FLAGS2 : uint32_t
{
DDS_MISC_FLAGS2_ALPHA_MODE_MASK = 0x7L,
};
#ifndef DDS_ALPHA_MODE_DEFINED
#define DDS_ALPHA_MODE_DEFINED
enum DDS_ALPHA_MODE : uint32_t
{
DDS_ALPHA_MODE_UNKNOWN = 0,
DDS_ALPHA_MODE_STRAIGHT = 1,
DDS_ALPHA_MODE_PREMULTIPLIED = 2,
DDS_ALPHA_MODE_OPAQUE = 3,
DDS_ALPHA_MODE_CUSTOM = 4,
};
#endif
struct DDS_HEADER
{
uint32_t size;
uint32_t flags;
uint32_t height;
uint32_t width;
uint32_t pitchOrLinearSize;
uint32_t depth; // only if DDS_HEADER_FLAGS_VOLUME is set in flags
uint32_t mipMapCount;
uint32_t reserved1[11];
DDS_PIXELFORMAT ddspf;
uint32_t caps;
uint32_t caps2;
uint32_t caps3;
uint32_t caps4;
uint32_t reserved2;
};
struct DDS_HEADER_DXT10
{
DXGI_FORMAT dxgiFormat;
uint32_t resourceDimension;
uint32_t miscFlag; // see D3D11_RESOURCE_MISC_FLAG
uint32_t arraySize;
uint32_t miscFlags2; // see DDS_MISC_FLAGS2
};
#pragma pack(pop)
static_assert(sizeof(DDS_PIXELFORMAT) == 32, "DDS pixel format size mismatch");
static_assert(sizeof(DDS_HEADER) == 124, "DDS Header size mismatch");
static_assert(sizeof(DDS_HEADER_DXT10) == 20, "DDS DX10 Extended Header size mismatch");
constexpr size_t DDS_MIN_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER);
constexpr size_t DDS_DX10_HEADER_SIZE = sizeof(uint32_t) + sizeof(DDS_HEADER) + sizeof(DDS_HEADER_DXT10);
static_assert(DDS_DX10_HEADER_SIZE > DDS_MIN_HEADER_SIZE, "DDS DX10 Header should be larger than standard header");
} // namespace
namespace Xbox
{
DDSGLOBALCONST DirectX::DDS_PIXELFORMAT DDSPF_XBOX =
{ sizeof(DirectX::DDS_PIXELFORMAT), DDS_FOURCC, MAKEFOURCC('X','B','O','X'), 0, 0, 0, 0, 0 };
#pragma pack(push,1)
struct DDS_HEADER_XBOX
// Must match structure in XboxDDSTextureLoader module
{
DXGI_FORMAT dxgiFormat;
uint32_t resourceDimension;
uint32_t miscFlag; // see DDS_RESOURCE_MISC_FLAG
uint32_t arraySize;
uint32_t miscFlags2; // see DDS_MISC_FLAGS2
uint32_t tileMode; // see XG_TILE_MODE / XG_SWIZZLE_MODE
uint32_t baseAlignment;
uint32_t dataSize;
uint32_t xdkVer; // matching _XDK_VER / _GXDK_VER
};
#pragma pack(pop)
static_assert(sizeof(DDS_HEADER_XBOX) == 36, "DDS XBOX Header size mismatch");
static_assert(sizeof(DDS_HEADER_XBOX) > sizeof(DirectX::DDS_HEADER_DXT10), "DDS XBOX Header should be larger than DX10 header");
constexpr size_t DDS_XBOX_HEADER_SIZE = sizeof(uint32_t) + sizeof(DirectX::DDS_HEADER) + sizeof(DDS_HEADER_XBOX);
constexpr uint32_t XBOX_TILEMODE_SCARLETT = 0x1000000;
} // namespace

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
//--------------------------------------------------------------------------------------
// File: DirectXHelpers.cpp
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#include "pch.h"
#include "DirectXHelpers.h"
#include "Effects.h"
#include "PlatformHelpers.h"
using namespace DirectX;
_Use_decl_annotations_
HRESULT DirectX::CreateInputLayoutFromEffect(
ID3D11Device* device,
IEffect* effect,
const D3D11_INPUT_ELEMENT_DESC* desc,
size_t count,
ID3D11InputLayout** pInputLayout) noexcept
{
if (!pInputLayout)
return E_INVALIDARG;
*pInputLayout = nullptr;
if (!device || !effect || !desc || !count)
return E_INVALIDARG;
void const* shaderByteCode;
size_t byteCodeLength;
try
{
effect->GetVertexShaderBytecode(&shaderByteCode, &byteCodeLength);
}
catch (com_exception e)
{
return e.get_result();
}
catch (...)
{
return E_FAIL;
}
return device->CreateInputLayout(
desc, static_cast<UINT>(count),
shaderByteCode, byteCodeLength,
pInputLayout);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,94 @@
//--------------------------------------------------------------------------------------
// File: PlatformHelpers.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
//--------------------------------------------------------------------------------------
#pragma once
#ifdef _MSC_VER
#pragma warning(disable : 4324)
#endif
#include <exception>
#include <memory>
#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
(static_cast<uint32_t>(static_cast<uint8_t>(ch0)) \
| (static_cast<uint32_t>(static_cast<uint8_t>(ch1)) << 8) \
| (static_cast<uint32_t>(static_cast<uint8_t>(ch2)) << 16) \
| (static_cast<uint32_t>(static_cast<uint8_t>(ch3)) << 24))
#endif /* defined(MAKEFOURCC) */
// See https://walbourn.github.io/modern-c++-bitmask-types/
#ifndef ENUM_FLAGS_CONSTEXPR
#if defined(NTDDI_WIN10_RS1) && !defined(__MINGW32__)
#define ENUM_FLAGS_CONSTEXPR constexpr
#else
#define ENUM_FLAGS_CONSTEXPR const
#endif
#endif
namespace DirectX
{
// Helper class for COM exceptions
class com_exception : public std::exception
{
public:
com_exception(HRESULT hr) noexcept : result(hr) {}
const char* what() const noexcept override
{
static char s_str[64] = {};
sprintf_s(s_str, "Failure with HRESULT of %08X", static_cast<unsigned int>(result));
return s_str;
}
HRESULT get_result() const noexcept { return result; }
private:
HRESULT result;
};
// Helper utility converts D3D API failures into exceptions.
inline void ThrowIfFailed(HRESULT hr) noexcept(false)
{
if (FAILED(hr))
{
throw com_exception(hr);
}
}
// Helper for output debug tracing
inline void DebugTrace(_In_z_ _Printf_format_string_ const char* format, ...) noexcept
{
#ifdef _DEBUG
va_list args;
va_start(args, format);
char buff[1024] = {};
vsprintf_s(buff, format, args);
OutputDebugStringA(buff);
va_end(args);
#else
UNREFERENCED_PARAMETER(format);
#endif
}
// Helper smart-pointers
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN10) || (defined(_XBOX_ONE) && defined(_TITLE)) || !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
struct virtual_deleter { void operator()(void* p) noexcept { if (p) VirtualFree(p, 0, MEM_RELEASE); } };
#endif
struct handle_closer { void operator()(HANDLE h) noexcept { if (h) CloseHandle(h); } };
using ScopedHandle = std::unique_ptr<void, handle_closer>;
inline HANDLE safe_handle(HANDLE h) noexcept { return (h == INVALID_HANDLE_VALUE) ? nullptr : h; }
}

View File

@ -0,0 +1,247 @@
//-------------------------------------------------------------------------------------
// SimpleMath.cpp -- Simplified C++ Math wrapper for DirectXMath
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
// http://go.microsoft.com/fwlink/?LinkID=615561
//-------------------------------------------------------------------------------------
#include "pch.h"
#include "SimpleMath.h"
/****************************************************************************
*
* Constants
*
****************************************************************************/
namespace DirectX
{
namespace SimpleMath
{
const Vector2 Vector2::Zero = { 0.f, 0.f };
const Vector2 Vector2::One = { 1.f, 1.f };
const Vector2 Vector2::UnitX = { 1.f, 0.f };
const Vector2 Vector2::UnitY = { 0.f, 1.f };
const Vector3 Vector3::Zero = { 0.f, 0.f, 0.f };
const Vector3 Vector3::One = { 1.f, 1.f, 1.f };
const Vector3 Vector3::UnitX = { 1.f, 0.f, 0.f };
const Vector3 Vector3::UnitY = { 0.f, 1.f, 0.f };
const Vector3 Vector3::UnitZ = { 0.f, 0.f, 1.f };
const Vector3 Vector3::Up = { 0.f, 1.f, 0.f };
const Vector3 Vector3::Down = { 0.f, -1.f, 0.f };
const Vector3 Vector3::Right = { 1.f, 0.f, 0.f };
const Vector3 Vector3::Left = { -1.f, 0.f, 0.f };
const Vector3 Vector3::Forward = { 0.f, 0.f, -1.f };
const Vector3 Vector3::Backward = { 0.f, 0.f, 1.f };
const Vector4 Vector4::Zero = { 0.f, 0.f, 0.f, 0.f };
const Vector4 Vector4::One = { 1.f, 1.f, 1.f, 1.f };
const Vector4 Vector4::UnitX = { 1.f, 0.f, 0.f, 0.f };
const Vector4 Vector4::UnitY = { 0.f, 1.f, 0.f, 0.f };
const Vector4 Vector4::UnitZ = { 0.f, 0.f, 1.f, 0.f };
const Vector4 Vector4::UnitW = { 0.f, 0.f, 0.f, 1.f };
const Matrix Matrix::Identity = { 1.f, 0.f, 0.f, 0.f,
0.f, 1.f, 0.f, 0.f,
0.f, 0.f, 1.f, 0.f,
0.f, 0.f, 0.f, 1.f };
const Quaternion Quaternion::Identity = { 0.f, 0.f, 0.f, 1.f };
}
}
using namespace DirectX;
using namespace DirectX::SimpleMath;
/****************************************************************************
*
* Quaternion
*
****************************************************************************/
void Quaternion::RotateTowards(const Quaternion& target, float maxAngle, Quaternion& result) const noexcept
{
const XMVECTOR T = XMLoadFloat4(this);
// We can use the conjugate here instead of inverse assuming q1 & q2 are normalized.
const XMVECTOR R = XMQuaternionMultiply(XMQuaternionConjugate(T), target);
const float rs = XMVectorGetW(R);
const XMVECTOR L = XMVector3Length(R);
const float angle = 2.f * atan2f(XMVectorGetX(L), rs);
if (angle > maxAngle)
{
const XMVECTOR delta = XMQuaternionRotationAxis(R, maxAngle);
const XMVECTOR Q = XMQuaternionMultiply(delta, T);
XMStoreFloat4(&result, Q);
}
else
{
// Don't overshoot.
result = target;
}
}
void Quaternion::FromToRotation(const Vector3& fromDir, const Vector3& toDir, Quaternion& result) noexcept
{
// Melax, "The Shortest Arc Quaternion", Game Programming Gems, Charles River Media (2000).
const XMVECTOR F = XMVector3Normalize(fromDir);
const XMVECTOR T = XMVector3Normalize(toDir);
const float dot = XMVectorGetX(XMVector3Dot(F, T));
if (dot >= 1.f)
{
result = Identity;
}
else if (dot <= -1.f)
{
XMVECTOR axis = XMVector3Cross(F, Vector3::Right);
if (XMVector3NearEqual(XMVector3LengthSq(axis), g_XMZero, g_XMEpsilon))
{
axis = XMVector3Cross(F, Vector3::Up);
}
const XMVECTOR Q = XMQuaternionRotationAxis(axis, XM_PI);
XMStoreFloat4(&result, Q);
}
else
{
const XMVECTOR C = XMVector3Cross(F, T);
XMStoreFloat4(&result, C);
const float s = sqrtf((1.f + dot) * 2.f);
result.x /= s;
result.y /= s;
result.z /= s;
result.w = s * 0.5f;
}
}
void Quaternion::LookRotation(const Vector3& forward, const Vector3& up, Quaternion& result) noexcept
{
Quaternion q1;
FromToRotation(Vector3::Forward, forward, q1);
const XMVECTOR C = XMVector3Cross(forward, up);
if (XMVector3NearEqual(XMVector3LengthSq(C), g_XMZero, g_XMEpsilon))
{
// forward and up are co-linear
result = q1;
return;
}
const XMVECTOR U = XMQuaternionMultiply(q1, Vector3::Up);
Quaternion q2;
FromToRotation(U, up, q2);
XMStoreFloat4(&result, XMQuaternionMultiply(q2, q1));
}
/****************************************************************************
*
* Viewport
*
****************************************************************************/
#if defined(__d3d11_h__) || defined(__d3d11_x_h__)
static_assert(sizeof(DirectX::SimpleMath::Viewport) == sizeof(D3D11_VIEWPORT), "Size mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, x) == offsetof(D3D11_VIEWPORT, TopLeftX), "Layout mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, y) == offsetof(D3D11_VIEWPORT, TopLeftY), "Layout mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, width) == offsetof(D3D11_VIEWPORT, Width), "Layout mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, height) == offsetof(D3D11_VIEWPORT, Height), "Layout mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, minDepth) == offsetof(D3D11_VIEWPORT, MinDepth), "Layout mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, maxDepth) == offsetof(D3D11_VIEWPORT, MaxDepth), "Layout mismatch");
#endif
#if defined(__d3d12_h__) || defined(__d3d12_x_h__) || defined(__XBOX_D3D12_X__)
static_assert(sizeof(DirectX::SimpleMath::Viewport) == sizeof(D3D12_VIEWPORT), "Size mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, x) == offsetof(D3D12_VIEWPORT, TopLeftX), "Layout mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, y) == offsetof(D3D12_VIEWPORT, TopLeftY), "Layout mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, width) == offsetof(D3D12_VIEWPORT, Width), "Layout mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, height) == offsetof(D3D12_VIEWPORT, Height), "Layout mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, minDepth) == offsetof(D3D12_VIEWPORT, MinDepth), "Layout mismatch");
static_assert(offsetof(DirectX::SimpleMath::Viewport, maxDepth) == offsetof(D3D12_VIEWPORT, MaxDepth), "Layout mismatch");
#endif
#if defined(__dxgi1_2_h__) || defined(__d3d11_x_h__) || defined(__d3d12_x_h__) || defined(__XBOX_D3D12_X__)
RECT Viewport::ComputeDisplayArea(DXGI_SCALING scaling, UINT backBufferWidth, UINT backBufferHeight, int outputWidth, int outputHeight) noexcept
{
RECT rct = {};
switch (int(scaling))
{
case DXGI_SCALING_STRETCH:
// Output fills the entire window area
rct.top = 0;
rct.left = 0;
rct.right = outputWidth;
rct.bottom = outputHeight;
break;
case 2 /*DXGI_SCALING_ASPECT_RATIO_STRETCH*/:
// Output fills the window area but respects the original aspect ratio, using pillar boxing or letter boxing as required
// Note: This scaling option is not supported for legacy Win32 windows swap chains
{
assert(backBufferHeight > 0);
const float aspectRatio = float(backBufferWidth) / float(backBufferHeight);
// Horizontal fill
float scaledWidth = float(outputWidth);
float scaledHeight = float(outputWidth) / aspectRatio;
if (scaledHeight >= float(outputHeight))
{
// Do vertical fill
scaledWidth = float(outputHeight) * aspectRatio;
scaledHeight = float(outputHeight);
}
const float offsetX = (float(outputWidth) - scaledWidth) * 0.5f;
const float offsetY = (float(outputHeight) - scaledHeight) * 0.5f;
rct.left = static_cast<LONG>(offsetX);
rct.top = static_cast<LONG>(offsetY);
rct.right = static_cast<LONG>(offsetX + scaledWidth);
rct.bottom = static_cast<LONG>(offsetY + scaledHeight);
// Clip to display window
rct.left = std::max<LONG>(0, rct.left);
rct.top = std::max<LONG>(0, rct.top);
rct.right = std::min<LONG>(outputWidth, rct.right);
rct.bottom = std::min<LONG>(outputHeight, rct.bottom);
}
break;
case DXGI_SCALING_NONE:
default:
// Output is displayed in the upper left corner of the window area
rct.top = 0;
rct.left = 0;
rct.right = std::min<LONG>(static_cast<LONG>(backBufferWidth), outputWidth);
rct.bottom = std::min<LONG>(static_cast<LONG>(backBufferHeight), outputHeight);
break;
}
return rct;
}
#endif
RECT Viewport::ComputeTitleSafeArea(UINT backBufferWidth, UINT backBufferHeight) noexcept
{
const float safew = (float(backBufferWidth) + 19.f) / 20.f;
const float safeh = (float(backBufferHeight) + 19.f) / 20.f;
RECT rct;
rct.left = static_cast<LONG>(safew);
rct.top = static_cast<LONG>(safeh);
rct.right = static_cast<LONG>(float(backBufferWidth) - safew + 0.5f);
rct.bottom = static_cast<LONG>(float(backBufferHeight) - safeh + 0.5f);
return rct;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
//--------------------------------------------------------------------------------------
// File: pch.cpp
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#include "pch.h"

193
CoreLib/include/Src/pch.h Normal file
View File

@ -0,0 +1,193 @@
//--------------------------------------------------------------------------------------
// File: pch.h
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
// http://go.microsoft.com/fwlink/?LinkId=248929
//--------------------------------------------------------------------------------------
#pragma once
#ifdef _MSC_VER
// Off by default warnings
#pragma warning(disable : 4619 4616 4061 4265 4365 4571 4623 4625 4626 4628 4668 4710 4711 4746 4774 4820 4987 5026 5027 5031 5032 5039 5045 5219 5264 26812)
// C4619/4616 #pragma warning warnings
// C4061 enumerator 'X' in switch of enum 'X' is not explicitly handled by a case label
// C4265 class has virtual functions, but destructor is not virtual
// C4365 signed/unsigned mismatch
// C4571 behavior change
// C4623 default constructor was implicitly defined as deleted
// C4625 copy constructor was implicitly defined as deleted
// C4626 assignment operator was implicitly defined as deleted
// C4628 digraphs not supported
// C4668 not defined as a preprocessor macro
// C4710 function not inlined
// C4711 selected for automatic inline expansion
// C4746 volatile access of '<expression>' is subject to /volatile:<iso|ms> setting
// C4774 format string expected in argument 3 is not a string literal
// C4820 padding added after data member
// C4987 nonstandard extension used
// C5026 move constructor was implicitly defined as deleted
// C5027 move assignment operator was implicitly defined as deleted
// C5031/5032 push/pop mismatches in windows headers
// C5039 pointer or reference to potentially throwing function passed to extern C function under - EHc
// C5045 Spectre mitigation warning
// C5219 implicit conversion from 'int' to 'float', possible loss of data
// C5264 'const' variable is not used
// 26812: The enum type 'x' is unscoped. Prefer 'enum class' over 'enum' (Enum.3).
#if defined(_XBOX_ONE) && defined(_TITLE)
// Xbox One XDK related Off by default warnings
#pragma warning(disable : 4471 4643 4917 4986 5029 5038 5040 5043 5204 5246 5256 5262 5267)
// C4471 forward declaration of an unscoped enumeration must have an underlying type
// C4643 Forward declaring in namespace std is not permitted by the C++ Standard
// C4917 a GUID can only be associated with a class, interface or namespace
// C4986 exception specification does not match previous declaration
// C5029 nonstandard extension used
// C5038 data member 'X' will be initialized after data member 'Y'
// C5040 dynamic exception specifications are valid only in C++14 and earlier; treating as noexcept(false)
// C5043 exception specification does not match previous declaration
// C5204 class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly
// C5246 'anonymous struct or union': the initialization of a subobject should be wrapped in braces
// C5256 a non-defining declaration of an enumeration with a fixed underlying type is only permitted as a standalone declaration
// C5262 implicit fall-through occurs here; are you missing a break statement?
// C5267 definition of implicit copy constructor for 'X' is deprecated because it has a user-provided assignment operator
#endif // _XBOX_ONE && _TITLE
#endif // _MSC_VER
#ifdef __INTEL_COMPILER
#pragma warning(disable : 161 2960 3280)
// warning #161: unrecognized #pragma
// message #2960: allocation may not satisfy the type's alignment; consider using <aligned_new> header
// message #3280: declaration hides member
#endif
#ifdef __clang__
#pragma clang diagnostic ignored "-Wc++98-compat"
#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
#pragma clang diagnostic ignored "-Wc++98-compat-local-type-template-args"
#pragma clang diagnostic ignored "-Wcovered-switch-default"
#pragma clang diagnostic ignored "-Wexit-time-destructors"
#pragma clang diagnostic ignored "-Wfloat-equal"
#pragma clang diagnostic ignored "-Wglobal-constructors"
#pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
#pragma clang diagnostic ignored "-Wlanguage-extension-token"
#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
#pragma clang diagnostic ignored "-Wmicrosoft-include"
#pragma clang diagnostic ignored "-Wnested-anon-types"
#pragma clang diagnostic ignored "-Wreserved-id-macro"
#pragma clang diagnostic ignored "-Wswitch-enum"
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-const-variable"
#pragma clang diagnostic ignored "-Wunused-member-function"
#pragma clang diagnostic ignored "-Wunknown-warning-option"
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#pragma warning(push)
#pragma warning(disable : 4005)
#define NOMINMAX 1
#define NODRAWTEXT
#define NOGDI
#define NOBITMAP
#define NOMCX
#define NOSERVICE
#define NOHELP
#pragma warning(pop)
#include <Windows.h>
#ifndef _WIN32_WINNT_WIN10
#define _WIN32_WINNT_WIN10 0x0A00
#endif
#ifndef WINAPI_FAMILY_GAMES
#define WINAPI_FAMILY_GAMES 6
#endif
#ifdef _GAMING_XBOX
#error This version of DirectX Tool Kit not supported for GDKX
#elif defined(_XBOX_ONE) && defined(_TITLE)
#include <xdk.h>
#if _XDK_VER < 0x42EE13B6 /* XDK Edition 180704 */
#error DirectX Tool Kit for Direct3D 11 requires the July 2018 QFE4 XDK or later
#endif
#include <d3d11_x.h>
#else
#include <d3d11_1.h>
#endif
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <cwchar>
#include <exception>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <set>
#include <stdexcept>
#include <string>
#include <system_error>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
#pragma warning(push)
#pragma warning(disable : 4702)
#include <functional>
#pragma warning(pop)
#include <malloc.h>
#define _XM_NO_XMVECTOR_OVERLOADS_
#include <DirectXMath.h>
#include <DirectXPackedVector.h>
#include <DirectXCollision.h>
#if (DIRECTX_MATH_VERSION < 315)
#define XM_ALIGNED_STRUCT(x) __declspec(align(x)) struct
#endif
#pragma warning(push)
#pragma warning(disable : 4467 4986 5038 5204 5220 6101)
#ifdef __MINGW32__
#include <wrl/client.h>
#else
#include <wrl.h>
#endif
#pragma warning(pop)
#include <wincodec.h>
#if defined(NTDDI_WIN10_FE) || defined(__MINGW32__)
#include <ocidl.h>
#else
#include <OCIdl.h>
#endif
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) || (defined(_XBOX_ONE) && defined(_TITLE))
#pragma warning(push)
#pragma warning(disable: 4471 5204 5256)
#include <Windows.UI.Core.h>
#pragma warning(pop)
#endif
#include <mutex>

View File

@ -0,0 +1,234 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* \file SDL.h
*
* Main include header for the SDL library
*/
#ifndef SDL_h_
#define SDL_h_
#include "SDL_main.h"
#include "SDL_stdinc.h"
#include "SDL_assert.h"
#include "SDL_atomic.h"
#include "SDL_audio.h"
#include "SDL_clipboard.h"
#include "SDL_cpuinfo.h"
#include "SDL_endian.h"
#include "SDL_error.h"
#include "SDL_events.h"
#include "SDL_filesystem.h"
#include "SDL_gamecontroller.h"
#include "SDL_guid.h"
#include "SDL_haptic.h"
#include "SDL_hidapi.h"
#include "SDL_hints.h"
#include "SDL_joystick.h"
#include "SDL_loadso.h"
#include "SDL_log.h"
#include "SDL_messagebox.h"
#include "SDL_metal.h"
#include "SDL_mutex.h"
#include "SDL_power.h"
#include "SDL_render.h"
#include "SDL_rwops.h"
#include "SDL_sensor.h"
#include "SDL_shape.h"
#include "SDL_system.h"
#include "SDL_thread.h"
#include "SDL_timer.h"
#include "SDL_version.h"
#include "SDL_video.h"
#include "SDL_locale.h"
#include "SDL_misc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* WIKI CATEGORY: Init */
/* As of version 0.5, SDL is loaded dynamically into the application */
/**
* \name SDL_INIT_*
*
* These are the flags which may be passed to SDL_Init(). You should
* specify the subsystems which you will be using in your application.
*/
/* @{ */
#define SDL_INIT_TIMER 0x00000001u
#define SDL_INIT_AUDIO 0x00000010u
#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
#define SDL_INIT_HAPTIC 0x00001000u
#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
#define SDL_INIT_EVENTS 0x00004000u
#define SDL_INIT_SENSOR 0x00008000u
#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */
#define SDL_INIT_EVERYTHING ( \
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \
)
/* @} */
/**
* Initialize the SDL library.
*
* SDL_Init() simply forwards to calling SDL_InitSubSystem(). Therefore, the
* two may be used interchangeably. Though for readability of your code
* SDL_InitSubSystem() might be preferred.
*
* The file I/O (for example: SDL_RWFromFile) and threading (SDL_CreateThread)
* subsystems are initialized by default. Message boxes
* (SDL_ShowSimpleMessageBox) also attempt to work without initializing the
* video subsystem, in hopes of being useful in showing an error dialog when
* SDL_Init fails. You must specifically initialize other subsystems if you
* use them in your application.
*
* Logging (such as SDL_Log) works without initialization, too.
*
* `flags` may be any of the following OR'd together:
*
* - `SDL_INIT_TIMER`: timer subsystem
* - `SDL_INIT_AUDIO`: audio subsystem
* - `SDL_INIT_VIDEO`: video subsystem; automatically initializes the events
* subsystem
* - `SDL_INIT_JOYSTICK`: joystick subsystem; automatically initializes the
* events subsystem
* - `SDL_INIT_HAPTIC`: haptic (force feedback) subsystem
* - `SDL_INIT_GAMECONTROLLER`: controller subsystem; automatically
* initializes the joystick subsystem
* - `SDL_INIT_EVENTS`: events subsystem
* - `SDL_INIT_EVERYTHING`: all of the above subsystems
* - `SDL_INIT_NOPARACHUTE`: compatibility; this flag is ignored
*
* Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem()
* for each SDL_InitSubSystem() to correctly shutdown a subsystem manually (or
* call SDL_Quit() to force shutdown). If a subsystem is already loaded then
* this call will increase the ref-count and return.
*
* \param flags subsystem initialization flags.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_InitSubSystem
* \sa SDL_Quit
* \sa SDL_SetMainReady
* \sa SDL_WasInit
*/
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
/**
* Compatibility function to initialize the SDL library.
*
* In SDL2, this function and SDL_Init() are interchangeable.
*
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_Init
* \sa SDL_Quit
* \sa SDL_QuitSubSystem
*/
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
/**
* Shut down specific SDL subsystems.
*
* If you start a subsystem using a call to that subsystem's init function
* (for example SDL_VideoInit()) instead of SDL_Init() or SDL_InitSubSystem(),
* SDL_QuitSubSystem() and SDL_WasInit() will not work. You will need to use
* that subsystem's quit function (SDL_VideoQuit()) directly instead. But
* generally, you should not be using those functions directly anyhow; use
* SDL_Init() instead.
*
* You still need to call SDL_Quit() even if you close all open subsystems
* with SDL_QuitSubSystem().
*
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_InitSubSystem
* \sa SDL_Quit
*/
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
/**
* Get a mask of the specified subsystems which are currently initialized.
*
* \param flags any of the flags used by SDL_Init(); see SDL_Init for details.
* \returns a mask of all initialized subsystems if `flags` is 0, otherwise it
* returns the initialization status of the specified subsystems.
*
* The return value does not include SDL_INIT_NOPARACHUTE.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_Init
* \sa SDL_InitSubSystem
*/
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
/**
* Clean up all initialized subsystems.
*
* You should call this function even if you have already shutdown each
* initialized subsystem with SDL_QuitSubSystem(). It is safe to call this
* function even in the case of errors in initialization.
*
* If you start a subsystem using a call to that subsystem's init function
* (for example SDL_VideoInit()) instead of SDL_Init() or SDL_InitSubSystem(),
* then you must use that subsystem's quit function (SDL_VideoQuit()) to shut
* it down before calling SDL_Quit(). But generally, you should not be using
* those functions directly anyhow; use SDL_Init() instead.
*
* You can use this function with atexit() to ensure that it is run when your
* application is shutdown, but it is not wise to do this from a library or
* other dynamically loaded code.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_Init
* \sa SDL_QuitSubSystem
*/
extern DECLSPEC void SDLCALL SDL_Quit(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -0,0 +1,324 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_assert_h_
#define SDL_assert_h_
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SDL_ASSERT_LEVEL
#ifdef SDL_DEFAULT_ASSERT_LEVEL
#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL
#elif defined(_DEBUG) || defined(DEBUG) || \
(defined(__GNUC__) && !defined(__OPTIMIZE__))
#define SDL_ASSERT_LEVEL 2
#else
#define SDL_ASSERT_LEVEL 1
#endif
#endif /* SDL_ASSERT_LEVEL */
/*
These are macros and not first class functions so that the debugger breaks
on the assertion line and not in some random guts of SDL, and so each
assert can have unique static variables associated with it.
*/
#if defined(_MSC_VER)
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
#elif _SDL_HAS_BUILTIN(__builtin_debugtrap)
#define SDL_TriggerBreakpoint() __builtin_debugtrap()
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif (defined(__GNUC__) || defined(__clang__)) && defined(__riscv)
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "ebreak\n\t" )
#elif ( defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) ) /* this might work on other ARM targets, but this is a known quantity... */
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
#elif defined(__APPLE__) && defined(__arm__)
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
#elif defined(_WIN32) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__arm64__) || defined(__aarch64__)) )
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #0xF000\n\t" )
#elif defined(__386__) && defined(__WATCOMC__)
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
#include <signal.h>
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
#else
/* How do we trigger breakpoints on this platform? */
#define SDL_TriggerBreakpoint()
#endif
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
# define SDL_FUNCTION __func__
#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
# define SDL_FUNCTION __FUNCTION__
#else
# define SDL_FUNCTION "???"
#endif
#define SDL_FILE __FILE__
#define SDL_LINE __LINE__
/*
sizeof (x) makes the compiler still parse the expression even without
assertions enabled, so the code is always checked at compile time, but
doesn't actually generate code for it, so there are no side effects or
expensive checks at run time, just the constant size of what x WOULD be,
which presumably gets optimized out as unused.
This also solves the problem of...
int somevalue = blah();
SDL_assert(somevalue == 1);
...which would cause compiles to complain that somevalue is unused if we
disable assertions.
*/
/* "while (0,0)" fools Microsoft's compiler's /W4 warning level into thinking
this condition isn't constant. And looks like an owl's face! */
#ifdef _MSC_VER /* stupid /W4 warnings. */
#define SDL_NULL_WHILE_LOOP_CONDITION (0,0)
#else
#define SDL_NULL_WHILE_LOOP_CONDITION (0)
#endif
#define SDL_disabled_assert(condition) \
do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION)
typedef enum
{
SDL_ASSERTION_RETRY, /**< Retry the assert immediately. */
SDL_ASSERTION_BREAK, /**< Make the debugger trigger a breakpoint. */
SDL_ASSERTION_ABORT, /**< Terminate the program. */
SDL_ASSERTION_IGNORE, /**< Ignore the assert. */
SDL_ASSERTION_ALWAYS_IGNORE /**< Ignore the assert from now on. */
} SDL_AssertState;
typedef struct SDL_AssertData
{
int always_ignore;
unsigned int trigger_count;
const char *condition;
const char *filename;
int linenum;
const char *function;
const struct SDL_AssertData *next;
} SDL_AssertData;
/* Never call this directly. Use the SDL_assert* macros. */
extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
const char *,
const char *, int)
#if defined(__clang__)
#if __has_feature(attribute_analyzer_noreturn)
/* this tells Clang's static analysis that we're a custom assert function,
and that the analyzer should assume the condition was always true past this
SDL_assert test. */
__attribute__((analyzer_noreturn))
#endif
#endif
;
/* the do {} while(0) avoids dangling else problems:
if (x) SDL_assert(y); else blah();
... without the do/while, the "else" could attach to this macro's "if".
We try to handle just the minimum we need here in a macro...the loop,
the static vars, and break points. The heavy lifting is handled in
SDL_ReportAssertion(), in SDL_assert.c.
*/
#define SDL_enabled_assert(condition) \
do { \
while ( !(condition) ) { \
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
continue; /* go again. */ \
} else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
SDL_TriggerBreakpoint(); \
} \
break; /* not retrying. */ \
} \
} while (SDL_NULL_WHILE_LOOP_CONDITION)
/* Enable various levels of assertions. */
#if SDL_ASSERT_LEVEL == 0 /* assertions disabled */
# define SDL_assert(condition) SDL_disabled_assert(condition)
# define SDL_assert_release(condition) SDL_disabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 1 /* release settings. */
# define SDL_assert(condition) SDL_disabled_assert(condition)
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 2 /* normal settings. */
# define SDL_assert(condition) SDL_enabled_assert(condition)
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_disabled_assert(condition)
#elif SDL_ASSERT_LEVEL == 3 /* paranoid settings. */
# define SDL_assert(condition) SDL_enabled_assert(condition)
# define SDL_assert_release(condition) SDL_enabled_assert(condition)
# define SDL_assert_paranoid(condition) SDL_enabled_assert(condition)
#else
# error Unknown assertion level.
#endif
/* this assertion is never disabled at any level. */
#define SDL_assert_always(condition) SDL_enabled_assert(condition)
/**
* A callback that fires when an SDL assertion fails.
*
* \param data a pointer to the SDL_AssertData structure corresponding to the
* current assertion.
* \param userdata what was passed as `userdata` to SDL_SetAssertionHandler().
* \returns an SDL_AssertState value indicating how to handle the failure.
*/
typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
const SDL_AssertData* data, void* userdata);
/**
* Set an application-defined assertion handler.
*
* This function allows an application to show its own assertion UI and/or
* force the response to an assertion failure. If the application doesn't
* provide this, SDL will try to do the right thing, popping up a
* system-specific GUI dialog, and probably minimizing any fullscreen windows.
*
* This callback may fire from any thread, but it runs wrapped in a mutex, so
* it will only fire from one thread at a time.
*
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
*
* \param handler the SDL_AssertionHandler function to call when an assertion
* fails or NULL for the default handler.
* \param userdata a pointer that is passed to `handler`.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetAssertionHandler
*/
extern DECLSPEC void SDLCALL SDL_SetAssertionHandler(
SDL_AssertionHandler handler,
void *userdata);
/**
* Get the default assertion handler.
*
* This returns the function pointer that is called by default when an
* assertion is triggered. This is an internal function provided by SDL, that
* is used for assertions when SDL_SetAssertionHandler() hasn't been used to
* provide a different function.
*
* \returns the default SDL_AssertionHandler that is called when an assert
* triggers.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_GetAssertionHandler
*/
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void);
/**
* Get the current assertion handler.
*
* This returns the function pointer that is called when an assertion is
* triggered. This is either the value last passed to
* SDL_SetAssertionHandler(), or if no application-specified function is set,
* is equivalent to calling SDL_GetDefaultAssertionHandler().
*
* The parameter `puserdata` is a pointer to a void*, which will store the
* "userdata" pointer that was passed to SDL_SetAssertionHandler(). This value
* will always be NULL for the default handler. If you don't care about this
* data, it is safe to pass a NULL pointer to this function to ignore it.
*
* \param puserdata pointer which is filled with the "userdata" pointer that
* was passed to SDL_SetAssertionHandler().
* \returns the SDL_AssertionHandler that is called when an assert triggers.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_SetAssertionHandler
*/
extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puserdata);
/**
* Get a list of all assertion failures.
*
* This function gets all assertions triggered since the last call to
* SDL_ResetAssertionReport(), or the start of the program.
*
* The proper way to examine this data looks something like this:
*
* ```c
* const SDL_AssertData *item = SDL_GetAssertionReport();
* while (item) {
* printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n",
* item->condition, item->function, item->filename,
* item->linenum, item->trigger_count,
* item->always_ignore ? "yes" : "no");
* item = item->next;
* }
* ```
*
* \returns a list of all failed assertions or NULL if the list is empty. This
* memory should not be modified or freed by the application.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_ResetAssertionReport
*/
extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
/**
* Clear the list of all assertion failures.
*
* This function will clear the list of all assertions triggered up to that
* point. Immediately following this call, SDL_GetAssertionReport will return
* no items. In addition, any previously-triggered assertions will be reset to
* a trigger_count of zero, and their always_ignore state will be false.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetAssertionReport
*/
extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
/* these had wrong naming conventions until 2.0.4. Please update your app! */
#define SDL_assert_state SDL_AssertState
#define SDL_assert_data SDL_AssertData
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_assert_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -0,0 +1,408 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* # CategoryAtomic
*
* Atomic operations.
*
* IMPORTANT: If you are not an expert in concurrent lockless programming, you
* should not be using any functions in this file. You should be protecting
* your data structures with full mutexes instead.
*
* ***Seriously, here be dragons!***
*
* You can find out a little more about lockless programming and the subtle
* issues that can arise here:
* https://learn.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming
*
* There's also lots of good information here:
*
* - https://www.1024cores.net/home/lock-free-algorithms
* - https://preshing.com/
*
* These operations may or may not actually be implemented using processor
* specific atomic operations. When possible they are implemented as true
* processor specific atomic operations. When that is not possible the are
* implemented using locks that *do* use the available atomic operations.
*
* All of the atomic operations that modify memory are full memory barriers.
*/
#ifndef SDL_atomic_h_
#define SDL_atomic_h_
#include "SDL_stdinc.h"
#include "SDL_platform.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \name SDL AtomicLock
*
* The atomic locks are efficient spinlocks using CPU instructions,
* but are vulnerable to starvation and can spin forever if a thread
* holding a lock has been terminated. For this reason you should
* minimize the code executed inside an atomic lock and never do
* expensive things like API or system calls while holding them.
*
* The atomic locks are not safe to lock recursively.
*
* Porting Note:
* The spin lock functions and type are required and can not be
* emulated because they are used in the atomic emulation code.
*/
/* @{ */
typedef int SDL_SpinLock;
/**
* Try to lock a spin lock by setting it to a non-zero value.
*
* ***Please note that spinlocks are dangerous if you don't know what you're
* doing. Please be careful using any sort of spinlock!***
*
* \param lock a pointer to a lock variable.
* \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already
* held.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_AtomicLock
* \sa SDL_AtomicUnlock
*/
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
/**
* Lock a spin lock by setting it to a non-zero value.
*
* ***Please note that spinlocks are dangerous if you don't know what you're
* doing. Please be careful using any sort of spinlock!***
*
* \param lock a pointer to a lock variable.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_AtomicTryLock
* \sa SDL_AtomicUnlock
*/
extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
/**
* Unlock a spin lock by setting it to 0.
*
* Always returns immediately.
*
* ***Please note that spinlocks are dangerous if you don't know what you're
* doing. Please be careful using any sort of spinlock!***
*
* \param lock a pointer to a lock variable.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_AtomicLock
* \sa SDL_AtomicTryLock
*/
extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
/* @} *//* SDL AtomicLock */
/**
* The compiler barrier prevents the compiler from reordering
* reads and writes to globally visible variables across the call.
*/
#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
void _ReadWriteBarrier(void);
#pragma intrinsic(_ReadWriteBarrier)
#define SDL_CompilerBarrier() _ReadWriteBarrier()
#elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
/* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */
#define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory")
#elif defined(__WATCOMC__)
extern __inline void SDL_CompilerBarrier(void);
#pragma aux SDL_CompilerBarrier = "" parm [] modify exact [];
#else
#define SDL_CompilerBarrier() \
{ SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); }
#endif
/**
* Memory barriers are designed to prevent reads and writes from being
* reordered by the compiler and being seen out of order on multi-core CPUs.
*
* A typical pattern would be for thread A to write some data and a flag, and
* for thread B to read the flag and get the data. In this case you would
* insert a release barrier between writing the data and the flag,
* guaranteeing that the data write completes no later than the flag is
* written, and you would insert an acquire barrier between reading the flag
* and reading the data, to ensure that all the reads associated with the flag
* have completed.
*
* In this pattern you should always see a release barrier paired with an
* acquire barrier and you should gate the data reads/writes with a single
* flag variable.
*
* For more information on these semantics, take a look at the blog post:
* http://preshing.com/20120913/acquire-and-release-semantics
*
* \since This function is available since SDL 2.0.6.
*/
extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void);
extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void);
#if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory")
#elif defined(__GNUC__) && defined(__aarch64__)
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
#elif defined(__GNUC__) && defined(__arm__)
#if 0 /* defined(__LINUX__) || defined(__ANDROID__) */
/* Information from:
https://chromium.googlesource.com/chromium/chromium/+/trunk/base/atomicops_internals_arm_gcc.h#19
The Linux kernel provides a helper function which provides the right code for a memory barrier,
hard-coded at address 0xffff0fa0
*/
typedef void (*SDL_KernelMemoryBarrierFunc)();
#define SDL_MemoryBarrierRelease() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
#define SDL_MemoryBarrierAcquire() ((SDL_KernelMemoryBarrierFunc)0xffff0fa0)()
#elif 0 /* defined(__QNXNTO__) */
#include <sys/cpuinline.h>
#define SDL_MemoryBarrierRelease() __cpu_membarrier()
#define SDL_MemoryBarrierAcquire() __cpu_membarrier()
#else
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__)
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
#ifdef __thumb__
/* The mcr instruction isn't available in thumb mode, use real functions */
#define SDL_MEMORY_BARRIER_USES_FUNCTION
#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction()
#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction()
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory")
#endif /* __thumb__ */
#else
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("" : : : "memory")
#endif /* __LINUX__ || __ANDROID__ */
#endif /* __GNUC__ && __arm__ */
#else
#if (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120))
/* This is correct for all CPUs on Solaris when using Solaris Studio 12.1+. */
#include <mbarrier.h>
#define SDL_MemoryBarrierRelease() __machine_rel_barrier()
#define SDL_MemoryBarrierAcquire() __machine_acq_barrier()
#else
/* This is correct for the x86 and x64 CPUs, and we'll expand this over time. */
#define SDL_MemoryBarrierRelease() SDL_CompilerBarrier()
#define SDL_MemoryBarrierAcquire() SDL_CompilerBarrier()
#endif
#endif
/* "REP NOP" is PAUSE, coded for tools that don't know it by that name. */
#if (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))
#define SDL_CPUPauseInstruction() __asm__ __volatile__("pause\n") /* Some assemblers can't do REP NOP, so go with PAUSE. */
#elif (defined(__arm__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7) || defined(__aarch64__)
#define SDL_CPUPauseInstruction() __asm__ __volatile__("yield" ::: "memory")
#elif (defined(__powerpc__) || defined(__powerpc64__))
#define SDL_CPUPauseInstruction() __asm__ __volatile__("or 27,27,27");
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
#define SDL_CPUPauseInstruction() _mm_pause() /* this is actually "rep nop" and not a SIMD instruction. No inline asm in MSVC x86-64! */
#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64))
#define SDL_CPUPauseInstruction() __yield()
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline void SDL_CPUPauseInstruction(void);
#pragma aux SDL_CPUPauseInstruction = ".686p" ".xmm2" "pause"
#else
#define SDL_CPUPauseInstruction()
#endif
/**
* A type representing an atomic integer value.
*
* It is a struct so people don't accidentally use numeric operations on it.
*/
typedef struct SDL_atomic_t {
int value;
} SDL_atomic_t;
/**
* Set an atomic variable to a new value if it is currently an old value.
*
* ***Note: If you don't know what this function is for, you shouldn't use
* it!***
*
* \param a a pointer to an SDL_atomic_t variable to be modified.
* \param oldval the old value.
* \param newval the new value.
* \returns SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_AtomicCASPtr
* \sa SDL_AtomicGet
* \sa SDL_AtomicSet
*/
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval);
/**
* Set an atomic variable to a value.
*
* This function also acts as a full memory barrier.
*
* ***Note: If you don't know what this function is for, you shouldn't use
* it!***
*
* \param a a pointer to an SDL_atomic_t variable to be modified.
* \param v the desired value.
* \returns the previous value of the atomic variable.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_AtomicGet
*/
extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
/**
* Get the value of an atomic variable.
*
* ***Note: If you don't know what this function is for, you shouldn't use
* it!***
*
* \param a a pointer to an SDL_atomic_t variable.
* \returns the current value of an atomic variable.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_AtomicSet
*/
extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
/**
* Add to an atomic variable.
*
* This function also acts as a full memory barrier.
*
* ***Note: If you don't know what this function is for, you shouldn't use
* it!***
*
* \param a a pointer to an SDL_atomic_t variable to be modified.
* \param v the desired value to add.
* \returns the previous value of the atomic variable.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_AtomicDecRef
* \sa SDL_AtomicIncRef
*/
extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
/**
* \brief Increment an atomic variable used as a reference count.
*/
#ifndef SDL_AtomicIncRef
#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1)
#endif
/**
* \brief Decrement an atomic variable used as a reference count.
*
* \return SDL_TRUE if the variable reached zero after decrementing,
* SDL_FALSE otherwise
*/
#ifndef SDL_AtomicDecRef
#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1)
#endif
/**
* Set a pointer to a new value if it is currently an old value.
*
* ***Note: If you don't know what this function is for, you shouldn't use
* it!***
*
* \param a a pointer to a pointer.
* \param oldval the old pointer value.
* \param newval the new pointer value.
* \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_AtomicCAS
* \sa SDL_AtomicGetPtr
* \sa SDL_AtomicSetPtr
*/
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *newval);
/**
* Set a pointer to a value atomically.
*
* ***Note: If you don't know what this function is for, you shouldn't use
* it!***
*
* \param a a pointer to a pointer.
* \param v the desired pointer value.
* \returns the previous value of the pointer.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_AtomicCASPtr
* \sa SDL_AtomicGetPtr
*/
extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
/**
* Get the value of a pointer atomically.
*
* ***Note: If you don't know what this function is for, you shouldn't use
* it!***
*
* \param a a pointer to a pointer.
* \returns the current value of a pointer.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_AtomicCASPtr
* \sa SDL_AtomicSetPtr
*/
extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_atomic_h_ */
/* vi: set ts=4 sw=4 expandtab: */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,132 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* # CategoryBits
*
* Functions for fiddling with bits and bitmasks.
*/
#ifndef SDL_bits_h_
#define SDL_bits_h_
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \file SDL_bits.h
*/
/**
* Get the index of the most significant bit. Result is undefined when called
* with 0. This operation can also be stated as "count leading zeroes" and
* "log base 2".
*
* \return the index of the most significant bit, or -1 if the value is 0.
*/
#if defined(__WATCOMC__) && defined(__386__)
extern __inline int _SDL_bsr_watcom(Uint32);
#pragma aux _SDL_bsr_watcom = \
"bsr eax, eax" \
parm [eax] nomemory \
value [eax] \
modify exact [eax] nomemory;
#endif
/**
* Use this function to get the index of the most significant (set) bit in a
*
* \param x the number to find the MSB of.
* \returns the index of the most significant bit of x, or -1 if x is 0.
*/
SDL_FORCE_INLINE int
SDL_MostSignificantBitIndex32(Uint32 x)
{
#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
/* Count Leading Zeroes builtin in GCC.
* http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html
*/
if (x == 0) {
return -1;
}
return 31 - __builtin_clz(x);
#elif defined(__WATCOMC__) && defined(__386__)
if (x == 0) {
return -1;
}
return _SDL_bsr_watcom(x);
#elif defined(_MSC_VER)
unsigned long index;
if (_BitScanReverse(&index, x)) {
return index;
}
return -1;
#else
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
* <seander@cs.stanford.edu>, released in the public domain.
* http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog
*/
const Uint32 b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
const int S[] = {1, 2, 4, 8, 16};
int msbIndex = 0;
int i;
if (x == 0) {
return -1;
}
for (i = 4; i >= 0; i--)
{
if (x & b[i])
{
x >>= S[i];
msbIndex |= S[i];
}
}
return msbIndex;
#endif
}
SDL_FORCE_INLINE SDL_bool
SDL_HasExactlyOneBitSet32(Uint32 x)
{
if (x && !(x & (x - 1))) {
return SDL_TRUE;
}
return SDL_FALSE;
}
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_bits_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -0,0 +1,199 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* # CategoryBlendmode
*
* Header file declaring the SDL_BlendMode enumeration
*/
#ifndef SDL_blendmode_h_
#define SDL_blendmode_h_
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* The blend mode used in SDL_RenderCopy() and drawing operations.
*/
typedef enum SDL_BlendMode
{
SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
dstRGBA = srcRGBA */
SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
dstA = srcA + (dstA * (1-srcA)) */
SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
dstRGB = (srcRGB * srcA) + dstRGB
dstA = dstA */
SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
dstRGB = srcRGB * dstRGB
dstA = dstA */
SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply
dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
dstA = dstA */
SDL_BLENDMODE_INVALID = 0x7FFFFFFF
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
} SDL_BlendMode;
/**
* The blend operation used when combining source and destination pixel
* components
*/
typedef enum SDL_BlendOperation
{
SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */
} SDL_BlendOperation;
/**
* The normalized factor used to multiply pixel components
*/
typedef enum SDL_BlendFactor
{
SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
} SDL_BlendFactor;
/**
* Compose a custom blend mode for renderers.
*
* The functions SDL_SetRenderDrawBlendMode and SDL_SetTextureBlendMode accept
* the SDL_BlendMode returned by this function if the renderer supports it.
*
* A blend mode controls how the pixels from a drawing operation (source) get
* combined with the pixels from the render target (destination). First, the
* components of the source and destination pixels get multiplied with their
* blend factors. Then, the blend operation takes the two products and
* calculates the result that will get stored in the render target.
*
* Expressed in pseudocode, it would look like this:
*
* ```c
* dstRGB = colorOperation(srcRGB * srcColorFactor, dstRGB * dstColorFactor);
* dstA = alphaOperation(srcA * srcAlphaFactor, dstA * dstAlphaFactor);
* ```
*
* Where the functions `colorOperation(src, dst)` and `alphaOperation(src,
* dst)` can return one of the following:
*
* - `src + dst`
* - `src - dst`
* - `dst - src`
* - `min(src, dst)`
* - `max(src, dst)`
*
* The red, green, and blue components are always multiplied with the first,
* second, and third components of the SDL_BlendFactor, respectively. The
* fourth component is not used.
*
* The alpha component is always multiplied with the fourth component of the
* SDL_BlendFactor. The other components are not used in the alpha
* calculation.
*
* Support for these blend modes varies for each renderer. To check if a
* specific SDL_BlendMode is supported, create a renderer and pass it to
* either SDL_SetRenderDrawBlendMode or SDL_SetTextureBlendMode. They will
* return with an error if the blend mode is not supported.
*
* This list describes the support of custom blend modes for each renderer in
* SDL 2.0.6. All renderers support the four blend modes listed in the
* SDL_BlendMode enumeration.
*
* - **direct3d**: Supports all operations with all factors. However, some
* factors produce unexpected results with `SDL_BLENDOPERATION_MINIMUM` and
* `SDL_BLENDOPERATION_MAXIMUM`.
* - **direct3d11**: Same as Direct3D 9.
* - **opengl**: Supports the `SDL_BLENDOPERATION_ADD` operation with all
* factors. OpenGL versions 1.1, 1.2, and 1.3 do not work correctly with SDL
* 2.0.6.
* - **opengles**: Supports the `SDL_BLENDOPERATION_ADD` operation with all
* factors. Color and alpha factors need to be the same. OpenGL ES 1
* implementation specific: May also support `SDL_BLENDOPERATION_SUBTRACT`
* and `SDL_BLENDOPERATION_REV_SUBTRACT`. May support color and alpha
* operations being different from each other. May support color and alpha
* factors being different from each other.
* - **opengles2**: Supports the `SDL_BLENDOPERATION_ADD`,
* `SDL_BLENDOPERATION_SUBTRACT`, `SDL_BLENDOPERATION_REV_SUBTRACT`
* operations with all factors.
* - **psp**: No custom blend mode support.
* - **software**: No custom blend mode support.
*
* Some renderers do not provide an alpha component for the default render
* target. The `SDL_BLENDFACTOR_DST_ALPHA` and
* `SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA` factors do not have an effect in this
* case.
*
* \param srcColorFactor the SDL_BlendFactor applied to the red, green, and
* blue components of the source pixels.
* \param dstColorFactor the SDL_BlendFactor applied to the red, green, and
* blue components of the destination pixels.
* \param colorOperation the SDL_BlendOperation used to combine the red,
* green, and blue components of the source and
* destination pixels.
* \param srcAlphaFactor the SDL_BlendFactor applied to the alpha component of
* the source pixels.
* \param dstAlphaFactor the SDL_BlendFactor applied to the alpha component of
* the destination pixels.
* \param alphaOperation the SDL_BlendOperation used to combine the alpha
* component of the source and destination pixels.
* \returns an SDL_BlendMode that represents the chosen factors and
* operations.
*
* \since This function is available since SDL 2.0.6.
*
* \sa SDL_SetRenderDrawBlendMode
* \sa SDL_GetRenderDrawBlendMode
* \sa SDL_SetTextureBlendMode
* \sa SDL_GetTextureBlendMode
*/
extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
SDL_BlendFactor dstColorFactor,
SDL_BlendOperation colorOperation,
SDL_BlendFactor srcAlphaFactor,
SDL_BlendFactor dstAlphaFactor,
SDL_BlendOperation alphaOperation);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_blendmode_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -0,0 +1,141 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/**
* # CategoryClipboard
*
* Include file for SDL clipboard handling
*/
#ifndef SDL_clipboard_h_
#define SDL_clipboard_h_
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Function prototypes */
/**
* Put UTF-8 text into the clipboard.
*
* \param text the text to store in the clipboard.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetClipboardText
* \sa SDL_HasClipboardText
*/
extern DECLSPEC int SDLCALL SDL_SetClipboardText(const char *text);
/**
* Get UTF-8 text from the clipboard, which must be freed with SDL_free().
*
* This functions returns empty string if there was not enough memory left for
* a copy of the clipboard's content.
*
* \returns the clipboard text on success or an empty string on failure; call
* SDL_GetError() for more information. Caller must call SDL_free()
* on the returned pointer when done with it (even if there was an
* error).
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_HasClipboardText
* \sa SDL_SetClipboardText
*/
extern DECLSPEC char * SDLCALL SDL_GetClipboardText(void);
/**
* Query whether the clipboard exists and contains a non-empty text string.
*
* \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetClipboardText
* \sa SDL_SetClipboardText
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
/**
* Put UTF-8 text into the primary selection.
*
* \param text the text to store in the primary selection.
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 2.26.0.
*
* \sa SDL_GetPrimarySelectionText
* \sa SDL_HasPrimarySelectionText
*/
extern DECLSPEC int SDLCALL SDL_SetPrimarySelectionText(const char *text);
/**
* Get UTF-8 text from the primary selection, which must be freed with
* SDL_free().
*
* This functions returns empty string if there was not enough memory left for
* a copy of the primary selection's content.
*
* \returns the primary selection text on success or an empty string on
* failure; call SDL_GetError() for more information. Caller must
* call SDL_free() on the returned pointer when done with it (even if
* there was an error).
*
* \since This function is available since SDL 2.26.0.
*
* \sa SDL_HasPrimarySelectionText
* \sa SDL_SetPrimarySelectionText
*/
extern DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void);
/**
* Query whether the primary selection exists and contains a non-empty text
* string.
*
* \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it
* does not.
*
* \since This function is available since SDL 2.26.0.
*
* \sa SDL_GetPrimarySelectionText
* \sa SDL_SetPrimarySelectionText
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasPrimarySelectionText(void);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_clipboard_h_ */
/* vi: set ts=4 sw=4 expandtab: */

Some files were not shown because too many files have changed in this diff Show More