Compare commits

...

106 Commits

Author SHA1 Message Date
ae3fc21ffc Patch - Fix release and debug config - V11.2.1 2025-06-03 19:58:01 +02:00
315d259acd Minor - Stats Update - V11.2.0 2025-06-03 18:35:51 +02:00
2a1b474df0 Minor - architecture rework pt.2 - V11.1.0 2025-06-03 17:01:18 +02:00
d364517633 Major - Architecture Rework - 11.0.0 2025-06-03 16:29:44 +02:00
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
b80f66fec3 Merge branch 'main' of http://gitea-ui.shiba-server.fr:19000/ShibaGit/khaotic-engine-Reborn 2025-05-06 18:09:31 +02:00
8bcd3eed48 Patch Update - Fix Memory Leak From terrain genneration and use Instancing to generate big terrain - V10.1.3 2025-05-06 18:09:28 +02:00
2b1e64ffbd Actualiser README.md 2025-05-06 16:08:35 +00:00
96aa41f649 Actualiser README.md 2025-05-06 15:11:14 +00:00
00e6749d01 Patch Update - IDE File - V10.1.2 2025-05-06 17:08:18 +02:00
5a3a4f73a8 Patch Update - Fix the loading and saving of the texture - V10.1.1 2025-05-06 17:07:45 +02:00
c442a87883 Minor Update - Texture Are Saved - V10.1.0 2025-05-06 15:29:23 +02:00
e681943aa8 Patch Update - workspace.xml - V10.0.2 2025-05-05 16:13:44 +02:00
e68f1d5dd0 Patch Update - LoadTexture Tweak - V10.0.1 2025-05-05 16:12:38 +02:00
8e6b7409d9 Major Update - Complete Rework Texture System - V10.0.0 2025-05-03 16:37:27 +02:00
7dbd735416 Patch Update - Clean Comment - V9.3.10 2025-05-02 15:28:18 +02:00
6014c9034c Patch Update - Fix OBJ Copy - V9.3.9 2025-05-01 21:23:47 +02:00
bf6131af55 Patch Update - Skysphere Obj Smooth - V9.3.8 2025-05-01 21:17:08 +02:00
41519f7154 Patch Update - Skysphere texture reading inverted - V9.3.7 2025-05-01 20:54:20 +02:00
74151de6f7 Patch Update - Naming - V9.3.6 2025-05-01 20:09:08 +02:00
f8503e5a2a Patch Update - SkySphere - V9.3.5 2025-05-01 20:05:25 +02:00
c15cb2956d Patch Update - Skysphere 2025-05-01 19:27:14 +02:00
96b0d0e72d Patch Update - Skybox Shader wip - V9.3.2 2025-05-01 18:41:32 +02:00
f1c13a3c8c Patch Update - Start ShaderSkybox - V9.3.1 2025-05-01 17:16:11 +02:00
e34b44996a Minor Update - Skybox Update - V9.3.0 2025-05-01 16:41:33 +02:00
0e45e0688c Patch update - V9.2.13
Physics update
2025-04-01 13:47:45 +02:00
9c6db5c76d Patch update - V9.2.12 2025-03-30 23:45:57 +02:00
3ea5c92028 Patch update - V9.2.11 2025-03-30 23:44:55 +02:00
4d23c481d4 Configuration de Git LFS pour enginecustom/assets/Model/OBJ/*.obj et *.mtl 2025-03-30 23:38:41 +02:00
d8bda97819 Patch update - V9.2.9 2025-03-30 23:34:11 +02:00
ede5080c10 Patch Update - V9.2.8
Remove Vulkan related code
2025-03-23 13:45:17 +01:00
1ea77c909f vulkan test 2025-03-22 19:00:37 +01:00
73727ab45a Patch update - V9.2.6 2025-03-22 15:05:55 +01:00
e991d069fe additional lib for vulkan 2025-03-22 14:52:39 +01:00
648fc887d6 add lib 2025-03-21 19:33:00 +01:00
63482923bb Patch Update - V9.2.3
[FIX] :

~ Use The Already Implemented IsKeyDown avoid calling each tick the method bound to the input
2025-03-20 13:59:01 +01:00
987ad6784e Patch Update - V9.2.2
FIX RELEASE BUILD CONFIGURATION
2025-03-20 00:15:34 +01:00
f2a8bb6b5b Patch update - V9.2.1 2025-03-19 13:22:56 +01:00
606aaa76e9 Minor Update - V.9.2.0
[FEAT] :

- Add More Object Property to the save and load
2025-03-19 12:05:15 +01:00
3930c5eff7 Minor Update - V9.1.0
[FEAT] :

+ Import Assets in project copy file in project
2025-03-19 10:55:10 +01:00
eea7b4c067 Major Update - V9.0.0
[FEAT] :

+ Add Save and Load system for scene but only for kobject
2025-03-18 22:43:23 +01:00
6583f74a5f Patch Update - V8.1.1
+ Define the struct of the scene save file
2025-03-17 17:49:16 +01:00
7eb6ed72e6 Minor Update - V8.1.0
[FIX] :

- Alpha Shader

[FEAT] :

- Add Scene action in bar menu
- Start to implemented Save And Load Logique
2025-03-17 12:59:04 +01:00
8b9e860c00 Major Update - Scene Window Rework 2025-03-11 17:46:36 +01:00
5e68105fe1 ALED 2025-02-02 22:35:41 +01:00
af01f223c1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 2025-02-01 00:46:41 +01:00
118e967412 Patch update - add menu button 2025-01-29 21:13:35 +01:00
452e84aa16 Minor update - viewport window tweak 2025-01-29 19:31:12 +01:00
151ea9b191 Minor update - celshading rework started 2025-01-28 17:42:23 +01:00
0d5e26266b Major update - Architecture Rework 2025-01-27 22:46:27 +01:00
425224a96c patch update - fix sunlight shader
Prend en compte les paramètres direction et intensité
2025-01-23 22:45:59 +01:00
d8851cc679 minor update - light ui tweak 2025-01-23 20:55:55 +01:00
c355509870 patch readme 2025-01-23 17:31:36 +01:00
51b29f77aa Minor update - Sunlight shader 2025-01-23 17:29:29 +01:00
d8552d3f91 minor update - préparation sunlight 2025-01-22 19:56:28 +01:00
261df5e257 Minor update - Skybox baby
Faudra mettre une texture numéroté pour la skybox afin de verifié l'orientation des plan qui la constitue
2025-01-21 17:43:02 +01:00
172db0b96d Skybox WIP 2025-01-21 15:28:37 +01:00
296e04692a patch debug - exec 2025-01-20 23:13:35 +01:00
fec593205b log tweak 2025-01-19 21:49:40 +01:00
161166837f Minor update - Log system rework
+ GetLogLevelInfo return a struct of info relative to a type of log

+ filtered log in the UI
2025-01-19 14:41:37 +01:00
a88ed06198 minor log - update 2025-01-18 15:56:25 +01:00
cb3f10b7d5 Minor update - Log window in Ui 2025-01-17 17:57:58 +01:00
4ae55e73b2 Major Update - Physique Fixed Update And Thread
Physics process run in a fixed update in a thread
2025-01-17 15:47:09 +01:00
15217a5df8 Patch update - Scene window 2025-01-16 21:02:17 +01:00
06efdf6f6c Imgui Update for the patch 2025-01-16 17:52:49 +01:00
b029018552 Major update - IMGUI Change
New ImGui version : Branch Doking
2025-01-16 17:31:13 +01:00
39fa32603f Minor update - ui x physix 2025-01-15 20:42:42 +01:00
c707e49561 Physic rebuild start 2025-01-15 18:33:02 +01:00
58cafd7682 faut tout pt encore 2025-01-14 16:10:40 +01:00
c5de18a9b3 Patch - Logger opti 2025-01-12 18:40:23 +01:00
f337e58dcc Merge branch 'main' of https://github.com/CatChow0/khaotic-engine-Reborn 2025-01-12 01:12:34 +01:00
CatChow0
af98e5edc7
Update README.md 2025-01-12 01:10:08 +01:00
01a9c940f0 Minor update - frustum rework
Complete overhaul of frustum culling
2025-01-12 00:59:43 +01:00
ab0355ed97 Minor update - Add Render Queues 2025-01-11 22:18:19 +01:00
915c0cdd7f Minor Update - Object Rendering change
+ RenderPass (render object in a vector)
2025-01-11 13:53:35 +01:00
bce659e55d Minor - Vsync toggle
New Method :

+ Set Vsync
+ Set Screen Width
+ Set Screen Height
+ Get Hwnd
+ Set Hwnd
+ IsWindowed
+ SetWindowed

New UI For Engine Settings :

+ Add Vsync Toggle to UI
2025-01-10 20:43:36 +01:00
79f266b479 Quick Test and organization tweak 2025-01-09 23:00:03 +01:00
b4804c2df2 boo 2024-10-02 12:44:00 +02:00
7d2b962420 Patch Update - Terrain Tweak 2024-10-01 20:44:46 +02:00
d7965fec64 plane obj tweak 2024-10-01 19:04:41 +02:00
7f84ab39a1 ajout des fichier obj forcer 2024-10-01 18:48:01 +02:00
975edf0e62 Améliorations de la gestion des chemins et textures
- Ajout de la récupération du chemin d'exécution du module dans `WinMain` et transmission à `SystemClass`.
- Ajout de la méthode `SendPath` dans `SystemClass` pour transmettre le chemin et le dossier de travail à `ApplicationClass`.
- Remplacement de la variable `result` par `Hresult` pour les résultats des appels DirectX dans `ApplicationClass::Initialize`.
- Définition du chemin de travail courant avant de charger les textures dans `ApplicationClass::AddKobject`.
- Vérification que l'objet a bien reçu les textures après l'initialisation dans `ApplicationClass::AddKobject`.
- Ajout des méthodes `SetPath` et `SetWFolder` dans `ApplicationClass` pour définir le chemin et le dossier de travail.
- Réduction du nombre de catégories de textures affichées dans `imguiManager::WidgetObjectWindow`.
2024-10-01 16:02:30 +02:00
b3af9f4ce7 Minor Update - Fix Release Version 2024-09-30 16:13:52 +02:00
8f20397130 sus 2024-09-30 15:29:49 +02:00
3aafec5bf8 Set Up DirextXTK in git 2024-09-30 13:53:03 +02:00
79558eed4f prout 2024-09-29 18:30:50 +02:00
1386 changed files with 764081 additions and 809539 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
enginecustom/assets/Model/OBJ/*.obj filter=lfs diff=lfs merge=lfs -text
enginecustom/assets/Model/OBJ/*.mtl filter=lfs diff=lfs merge=lfs -text

4
.gitignore vendored
View File

@ -9,10 +9,6 @@
*.slo *.slo
*.lo *.lo
*.o *.o
*.obj
# Don't ignore 3d model in OBJ
!enginecustom/assets/Model/OBJ/*.obj
# Precompiled Headers # Precompiled Headers
*.gch *.gch

View File

@ -0,0 +1 @@
KhaoticEngineReborn

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="RiderAndroidProjectSystem" />
</component>
</project>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
<option name="applicationTheme" value="default" />
<option name="iconsTheme" value="default" />
<option name="button1Title" value="" />
<option name="button1Url" value="" />
<option name="button2Title" value="" />
<option name="button2Url" value="" />
<option name="customApplicationId" value="" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<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>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxBlameSettings">
<option name="version" value="2" />
</component>
</project>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxProjectSettings">
<option name="commitMessageIssueKeyValidationOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
<option name="commitMessageValidationEnabledOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="LanguageDetectionInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="ReassignedToPlainText" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MaterialThemeProjectNewConfig">
<option name="metadata">
<MTProjectMetadataState>
<option name="migrated" value="true" />
<option name="pristineConfig" value="false" />
<option name="userId" value="4025287c:194ad69ad19:-7ff7" />
</MTProjectMetadataState>
</option>
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="singleClickDiffPreview" value="1" />
<option name="unhandledExceptionsIgnoreList" value="1" />
<option name="vcsConfiguration" value="3" />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,285 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<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/enginecustom.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="DpaMonitoringSettings">
<option name="firstShow" value="false" />
</component>
<component name="Git.Settings">
<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="cidr-memory-view://4" 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$/../../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" />
</component>
<component name="ProjectColorInfo">{
&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.KhaoticDemo.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.pluginManager",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="RunManager" selected="C/C++ Project.enginecustom">
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
</configuration_1>
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="AUTO_SELECT_PRIORITY" value="0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration name="enginecustom" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
</configuration_1>
<configuration_2 setup="1">
<option name="CONFIGURATION" value="Release" />
<option name="PLATFORM" value="x64" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(TargetPath)" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$(ProjectDir)" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
</configuration_2>
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="AUTO_SELECT_PRIORITY" value="0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="" />
<created>1738075515913</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1738075515913</updated>
<workItem from="1738075517746" duration="553000" />
<workItem from="1738076088229" duration="80000" />
<workItem from="1738076192788" duration="19000" />
<workItem from="1738076222547" duration="6131000" />
<workItem from="1738171504772" duration="876000" />
<workItem from="1738172392786" duration="67000" />
<workItem from="1738173151768" duration="2361000" />
<workItem from="1738175535254" duration="279000" />
<workItem from="1738178991872" duration="2736000" />
<workItem from="1738244577624" duration="3000" />
<workItem from="1738321399968" duration="689000" />
<workItem from="1738358054789" duration="9000" />
<workItem from="1738358091089" duration="6675000" />
<workItem from="1738364887298" duration="2275000" />
<workItem from="1738515031789" duration="14018000" />
<workItem from="1741705445392" duration="138000" />
<workItem from="1741706018301" duration="5499000" />
<workItem from="1742198713923" duration="31000" />
<workItem from="1742198792655" duration="4618000" />
<workItem from="1742203643675" duration="600000" />
<workItem from="1742206836574" duration="258000" />
<workItem from="1742207107802" duration="5340000" />
<workItem from="1742228751298" duration="38000" />
<workItem from="1742228870107" duration="1198000" />
<workItem from="1742314944369" duration="79000" />
<workItem from="1742318452773" duration="2258000" />
<workItem from="1742331065936" duration="3030000" />
<workItem from="1742371397157" duration="13355000" />
<workItem from="1742425863119" duration="231000" />
<workItem from="1742474596806" duration="67000" />
<workItem from="1742474683111" duration="689000" />
<workItem from="1742574318953" duration="552000" />
<workItem from="1742581210996" duration="681000" />
<workItem from="1742651501885" duration="47000" />
<workItem from="1742664377329" duration="746000" />
<workItem from="1742665243312" duration="310000" />
<workItem from="1742667326806" duration="95000" />
<workItem from="1743185728805" duration="15000" />
<workItem from="1743185754182" duration="815000" />
<workItem from="1743355100472" duration="708000" />
<workItem from="1743355837694" duration="1514000" />
<workItem from="1743370106270" duration="901000" />
<workItem from="1743505399891" duration="2361000" />
<workItem from="1746106963725" duration="5888000" />
<workItem from="1746112904421" duration="75000" />
<workItem from="1746113092234" duration="1477000" />
<workItem from="1746117455914" duration="5976000" />
<workItem from="1746126812110" duration="180000" />
<workItem from="1746188920194" duration="1870000" />
<workItem from="1746274246641" duration="89000" />
<workItem from="1746274352144" duration="8039000" />
<workItem from="1746444660572" duration="7742000" />
<workItem from="1746456965664" duration="13000" />
<workItem from="1746469494034" duration="799000" />
<workItem from="1746526901276" duration="2023000" />
<workItem from="1746536290167" duration="1908000" />
<workItem from="1746538260893" duration="5781000" />
<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" />
<workItem from="1748869642637" duration="3049000" />
<workItem from="1748954607174" duration="14202000" />
<workItem from="1748969487337" duration="402000" />
</task>
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
<option name="closed" value="true" />
<created>1738175474520</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1738175474520</updated>
</task>
<task id="LOCAL-00002" summary="Patch update - add menu button">
<option name="closed" value="true" />
<created>1738181617050</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1738181617050</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="UnityCheckinConfiguration" checkUnsavedScenes="true" />
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
<MESSAGE value="Minor update - viewport window tweak" />
<MESSAGE value="Patch update - add menu button" />
<option name="LAST_COMMIT_MESSAGE" value="Patch update - add menu button" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
<properties exception="System.OperationCanceledException" breakIfHandledByOtherCode="false" displayValue="System.OperationCanceledException" />
<option name="timeStamp" value="1" />
</breakpoint>
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
<properties exception="System.Threading.Tasks.TaskCanceledException" breakIfHandledByOtherCode="false" displayValue="System.Threading.Tasks.TaskCanceledException" />
<option name="timeStamp" value="2" />
</breakpoint>
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
<properties exception="System.Threading.ThreadAbortException" breakIfHandledByOtherCode="false" displayValue="System.Threading.ThreadAbortException" />
<option name="timeStamp" value="3" />
</breakpoint>
</breakpoints>
</breakpoint-manager>
<watches-manager>
<configuration name="CppProject">
<watch expression="((class ModelClass &amp;) (*(*(*this).m_Application).m_object[0]))" />
</configuration>
</watches-manager>
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
<select />
</component>
</project>

24
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C/C++ Runner: Debug Session",
"type": "cppdbg",
"request": "launch",
"args": [],
"stopAtEntry": false,
"externalConsole": true,
"cwd": "c:/Users/arivas/Documents/GitHub/khaotic-engine-Reborn/enginecustom",
"program": "c:/Users/arivas/Documents/GitHub/khaotic-engine-Reborn/enginecustom/build/Debug/outDebug",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}

59
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,59 @@
{
"C_Cpp_Runner.cCompilerPath": "gcc",
"C_Cpp_Runner.cppCompilerPath": "g++",
"C_Cpp_Runner.debuggerPath": "gdb",
"C_Cpp_Runner.cStandard": "",
"C_Cpp_Runner.cppStandard": "",
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
"C_Cpp_Runner.useMsvc": false,
"C_Cpp_Runner.warnings": [
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wshadow",
"-Wformat=2",
"-Wcast-align",
"-Wconversion",
"-Wsign-conversion",
"-Wnull-dereference"
],
"C_Cpp_Runner.msvcWarnings": [
"/W4",
"/permissive-",
"/w14242",
"/w14287",
"/w14296",
"/w14311",
"/w14826",
"/w44062",
"/w44242",
"/w14905",
"/w14906",
"/w14263",
"/w44265",
"/w14928"
],
"C_Cpp_Runner.enableWarnings": true,
"C_Cpp_Runner.warningsAsError": false,
"C_Cpp_Runner.compilerArgs": [],
"C_Cpp_Runner.linkerArgs": [],
"C_Cpp_Runner.includePaths": [],
"C_Cpp_Runner.includeSearch": [
"*",
"**/*"
],
"C_Cpp_Runner.excludeSearch": [
"**/build",
"**/build/**",
"**/.*",
"**/.*/**",
"**/.vscode",
"**/.vscode/**"
],
"C_Cpp_Runner.useAddressSanitizer": false,
"C_Cpp_Runner.useUndefinedSanitizer": false,
"C_Cpp_Runner.useLeakSanitizer": false,
"C_Cpp_Runner.showCompilationTime": false,
"C_Cpp_Runner.useLinkTimeOptimization": false,
"C_Cpp_Runner.msvcSecureNoWarnings": false
}

2970
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,140 +0,0 @@
<?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>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{9e5ef415-5337-4eed-ae23-edc4b1fff455}</ProjectGuid>
<RootNamespace>KhaoticDemo</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</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>Application</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;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</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;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</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;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="..\enginecustom\enginecustom.vcxproj">
<Project>{92cf56c4-76bb-40d4-8fe5-36c15f5f127a}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,22 +0,0 @@
<?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>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,4 +0,0 @@
int main()
{
return 0;
}

View File

@ -1,72 +0,0 @@
/////////////
// GLOBALS //
/////////////
SamplerState SampleType : register(s0);
Texture2D reflectionTexture : register(t0);
Texture2D refractionTexture : register(t1);
Texture2D normalTexture : register(t2);
cbuffer WaterBuffer
{
float waterTranslation;
float reflectRefractScale;
float2 padding;
};
//////////////
// TYPEDEFS //
//////////////
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float4 reflectionPosition : TEXCOORD1;
float4 refractionPosition : TEXCOORD2;
};
////////////////////////////////////////////////////////////////////////////////
// Pixel Shader
////////////////////////////////////////////////////////////////////////////////
float4 WaterPixelShader(PixelInputType input) : SV_TARGET
{
float2 reflectTexCoord;
float2 refractTexCoord;
float4 normalMap;
float3 normal;
float4 reflectionColor;
float4 refractionColor;
float4 color;
// Move the position the water normal is sampled from to simulate moving water.
input.tex.y += waterTranslation;
// Calculate the projected reflection texture coordinates.
reflectTexCoord.x = input.reflectionPosition.x / input.reflectionPosition.w / 2.0f + 0.5f;
reflectTexCoord.y = -input.reflectionPosition.y / input.reflectionPosition.w / 2.0f + 0.5f;
// Calculate the projected refraction texture coordinates.
refractTexCoord.x = input.refractionPosition.x / input.refractionPosition.w / 2.0f + 0.5f;
refractTexCoord.y = -input.refractionPosition.y / input.refractionPosition.w / 2.0f + 0.5f;
// Sample the normal from the normal map texture.
normalMap = normalTexture.Sample(SampleType, input.tex);
// Expand the range of the normal from (0,1) to (-1,+1).
normal = (normalMap.xyz * 2.0f) - 1.0f;
// Re-position the texture coordinate sampling position by the normal map value to simulate the rippling wave effect.
reflectTexCoord = reflectTexCoord + (normal.xy * reflectRefractScale);
refractTexCoord = refractTexCoord + (normal.xy * reflectRefractScale);
// Sample the texture pixels from the textures using the updated texture coordinates.
reflectionColor = reflectionTexture.Sample(SampleType, reflectTexCoord);
refractionColor = refractionTexture.Sample(SampleType, refractTexCoord);
// Combine the reflection and refraction results for the final color.
color = lerp(reflectionColor, refractionColor, 0.6f);
return color;
}

View File

@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.9.34607.119 VisualStudioVersion = 17.9.34607.119
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "enginecustom", "enginecustom\enginecustom.vcxproj", "{92CF56C4-76BB-40D4-8FE5-36C15F5F127A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KhaoticCore", "enginecustom\enginecustom.vcxproj", "{92CF56C4-76BB-40D4-8FE5-36C15F5F127A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KhaoticDemo", "KhaoticDemo\KhaoticDemo.vcxproj", "{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -23,14 +21,6 @@ Global
{92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x64.Build.0 = Release|x64 {92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x64.Build.0 = Release|x64
{92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x86.ActiveCfg = Release|Win32 {92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x86.ActiveCfg = Release|Win32
{92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x86.Build.0 = Release|Win32 {92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x86.Build.0 = Release|Win32
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Debug|x64.ActiveCfg = Debug|x64
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Debug|x64.Build.0 = Debug|x64
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Debug|x86.ActiveCfg = Debug|Win32
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Debug|x86.Build.0 = Debug|Win32
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Release|x64.ActiveCfg = Release|x64
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Release|x64.Build.0 = Release|x64
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Release|x86.ActiveCfg = Release|Win32
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -2,13 +2,13 @@
Khaotic Engine Reborn reprend comme base le moteur Khaotic Engine pour lui ajouter plus de fonctionalité. Khaotic Engine Reborn reprend comme base le moteur Khaotic Engine pour lui ajouter plus de fonctionalité.
Ce moteur est basé sur **DirectX11** utilise **ImGui** avec une couche d'abstraction pour permetre son usage avec d'autres API. Ce moteur est basé sur **DirectX11** et utilise **ImGui** pour son interface graphique.
--- ---
Khaotic Engine is a rendering engine made in **C++** by a small team with the aim of learning how to use rendering APIs (OpenGL, DirectX 11/12 and Vulkan). Khaotic Engine is a rendering engine made in **C++** by a small team with the aim of learning how to use rendering APIs (OpenGL, DirectX 11/12 and Vulkan).
This **DirectX11** based engine uses **ImGui** with an abstraction layer to enable its use with other APIs. This **DirectX11** based engine uses **ImGui** for the user interface.
## Installation ## Installation
@ -35,15 +35,36 @@ This **DirectX11** based engine uses **ImGui** with an abstraction layer to enab
**SHADER** : **SHADER** :
- Cel Shading + Sunlight shader
+ Cel Shading
+ Skysphere
**Interface Graphique** : **Interface Graphique** :
- Shader Manager + Console link to the Logger object
+ Shader Manager
+ Engine Settings
+ Sunlight Settings
**Save And Load of a Scene** :
+ Save All Custom object
+ Save All Custom Texture for Custom Object
**Texture File** :
+ All the format supported by Windows Imaging Component (WIC)
**Optimization** :
- Shader rendering
- Frustum culling
- Object rendering
- Terrain Instancing
## Demo : ## Demo :
[![Demo Video](https://img.youtube.com/vi/qCOCTyB_97c/0.jpg)](https://www.youtube.com/watch?v=qCOCTyB_97c) [![Demo Video](https://img.youtube.com/vi/CbK1a0Ar94Q/0.jpg)](https://youtu.be/CbK1a0Ar94Q)
## Engine Build by : ## Engine Build by :
@ -56,7 +77,7 @@ This **DirectX11** based engine uses **ImGui** with an abstraction layer to enab
- [@Harpie94](https://github.com/Harpie94) - [@Harpie94](https://github.com/Harpie94)
- [@axelpicou](https://github.com/axelpicou) - [@axelpicou](https://github.com/axelpicou)
- [@GolfOcean334](https://github.com/GolfOcean334) - [@GolfOcean334](https://github.com/GolfOcean334)
- [@sutabasuto](https://github.com/sutabasuto) - [@sutabasuto](https://github.com/sutabasuto)
**Moteur Reborn** : **Moteur Reborn** :

View File

@ -1,46 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: cameraclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _CAMERACLASS_H_
#define _CAMERACLASS_H_
//////////////
// INCLUDES //
//////////////
#include <directxmath.h>
using namespace DirectX;
////////////////////////////////////////////////////////////////////////////////
// Class name: CameraClass
////////////////////////////////////////////////////////////////////////////////
class CameraClass
{
public:
CameraClass();
CameraClass(const CameraClass&);
~CameraClass();
void SetPosition(float, float, float);
void SetRotation(float, float, float);
XMFLOAT3 GetPosition();
XMFLOAT3 GetRotation();
void Render();
XMMATRIX GetViewMatrix(XMMATRIX& viewMatrix) const;
void RenderReflection(float);
void GetReflectionViewMatrix(XMMATRIX&) const;
private:
float m_positionX, m_positionY, m_positionZ;
float m_rotationX, m_rotationY, m_rotationZ;
XMMATRIX m_viewMatrix;
XMMATRIX m_reflectionViewMatrix;
};
#endif

View File

@ -1,410 +0,0 @@
#include "CelShadingShader.h"
#include <iostream>
CelShadingShader::CelShadingShader()
{
m_vertexShader = 0;
m_pixelShader = 0;
m_layout = 0;
m_matrixBuffer = 0;
m_sampleState = 0;
m_lightBuffer = 0;
}
CelShadingShader::CelShadingShader(const CelShadingShader& other)
{
}
CelShadingShader::~CelShadingShader()
{
}
bool CelShadingShader::Initialize(ID3D11Device* device, HWND hwnd)
{
Logger::Get().Log("Initializing CelShadingShader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result;
wchar_t vsFilename[128];
wchar_t psFilename[128];
int error;
// Set the filename of the vertex shader.
error = wcscpy_s(vsFilename, 128, L"celshading.vs");
if (error != 0)
{
Logger::Get().Log("Failed to set the filename of the vertex shader", __FILE__, __LINE__);
return false;
}
// Set the filename of the pixel shader.
error = wcscpy_s(psFilename, 128, L"celshading.ps");
if (error != 0)
{
Logger::Get().Log("Failed to set the filename of the pixel shader", __FILE__, __LINE__);
return false;
}
// Initialize the vertex and pixel shaders.
result = InitializeShader(device, hwnd, vsFilename, psFilename);
if (!result)
{
Logger::Get().Log("Failed to initialize the vertex and pixel shaders", __FILE__, __LINE__);
return false;
}
Logger::Get().Log("Successfully initialized CelShadingShader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true;
}
void CelShadingShader::Shutdown()
{
// Shutdown the vertex and pixel shaders as well as the related objects.
ShutdownShader();
}
bool CelShadingShader::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor, XMFLOAT3 lightPosition)
{
bool result;
// Set the shader parameters that it will use for rendering.
result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, diffuseColor, lightPosition);
if (!result)
{
Logger::Get().Log("CelShading Error", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount);
return true;
}
bool CelShadingShader::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
{
HRESULT result;
ID3D10Blob* errorMessage = nullptr;
ID3D10Blob* vertexShaderBuffer = nullptr;
ID3D10Blob* pixelShaderBuffer = nullptr;
D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
unsigned int numElements;
D3D11_BUFFER_DESC matrixBufferDesc;
D3D11_SAMPLER_DESC samplerDesc;
D3D11_BUFFER_DESC lightBufferDesc;
// Compile the vertex shader code.
result = D3DCompileFromFile(vsFilename, nullptr, nullptr, "CelShadingVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &vertexShaderBuffer, &errorMessage);
if (FAILED(result))
{
// If the shader failed to compile it should have written something to the error message.
if (errorMessage)
{
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
}
// If there was nothing in the error message then it simply could not find the shader file itself.
else
{
MessageBox(hwnd, vsFilename, L"Missing Shader File", MB_OK);
}
return false;
}
// Compile the pixel shader code.
result = D3DCompileFromFile(psFilename, nullptr, nullptr, "CelShadingPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &pixelShaderBuffer, &errorMessage);
if (FAILED(result))
{
// If the shader failed to compile it should have written something to the error message.
if (errorMessage)
{
OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
}
// If there was nothing in the error message then it simply could not find the file itself.
else
{
MessageBox(hwnd, psFilename, L"Missing Shader File", MB_OK);
}
return false;
}
// Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), nullptr, &m_vertexShader);
if (FAILED(result))
{
return false;
}
// Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), nullptr, &m_pixelShader);
if (FAILED(result))
{
return false;
}
// Create the vertex input layout description.
// This setup needs to match the VertexType structure in the ModelClass and in the shader.
polygonLayout[0].SemanticName = "POSITION";
polygonLayout[0].SemanticIndex = 0;
polygonLayout[0].Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
polygonLayout[0].InputSlot = 0;
polygonLayout[0].AlignedByteOffset = 0;
polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[0].InstanceDataStepRate = 0;
polygonLayout[1].SemanticName = "NORMAL";
polygonLayout[1].SemanticIndex = 0;
polygonLayout[1].Format = DXGI_FORMAT_R32G32B32_FLOAT;
polygonLayout[1].InputSlot = 0;
polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[1].InstanceDataStepRate = 0;
polygonLayout[2].SemanticName = "TEXCOORD";
polygonLayout[2].SemanticIndex = 0;
polygonLayout[2].Format = DXGI_FORMAT_R32G32_FLOAT;
polygonLayout[2].InputSlot = 0;
polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[2].InstanceDataStepRate = 0;
// Get a count of the elements in the layout.
numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
// Create the vertex input layout.
result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), &m_layout);
if (FAILED(result))
{
return false;
}
// Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
vertexShaderBuffer->Release();
vertexShaderBuffer = nullptr;
pixelShaderBuffer->Release();
pixelShaderBuffer = nullptr;
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
matrixBufferDesc.ByteWidth = sizeof(MatrixBufferType);
matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
matrixBufferDesc.MiscFlags = 0;
matrixBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&matrixBufferDesc, nullptr, &m_matrixBuffer);
if (FAILED(result))
{
return false;
}
// Create a texture sampler state description.
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.MipLODBias = 0.0f;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
samplerDesc.BorderColor[0] = 0;
samplerDesc.BorderColor[1] = 0;
samplerDesc.BorderColor[2] = 0;
samplerDesc.BorderColor[3] = 0;
samplerDesc.MinLOD = 0;
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
// Create the texture sampler state.
result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
if (FAILED(result))
{
return false;
}
// Setup the description of the light dynamic constant buffer that is in the pixel shader.
lightBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
lightBufferDesc.ByteWidth = sizeof(LightBufferType);
lightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
lightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
lightBufferDesc.MiscFlags = 0;
lightBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class.
result = device->CreateBuffer(&lightBufferDesc, nullptr, &m_lightBuffer);
if (FAILED(result))
{
return false;
}
return true;
}
void CelShadingShader::ShutdownShader()
{
// Release the light constant buffer.
if (m_lightBuffer)
{
m_lightBuffer->Release();
m_lightBuffer = nullptr;
}
// Release the sampler state.
if (m_sampleState)
{
m_sampleState->Release();
m_sampleState = nullptr;
}
// Release the matrix constant buffer.
if (m_matrixBuffer)
{
m_matrixBuffer->Release();
m_matrixBuffer = nullptr;
}
// Release the layout.
if (m_layout)
{
m_layout->Release();
m_layout = nullptr;
}
// Release the pixel shader.
if (m_pixelShader)
{
m_pixelShader->Release();
m_pixelShader = nullptr;
}
// Release the vertex shader.
if (m_vertexShader)
{
m_vertexShader->Release();
m_vertexShader = nullptr;
}
}
void CelShadingShader::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{
char* compileErrors;
unsigned long bufferSize, i;
std::ofstream fout;
// Get a pointer to the error message text buffer.
compileErrors = (char*)(errorMessage->GetBufferPointer());
// Get the length of the message.
bufferSize = errorMessage->GetBufferSize();
// Open a file to write the error message to.
fout.open("shader-error.txt");
// Write out the error message.
for (i = 0; i < bufferSize; i++)
{
fout << compileErrors[i];
}
// Close the file.
fout.close();
// Release the error message.
errorMessage->Release();
errorMessage = nullptr;
// Pop a message up on the screen to notify the user to check the text file for compile errors.
MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
}
bool CelShadingShader::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor, XMFLOAT3 lightPosition)
{
HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource;
MatrixBufferType* dataPtr;
LightBufferType* dataPtr2;
unsigned int bufferNumber;
// Transpose the matrices to prepare them for the shader.
worldMatrix = XMMatrixTranspose(worldMatrix);
viewMatrix = XMMatrixTranspose(viewMatrix);
projectionMatrix = XMMatrixTranspose(projectionMatrix);
// Lock the constant buffer so it can be written to.
result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result))
{
return false;
}
// Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData;
// Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix;
dataPtr->view = viewMatrix;
dataPtr->projection = projectionMatrix;
// Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0);
// Set the position of the constant buffer in the vertex shader.
bufferNumber = 0;
// Finally set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);
// Lock the light constant buffer so it can be written to.
result = deviceContext->Map(m_lightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result))
{
return false;
}
// Get a pointer to the data in the constant buffer.
dataPtr2 = (LightBufferType*)mappedResource.pData;
// Copy the lighting variables into the constant buffer.
dataPtr2->diffuseColor = diffuseColor;
dataPtr2->lightDirection = lightDirection;
dataPtr2->lightPosition = lightPosition;
dataPtr2->constantAttenuation = 0.5f; // Set your attenuation values here
dataPtr2->linearAttenuation = 0.1f;
dataPtr2->quadraticAttenuation = 0.01f;
// Unlock the constant buffer.
deviceContext->Unmap(m_lightBuffer, 0);
// Set the position of the light constant buffer in the pixel shader.
bufferNumber = 0;
// Finally set the light constant buffer in the pixel shader with the updated values.
deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_lightBuffer);
// Set shader texture resource in the pixel shader.
deviceContext->PSSetShaderResources(0, 1, &texture);
return true;
}
void CelShadingShader::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount)
{
// Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout);
// Set the vertex and pixel shaders that will be used to render this triangle.
deviceContext->VSSetShader(m_vertexShader, nullptr, 0);
deviceContext->PSSetShader(m_pixelShader, nullptr, 0);
// Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &m_sampleState);
// Render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0);
}

View File

@ -1,68 +0,0 @@
#ifndef _CELSHADINGSHADER_H_
#define _CELSHADINGSHADER_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: CelShadingShader
////////////////////////////////////////////////////////////////////////////////
class CelShadingShader
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct LightBufferType
{
XMFLOAT4 diffuseColor;
XMFLOAT3 lightDirection;
float padding; // Padding to ensure the structure is a multiple of 16 bytes.
XMFLOAT3 lightPosition; // Add light position
float padding2; // Padding to ensure the structure is a multiple of 16 bytes.
float constantAttenuation;
float linearAttenuation;
float quadraticAttenuation;
float padding3; // Padding to ensure the structure is a multiple of 16 bytes.
};
public:
CelShadingShader();
CelShadingShader(const CelShadingShader&);
~CelShadingShader();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4, XMFLOAT3);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4, XMFLOAT3);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11Buffer* m_matrixBuffer;
ID3D11SamplerState* m_sampleState;
ID3D11Buffer* m_lightBuffer;
};
#endif

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

View File

@ -0,0 +1 @@
0 vaisseautri 0 50 0 0 -0 0 1 1 1 Content/Assets/Kobject/vaisseautri.obj CEL_SHADING 1 Unknown 1 0 1 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\marble01.png 1 assets/Texture/BricksNRM2K.png 1 assets/Texture/BricksGLOSS2K.png 0

View File

@ -1,84 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: light.ps
////////////////////////////////////////////////////////////////////////////////
/////////////
// DEFINES //
/////////////
#define NUM_LIGHTS 4
/////////////
// GLOBALS //
/////////////
Texture2D shaderTexture : register(t0);
SamplerState SampleType : register(s0);
cbuffer LightBuffer
{
float4 ambientColor;
float3 lightDirection;
float padding;
float specularPower;
float4 specularColor;
};
cbuffer LightColorBuffer
{
float4 diffuseColor[NUM_LIGHTS];
};
//////////////
// TYPEDEFS //
//////////////
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 lightPos[NUM_LIGHTS] : TEXCOORD1;
};
////////////////////////////////////////////////////////////////////////////////
// Pixel Shader
////////////////////////////////////////////////////////////////////////////////
float4 LightPixelShader(PixelInputType input) : SV_TARGET
{
float4 textureColor;
float3 lightDir;
float4 color;
float3 reflection;
float4 specular;
float lightIntensity[NUM_LIGHTS];
float4 colorArray[NUM_LIGHTS];
float4 colorSum;
int i;
// Sample the pixel color from the texture using the sampler at this texture coordinate location.
textureColor = shaderTexture.Sample(SampleType, input.tex);
for(i=0; i<NUM_LIGHTS; i++)
{
// Calculate the different amounts of light on this pixel based on the positions of the lights.
lightIntensity[i] = saturate(dot(input.normal, input.lightPos[i]));
// Determine the diffuse color amount of each of the four lights.
colorArray[i] = diffuseColor[i] * lightIntensity[i];
}
// Initialize the sum of colors.
colorSum = float4(0.0f, 0.0f, 0.0f, 1.0f);
// Add all of the light colors up.
for(i=0; i<NUM_LIGHTS; i++)
{
colorSum.r += colorArray[i].r;
colorSum.g += colorArray[i].g;
colorSum.b += colorArray[i].b;
}
// Multiply the texture pixel by the combination of all four light colors to get the final result.
color = saturate(colorSum) * textureColor;
return color;
}

View File

@ -1,91 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: lightclass.cpp
////////////////////////////////////////////////////////////////////////////////
#include "lightclass.h"
LightClass::LightClass()
{
}
LightClass::LightClass(const LightClass& other)
{
}
LightClass::~LightClass()
{
}
void LightClass::SetAmbientColor(float red, float green, float blue, float alpha)
{
m_ambientColor = XMFLOAT4(red, green, blue, alpha);
return;
}
void LightClass::SetDiffuseColor(float red, float green, float blue, float alpha)
{
m_diffuseColor = XMFLOAT4(red, green, blue, alpha);
return;
}
void LightClass::SetDirection(float x, float y, float z)
{
m_direction = XMFLOAT3(x, y, z);
return;
}
void LightClass::SetSpecularColor(float red, float green, float blue, float alpha)
{
m_specularColor = XMFLOAT4(red, green, blue, alpha);
return;
}
void LightClass::SetSpecularPower(float power)
{
m_specularPower = power;
return;
}
void LightClass::SetPosition(float x, float y, float z)
{
m_position = XMFLOAT4(x, y, z, 1.0f);
return;
}
XMFLOAT4 LightClass::GetAmbientColor()
{
return m_ambientColor;
}
XMFLOAT4 LightClass::GetDiffuseColor()
{
return m_diffuseColor;
}
XMFLOAT3 LightClass::GetDirection()
{
return m_direction;
}
XMFLOAT4 LightClass::GetSpecularColor()
{
return m_specularColor;
}
float LightClass::GetSpecularPower()
{
return m_specularPower;
}
XMFLOAT4 LightClass::GetPosition()
{
return m_position;
}

View File

@ -1,544 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: lightshaderclass.cpp
////////////////////////////////////////////////////////////////////////////////
#include "lightshaderclass.h"
LightShaderClass::LightShaderClass()
{
m_vertexShader = 0;
m_pixelShader = 0;
m_layout = 0;
m_sampleState = 0;
m_matrixBuffer = 0;
m_cameraBuffer = 0;
m_lightBuffer = 0;
m_lightColorBuffer = 0;
m_lightPositionBuffer = 0;
}
LightShaderClass::LightShaderClass(const LightShaderClass& other)
{
}
LightShaderClass::~LightShaderClass()
{
}
bool LightShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
{
Logger::Get().Log("Initializing LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
wchar_t vsFilename[128];
wchar_t psFilename[128];
int error;
bool result;
// Set the filename of the vertex shader.
error = wcscpy_s(vsFilename, 128, L"light.vs");
if (error != 0)
{
Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Set the filename of the pixel shader.
error = wcscpy_s(psFilename, 128, L"light.ps");
if (error != 0)
{
Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Initialize the vertex and pixel shaders.
result = InitializeShader(device, hwnd, vsFilename, psFilename);
if (!result)
{
Logger::Get().Log("Failed to initialize shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
Logger::Get().Log("LightShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true;
}
void LightShaderClass::Shutdown()
{
// Shutdown the vertex and pixel shaders as well as the related objects.
ShutdownShader();
return;
}
bool LightShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 ambientClor[])
{
bool result;
// Set the shader parameters that it will use for rendering.
result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition, ambientClor);
if(!result)
{
Logger::Get().Log("Failed to set shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount);
return true;
}
bool LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
{
Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
HRESULT result;
ID3D10Blob* errorMessage;
ID3D10Blob* vertexShaderBuffer;
ID3D10Blob* pixelShaderBuffer;
D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
unsigned int numElements;
D3D11_SAMPLER_DESC samplerDesc;
D3D11_BUFFER_DESC matrixBufferDesc;
D3D11_BUFFER_DESC cameraBufferDesc;
D3D11_BUFFER_DESC lightColorBufferDesc;
D3D11_BUFFER_DESC lightPositionBufferDesc;
// Initialize the pointers this function will use to null.
errorMessage = 0;
vertexShaderBuffer = 0;
pixelShaderBuffer = 0;
// Compile the vertex shader code.
result = D3DCompileFromFile(vsFilename, NULL, NULL, "LightVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &vertexShaderBuffer, &errorMessage);
if (FAILED(result))
{
// If the shader failed to compile it should have writen something to the error message.
if (errorMessage)
{
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
}
// If there was nothing in the error message then it simply could not find the shader file itself.
else
{
Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
}
return false;
}
// Compile the pixel shader code.
result = D3DCompileFromFile(psFilename, NULL, NULL, "LightPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &pixelShaderBuffer, &errorMessage);
if (FAILED(result))
{
// If the shader failed to compile it should have writen something to the error message.
if (errorMessage)
{
OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
}
// If there was nothing in the error message then it simply could not find the file itself.
else
{
Logger::Get().Log("Failed to compile shader", __FILE__, __LINE__, Logger::LogLevel::Error);
}
return false;
}
// Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader);
if (FAILED(result))
{
Logger::Get().Log("Failed to create vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader);
if (FAILED(result))
{
Logger::Get().Log("Failed to create pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Create the vertex input layout description.
// This setup needs to match the VertexType stucture in the ModelClass and in the shader.
polygonLayout[0].SemanticName = "POSITION";
polygonLayout[0].SemanticIndex = 0;
polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
polygonLayout[0].InputSlot = 0;
polygonLayout[0].AlignedByteOffset = 0;
polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[0].InstanceDataStepRate = 0;
polygonLayout[1].SemanticName = "TEXCOORD";
polygonLayout[1].SemanticIndex = 0;
polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
polygonLayout[1].InputSlot = 0;
polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[1].InstanceDataStepRate = 0;
polygonLayout[2].SemanticName = "NORMAL";
polygonLayout[2].SemanticIndex = 0;
polygonLayout[2].Format = DXGI_FORMAT_R32G32B32_FLOAT;
polygonLayout[2].InputSlot = 0;
polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[2].InstanceDataStepRate = 0;
// Get a count of the elements in the layout.
numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
// Create the vertex input layout.
result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(),
&m_layout);
if (FAILED(result))
{
Logger::Get().Log("Failed to create input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
vertexShaderBuffer->Release();
vertexShaderBuffer = 0;
pixelShaderBuffer->Release();
pixelShaderBuffer = 0;
// Create a texture sampler state description.
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.MipLODBias = 0.0f;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
samplerDesc.BorderColor[0] = 0;
samplerDesc.BorderColor[1] = 0;
samplerDesc.BorderColor[2] = 0;
samplerDesc.BorderColor[3] = 0;
samplerDesc.MinLOD = 0;
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
// Create the texture sampler state.
result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
if (FAILED(result))
{
Logger::Get().Log("Failed to create sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
matrixBufferDesc.ByteWidth = sizeof(MatrixBufferType);
matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
matrixBufferDesc.MiscFlags = 0;
matrixBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&matrixBufferDesc, NULL, &m_matrixBuffer);
if (FAILED(result))
{
Logger::Get().Log("Failed to create matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Setup the description of the camera dynamic constant buffer that is in the vertex shader.
cameraBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
cameraBufferDesc.ByteWidth = sizeof(CameraBufferType);
cameraBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
cameraBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
cameraBufferDesc.MiscFlags = 0;
cameraBufferDesc.StructureByteStride = 0;
// Create the camera constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&cameraBufferDesc, NULL, &m_cameraBuffer);
if (FAILED(result))
{
Logger::Get().Log("Failed to create camera buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Setup the description of the dynamic constant buffer that is in the pixel shader.
lightColorBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
lightColorBufferDesc.ByteWidth = sizeof(LightColorBufferType);
lightColorBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
lightColorBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
lightColorBufferDesc.MiscFlags = 0;
lightColorBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class.
result = device->CreateBuffer(&lightColorBufferDesc, NULL, &m_lightColorBuffer);
if (FAILED(result))
{
Logger::Get().Log("Failed to create light color buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Setup the description of the dynamic constant buffer that is in the vertex shader.
lightPositionBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
lightPositionBufferDesc.ByteWidth = sizeof(LightPositionBufferType);
lightPositionBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
lightPositionBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
lightPositionBufferDesc.MiscFlags = 0;
lightPositionBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&lightPositionBufferDesc, NULL, &m_lightPositionBuffer);
if (FAILED(result))
{
Logger::Get().Log("Failed to create light position buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true;
}
void LightShaderClass::ShutdownShader()
{
Logger::Get().Log("Shutting down LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the light constant buffers.
if (m_lightColorBuffer)
{
m_lightColorBuffer->Release();
m_lightColorBuffer = 0;
}
if (m_lightPositionBuffer)
{
m_lightPositionBuffer->Release();
m_lightPositionBuffer = 0;
}
// Release the light constant buffer.
if (m_lightBuffer)
{
m_lightBuffer->Release();
m_lightBuffer = 0;
}
// Release the camera constant buffer.
if (m_cameraBuffer)
{
m_cameraBuffer->Release();
m_cameraBuffer = 0;
}
// Release the matrix constant buffer.
if (m_matrixBuffer)
{
m_matrixBuffer->Release();
m_matrixBuffer = 0;
}
// Release the sampler state.
if (m_sampleState)
{
m_sampleState->Release();
m_sampleState = 0;
}
// Release the layout.
if (m_layout)
{
m_layout->Release();
m_layout = 0;
}
// Release the pixel shader.
if (m_pixelShader)
{
m_pixelShader->Release();
m_pixelShader = 0;
}
// Release the vertex shader.
if (m_vertexShader)
{
m_vertexShader->Release();
m_vertexShader = 0;
}
Logger::Get().Log("LightShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
return;
}
void LightShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{
char* compileErrors;
unsigned __int64 bufferSize, i;
ofstream fout;
// Get a pointer to the error message text buffer.
compileErrors = (char*)(errorMessage->GetBufferPointer());
// Get the length of the message.
bufferSize = errorMessage->GetBufferSize();
// Open a file to write the error message to.
fout.open("shader-error.txt");
// Write out the error message.
for (i = 0; i < bufferSize; i++)
{
fout << compileErrors[i];
}
// Close the file.
fout.close();
// Release the error message.
errorMessage->Release();
errorMessage = 0;
// Pop a message up on the screen to notify the user to check the text file for compile errors.
MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
return;
}
bool LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 ambientColor[])
{
HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource;
unsigned int bufferNumber;
MatrixBufferType* dataPtr;
LightPositionBufferType* dataPtr2;
LightColorBufferType* dataPtr3;
// Transpose the matrices to prepare them for the shader.
worldMatrix = XMMatrixTranspose(worldMatrix);
viewMatrix = XMMatrixTranspose(viewMatrix);
projectionMatrix = XMMatrixTranspose(projectionMatrix);
// Lock the constant buffer so it can be written to.
result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result))
{
Logger::Get().Log("Failed to map matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData;
// Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix;
dataPtr->view = viewMatrix;
dataPtr->projection = projectionMatrix;
// Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0);
// Set the position of the constant buffer in the vertex shader.
bufferNumber = 0;
// Now set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);
// Lock the camera constant buffer so it can be written to.
result = deviceContext->Map(m_cameraBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result))
{
Logger::Get().Log("Failed to map camera buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Lock the light position constant buffer so it can be written to.
result = deviceContext->Map(m_lightPositionBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result))
{
Logger::Get().Log("Failed to map light position buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Get a pointer to the data in the constant buffer.
dataPtr2 = (LightPositionBufferType*)mappedResource.pData;
// Copy the light position variables into the constant buffer.
for (int i = 0; i < NUM_LIGHTS; i++)
{
dataPtr2->lightPosition[i] = lightPosition[i];
}
// Unlock the constant buffer.
deviceContext->Unmap(m_lightPositionBuffer, 0);
// Set the position of the constant buffer in the vertex shader.
bufferNumber = 1;
// Finally set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_lightPositionBuffer);
// Set shader texture resource in the pixel shader.
deviceContext->PSSetShaderResources(0, 1, &texture);
// Lock the light color constant buffer so it can be written to.
result = deviceContext->Map(m_lightColorBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result))
{
Logger::Get().Log("Failed to map light color buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Get a pointer to the data in the constant buffer.
dataPtr3 = (LightColorBufferType*)mappedResource.pData;
// Copy the light color variables into the constant buffer.
for (int i = 0; i < NUM_LIGHTS; i++)
{
dataPtr3->diffuseColor[i] = diffuseColor[i];
}
// Unlock the constant buffer.
deviceContext->Unmap(m_lightColorBuffer, 0);
// Set the position of the constant buffer in the pixel shader.
bufferNumber = 0;
// Finally set the constant buffer in the pixel shader with the updated values.
deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_lightColorBuffer);
return true;
}
void LightShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount)
{
// Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout);
// Set the vertex and pixel shaders that will be used to render this triangle.
deviceContext->VSSetShader(m_vertexShader, NULL, 0);
deviceContext->PSSetShader(m_pixelShader, NULL, 0);
// Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &m_sampleState);
// Render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0);
return;
}

View File

@ -1,92 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: lightshaderclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _LIGHTSHADERCLASS_H_
#define _LIGHTSHADERCLASS_H_
/////////////
// GLOBALS //
/////////////
const int NUM_LIGHTS = 4;
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: LightShaderClass
////////////////////////////////////////////////////////////////////////////////
class LightShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct CameraBufferType
{
XMFLOAT3 cameraPosition;
float padding;
};
struct LightBufferType
{
XMFLOAT4 ambientColor;
XMFLOAT4 diffuseColor;
XMFLOAT3 lightDirection;
float padding; // Added extra padding so structure is a multiple of 16 for CreateBuffer function requirements.
float specularPower;
XMFLOAT4 specularColor;
};
struct LightColorBufferType
{
XMFLOAT4 diffuseColor[NUM_LIGHTS];
};
struct LightPositionBufferType
{
XMFLOAT4 lightPosition[NUM_LIGHTS];
};
public:
LightShaderClass();
LightShaderClass(const LightShaderClass&);
~LightShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11SamplerState* m_sampleState;
ID3D11Buffer* m_matrixBuffer;
ID3D11Buffer* m_cameraBuffer;
ID3D11Buffer* m_lightBuffer;
ID3D11Buffer* m_lightColorBuffer;
ID3D11Buffer* m_lightPositionBuffer;
};
#endif

View File

@ -1,26 +0,0 @@
#include "systemclass.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow)
{
SystemClass* System;
bool result;
// Create the system object.
System = new SystemClass;
// Initialize and run the system object.
result = System->Initialize();
if (result)
{
Logger::Get().Log("System initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
System->Run();
}
// Shutdown and release the system object.
System->Shutdown();
delete System;
System = 0;
return 0;
}

View File

@ -1,59 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: multitextureshaderclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _MULTITEXTURESHADERCLASS_H_
#define _MULTITEXTURESHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: MultiTextureShaderClass
////////////////////////////////////////////////////////////////////////////////
class MultiTextureShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
public:
MultiTextureShaderClass();
MultiTextureShaderClass(const MultiTextureShaderClass&);
~MultiTextureShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11Buffer* m_matrixBuffer;
ID3D11SamplerState* m_sampleState;
};
#endif

8
enginecustom/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

@ -1,55 +0,0 @@
#ifndef _ALPHAMAPSHADERCLASS_H_
#define _ALPHAMAPSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: AlphaMapShaderClass
////////////////////////////////////////////////////////////////////////////////
class AlphaMapShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
public:
AlphaMapShaderClass();
AlphaMapShaderClass(const AlphaMapShaderClass&);
~AlphaMapShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11Buffer* m_matrixBuffer;
ID3D11SamplerState* m_sampleState;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,186 +0,0 @@
#ifndef _APPLICATIONCLASS_H_
#define _APPLICATIONCLASS_H_
///////////////////////
// MY CLASS INCLUDES //
///////////////////////
#include "d3dclass.h"
#include "cameraclass.h"
#include "object.h"
#include "lightclass.h"
#include <vector>
#include <filesystem>
#include "bitmapclass.h"
#include "spriteclass.h"
#include "timerclass.h"
#include "fontshaderclass.h"
#include "fontclass.h"
#include "textclass.h"
#include "fpsclass.h"
#include "inputclass.h"
#include "shadermanagerclass.h"
#include "modellistclass.h"
#include "positionclass.h"
#include "frustumclass.h"
#include "rendertextureclass.h"
#include "displayplaneclass.h"
#include "translateshaderclass.h"
#include "reflectionshaderclass.h"
#include "physics.h"
#include <WICTextureLoader.h>
#include <comdef.h> // Pour _com_error
/////////////
// GLOBALS //
/////////////
const bool FULL_SCREEN = false;
const bool VSYNC_ENABLED = true;
const float SCREEN_DEPTH = 1000.0f;
const float SCREEN_NEAR = 0.3f;
////////////////////////////////////////////////////////////////////////////////
// Class name: ApplicationClass
////////////////////////////////////////////////////////////////////////////////
class ApplicationClass
{
public:
ApplicationClass();
ApplicationClass(const ApplicationClass&);
~ApplicationClass();
D3DClass* GetDirect3D();
bool Initialize(int, int, HWND);
void Shutdown();
bool Frame(InputClass*);
int GetScreenWidth() const;
int GetScreenHeight() const;
float GetSpeed() const { return m_speed; };
void SetSpeed(float speed) { this->m_speed = speed; };
void AddCube();
void DeleteKobject(int index);
size_t GetCubeCount() const { return m_cubes.size(); };
size_t GetTerrainCubeCount() const { return m_terrainChunk.size(); };
std::vector<Object*> GetCubes() const { return m_cubes; };
std::vector<Object*> GetTerrainCubes() const { return m_terrainChunk; };
std::vector<Object*> GetKobjects() const { return m_object; };
void AddKobject(WCHAR* filepath);
void GenerateTerrain();
void DeleteTerrain();
XMVECTOR GetLightPosition(int index);
XMVECTOR GetLightColor(int index);
void SetLightPosition(int index, XMVECTOR color);
void SetLightColor(int index, XMVECTOR color);
void DeleteLight(int index);
void AddLight();
std::vector<LightClass*> GetLights() const { return m_Lights; };
bool GetShouldQuit() const { return m_ShouldQuit; };
void SetShouldQuit(bool shouldQuit) { m_ShouldQuit = shouldQuit; };
void SetCelShading(bool enable) { m_enableCelShading = enable; };
std::vector<ID3D11ShaderResourceView*> textures;
private:
bool Render(float, float, float, float, float);
bool UpdateMouseStrings(int, int, bool);
bool UpdateFps();
bool UpdateRenderCountString(int);
bool RenderSceneToTexture(float);
bool RenderRefractionToTexture();
bool RenderReflectionToTexture();
private :
// ------------------------------------- //
// ------------- DIRECT3D -------------- //
// ------------------------------------- //
D3DClass* m_Direct3D;
IDXGISwapChain* m_swapChain;
ModelClass* m_Model,* m_GroundModel, * m_WallModel, * m_BathModel, * m_WaterModel;
ModelListClass* m_ModelList;
// ------------------------------------- //
// ------------- RENDERING ------------- //
// ------------------------------------- //
XMMATRIX m_baseViewMatrix;
RenderTextureClass* m_RenderTexture, * m_RefractionTexture, * m_ReflectionTexture;
DisplayPlaneClass* m_DisplayPlane;
int m_screenWidth, m_screenHeight;
CameraClass* m_Camera;
PositionClass* m_Position;
FrustumClass* m_Frustum;
// ------------------------------------ //
// ------------- OBJECTS -------------- //
// ------------------------------------ //
Object* m_SelectedObject;
std::vector<Object*> m_cubes;
std::vector<Object*> m_terrainChunk;
float m_speed = 0.1f; // speed for the demo spinning object
std::vector<Object*> m_object;
int m_ObjectId = 0;
// ----------------------------------- //
// ------------- LIGHTS -------------- //
// ----------------------------------- //
LightClass* m_Light;
std::vector<LightClass*> m_Lights;
int m_numLights;
XMFLOAT3 TrueLightPosition;
ModelClass* m_LightModel;
// ----------------------------------- //
// ------------- SHADERS ------------- //
// ----------------------------------- //
ShaderManagerClass* m_ShaderManager;
FontShaderClass* m_FontShader;
BitmapClass* m_Bitmap;
SpriteClass* m_Sprite;
bool m_enableCelShading;
// ----------------------------------- //
// ------------ VARIABLES ------------ //
// ----------------------------------- //
float m_waterHeight, m_waterTranslation;
// ------------------------------------------------- //
// ------------- FPS AND INFO ON SCREEN ------------ //
// ------------------------------------------------- //
TimerClass* m_Timer;
TextClass* m_MouseStrings;
TextClass* m_RenderCountString;
FontClass* m_Font;
FpsClass* m_Fps;
TextClass* m_FpsString;
int m_previousFps;
// ------------------------------------------------- //
// ------------------- OTHER ----------------------- //
// ------------------------------------------------- //
bool m_ShouldQuit;
Physics* m_Physics;
float m_gravity;
XMVECTOR m_previousPosition;
};
#endif

File diff suppressed because it is too large Load Diff

BIN
enginecustom/assets/Model/OBJ/cone.obj (Stored with Git LFS)

Binary file not shown.

BIN
enginecustom/assets/Model/OBJ/invertcube.obj (Stored with Git LFS) Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

BIN
enginecustom/assets/Model/OBJ/plane.obj (Stored with Git LFS) Normal file

Binary file not shown.

BIN
enginecustom/assets/Model/OBJ/skysphere.obj (Stored with Git LFS) Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
enginecustom/assets/Model/OBJ/vaisseautri.mtl (Stored with Git LFS) Normal file

Binary file not shown.

BIN
enginecustom/assets/Model/OBJ/vaisseautri.obj (Stored with Git LFS) Normal file

Binary file not shown.

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: 81 KiB

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,842
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

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

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

View File

View File

@ -1,59 +0,0 @@
#ifndef _BITMAPCLASS_H_
#define _BITMAPCLASS_H_
//////////////
// INCLUDES //
//////////////
#include <directxmath.h>
using namespace DirectX;
///////////////////////
// MY CLASS INCLUDES //
///////////////////////
#include "textureclass.h"
////////////////////////////////////////////////////////////////////////////////
// Class name: BitmapClass
////////////////////////////////////////////////////////////////////////////////
class BitmapClass
{
private:
struct VertexType
{
XMFLOAT3 position;
XMFLOAT2 texture;
};
public:
BitmapClass();
BitmapClass(const BitmapClass&);
~BitmapClass();
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, char*, int, int);
void Shutdown();
bool Render(ID3D11DeviceContext*);
int GetIndexCount();
ID3D11ShaderResourceView* GetTexture();
void SetRenderLocation(int, int);
private:
bool InitializeBuffers(ID3D11Device*);
void ShutdownBuffers();
bool UpdateBuffers(ID3D11DeviceContext*);
void RenderBuffers(ID3D11DeviceContext*);
bool LoadTexture(ID3D11Device*, ID3D11DeviceContext*, char*);
void ReleaseTexture();
private:
ID3D11Buffer* m_vertexBuffer, * m_indexBuffer;
int m_vertexCount, m_indexCount, m_screenWidth, m_screenHeight, m_bitmapWidth, m_bitmapHeight, m_renderX, m_renderY, m_prevPosX, m_prevPosY;
TextureClass* m_Texture;
};
#endif

View File

@ -1,87 +0,0 @@
cbuffer LightBuffer
{
float4 diffuseColor;
float3 lightDirection;
float padding; // Padding to ensure the structure is a multiple of 16 bytes.
float3 lightPosition; // Add light position
float padding2; // Padding to ensure the structure is a multiple of 16 bytes.
float constantAttenuation;
float linearAttenuation;
float quadraticAttenuation;
float padding3; // Padding to ensure the structure is a multiple of 16 bytes.
};
Texture2D shaderTexture;
SamplerState SampleType;
struct PixelInputType
{
float4 position : SV_POSITION;
float3 normal : NORMAL;
float2 tex : TEXCOORD0;
float3 worldPos : TEXCOORD1; // Add world position
};
float4 CelShadingPixelShader(PixelInputType input) : SV_TARGET
{
float4 textureColor;
float lightIntensity;
float4 finalColor;
// Sample the pixel color from the texture.
textureColor = shaderTexture.Sample(SampleType, input.tex);
float3 normal = normalize(input.normal);
// Calculate the light vector from the light position to the world position
float3 lightVector = normalize(lightPosition - input.worldPos);
// Calculate the light intensity based on the light direction.
float directionalLightIntensity = saturate(dot(normal, normalize(lightDirection)));
// Calculate the light intensity based on the light position.
float positionalLightIntensity = saturate(dot(normal, lightVector));
// Combine the directional and positional light intensities.
lightIntensity = max(directionalLightIntensity, positionalLightIntensity);
// Calculate the distance from the light to the fragment.
float distance = length(lightPosition - input.worldPos);
// Apply an attenuation factor based on the distance.
float attenuation = 1.0f / (constantAttenuation + linearAttenuation * distance + quadraticAttenuation * distance * distance);
// Combine the light intensity with the attenuation factor.
lightIntensity *= attenuation;
// Apply a step function to create the cel shading effect.
if (lightIntensity > 0.75f)
{
lightIntensity = 1.0f; // Brightest level
}
else if (lightIntensity > 0.5f)
{
lightIntensity = 0.7f; // Mid-bright level
}
else if (lightIntensity > 0.25f)
{
lightIntensity = 0.4f; // Mid-dark level
}
else
{
lightIntensity = 0.1f; // Darkest level
}
// Simple shadow calculation: if the fragment is behind the light source, it is in shadow.
float3 toLight = normalize(lightPosition - input.worldPos);
float shadow = saturate(dot(normal, toLight));
if (shadow < 0.1f)
{
lightIntensity *= 0.5f; // Darken the fragment if it is in shadow
}
// Calculate the final color by combining the texture color with the light intensity and diffuse color.
finalColor = textureColor * diffuseColor * lightIntensity;
return finalColor;
}

View File

@ -1,88 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: d3dclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _D3DCLASS_H_
#define _D3DCLASS_H_
/////////////
// LINKING //
/////////////
#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "d3dcompiler.lib")
//////////////
// INCLUDES //
//////////////
#include "imguiManager.h"
#include "d3d11.h"
#include "fontshaderclass.h"
#include "fontclass.h"
#include "textclass.h"
using namespace DirectX;
////////////////////////////////////////////////////////////////////////////////
// Class name: D3DClass
////////////////////////////////////////////////////////////////////////////////
class D3DClass
{
public:
D3DClass();
D3DClass(const D3DClass&);
~D3DClass();
bool Initialize(int, int, bool, HWND, bool, float, float);
void Shutdown();
void BeginScene(float, float, float, float);
void EndScene();
ID3D11Device* GetDevice();
ID3D11DeviceContext* GetDeviceContext();
XMMATRIX GetProjectionMatrix(XMMATRIX& projectionMatrix);
IDXGISwapChain* m_swapChain;
IDXGISwapChain* GetSwapChain();
void ResizeSwapChain(int, int);
XMMATRIX GetProjectionMatrix();
void GetWorldMatrix(XMMATRIX&);
void GetOrthoMatrix(XMMATRIX&);
void GetVideoCardInfo(char*, int&);
void SetBackBufferRenderTarget();
void ResetViewport();
void ReleaseResources();
void ResetResources(int newWidth, int newHeight);
void TurnZBufferOn();
void TurnZBufferOff();
void EnableAlphaBlending();
void DisableAlphaBlending();
private:
bool m_vsync_enabled;
int m_videoCardMemory;
char m_videoCardDescription[128];
ID3D11Device* m_device;
ID3D11DeviceContext* m_deviceContext;
ID3D11RenderTargetView* m_renderTargetView;
ID3D11Texture2D* m_depthStencilBuffer;
ID3D11DepthStencilState* m_depthStencilState;
ID3D11DepthStencilView* m_depthStencilView;
ID3D11RasterizerState* m_rasterState;
XMMATRIX m_projectionMatrix;
XMMATRIX m_worldMatrix;
XMMATRIX m_orthoMatrix;
D3D11_VIEWPORT m_viewport;
ID3D11DepthStencilState* m_depthDisabledStencilState;
ID3D11BlendState* m_alphaEnableBlendingState;
ID3D11BlendState* m_alphaDisableBlendingState;
};
#endif

1
enginecustom/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\ground01.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

@ -19,72 +19,68 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="alphamapshaderclass.cpp" />
<ClCompile Include="applicationclass.cpp" />
<ClCompile Include="bitmapclass.cpp" />
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DDSTextureLoader.cpp" />
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DirectXHelpers.cpp" />
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\pch.cpp" />
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\SimpleMath.cpp" />
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\WICTextureLoader.cpp" />
<ClCompile Include="Cameraclass.cpp" />
<ClCompile Include="CelShadingShader.cpp" />
<ClCompile Include="Colorshaderclass.cpp" />
<ClCompile Include="d3dclass.cpp" />
<ClCompile Include="imguiManager.cpp" />
<ClCompile Include="include\backends\imgui_impl_dx11.cpp" /> <ClCompile Include="include\backends\imgui_impl_dx11.cpp" />
<ClCompile Include="include\backends\imgui_impl_win32.cpp" /> <ClCompile Include="include\backends\imgui_impl_win32.cpp" />
<ClCompile Include="include\imgui.cpp" /> <ClCompile Include="include\imgui.cpp" />
<ClCompile Include="include\imgui_demo.cpp" />
<ClCompile Include="include\imgui_draw.cpp" /> <ClCompile Include="include\imgui_draw.cpp" />
<ClCompile Include="include\imgui_tables.cpp" /> <ClCompile Include="include\imgui_tables.cpp" />
<ClCompile Include="include\imgui_widgets.cpp" /> <ClCompile Include="include\imgui_widgets.cpp" />
<ClCompile Include="displayplaneclass.cpp" /> <ClCompile Include="include\Src\DDSTextureLoader.cpp" />
<ClCompile Include="fontclass.cpp" /> <ClCompile Include="include\Src\DirectXHelpers.cpp" />
<ClCompile Include="fontshaderclass.cpp" /> <ClCompile Include="include\Src\pch.cpp" />
<ClCompile Include="fpsclass.cpp" /> <ClCompile Include="include\Src\SimpleMath.cpp" />
<ClCompile Include="frustumclass.cpp" /> <ClCompile Include="include\Src\WICTextureLoader.cpp" />
<ClCompile Include="inputclass.cpp" /> <ClCompile Include="src\src\shader\alpha_map_shader_class.cpp" />
<ClCompile Include="Lightclass.cpp" /> <ClCompile Include="src\src\shader\celshade_class.cpp" />
<ClCompile Include="lightmapshaderclass.cpp" /> <ClCompile Include="src\src\shader\color_shader_class.cpp" />
<ClCompile Include="Lightshaderclass.cpp" /> <ClCompile Include="src\src\shader\depth_shader_class.cpp" />
<ClCompile Include="Main.cpp" /> <ClCompile Include="src\src\shader\font_shader_class.cpp" />
<ClCompile Include="modelclass.cpp" /> <ClCompile Include="src\src\shader\light_map_shader_class.cpp" />
<ClCompile Include="object.cpp" /> <ClCompile Include="src\src\shader\light_shader_class.cpp" />
<ClCompile Include="modellistclass.cpp" /> <ClCompile Include="src\src\shader\master_shader.cpp" />
<ClCompile Include="Multitextureshaderclass.cpp" /> <ClCompile Include="src\src\shader\multi_texture_shader_class.cpp" />
<ClCompile Include="normalmapshaderclass.cpp" /> <ClCompile Include="src\src\shader\normal_map_shader_class.cpp" />
<ClCompile Include="refractionshaderclass.cpp" /> <ClCompile Include="src\src\shader\reflection_shader_class.cpp" />
<ClCompile Include="shadermanagerclass.cpp" /> <ClCompile Include="src\src\shader\refraction_shader_class.cpp" />
<ClCompile Include="physics.cpp" /> <ClCompile Include="src\src\shader\shader_manager_class.cpp" />
<ClCompile Include="positionclass.cpp" /> <ClCompile Include="src\src\shader\skybox_shader_class.cpp" />
<ClCompile Include="reflectionshaderclass.cpp" /> <ClCompile Include="src\src\shader\spec_map_shader_class.cpp" />
<ClCompile Include="rendertextureclass.cpp" /> <ClCompile Include="src\src\shader\sunlight_shader_class.cpp" />
<ClCompile Include="specmapshaderclass.cpp" /> <ClCompile Include="src\src\shader\texture_shader_class.cpp" />
<ClCompile Include="Spriteclass.cpp" /> <ClCompile Include="src\src\shader\translate_shader_class.cpp" />
<ClCompile Include="Systemclass.cpp" /> <ClCompile Include="src\src\shader\transparent_shader_class.cpp" />
<ClCompile Include="textclass.cpp" /> <ClCompile Include="src\src\shader\water_shader_class.cpp" />
<ClCompile Include="textureclass.cpp" /> <ClCompile Include="src\src\system\application_class.cpp" />
<ClCompile Include="textureshaderclass.cpp" /> <ClCompile Include="src\src\system\bitmap_class.cpp" />
<ClCompile Include="Timerclass.cpp" /> <ClCompile Include="src\src\system\camera_class.cpp" />
<ClCompile Include="translateshaderclass.cpp" /> <ClCompile Include="src\src\system\d_3d_class.cpp" />
<ClCompile Include="transparentshaderclass.cpp" /> <ClCompile Include="src\src\system\display_plane_class.cpp" />
<ClCompile Include="watershaderclass.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\Main.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\scene_manager.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\stats.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>
<ItemGroup> <ItemGroup>
<ClInclude Include="alphamapshaderclass.h" />
<ClInclude Include="applicationclass.h" />
<ClInclude Include="bitmapclass.h" />
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\CMO.h" />
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DDS.h" />
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\LoaderHelpers.h" />
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\pch.h" />
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\PlatformHelpers.h" />
<ClInclude Include="Cameraclass.h" />
<ClInclude Include="CelShadingShader.h" />
<ClInclude Include="Colorshaderclass.h" />
<ClInclude Include="d3dclass.h" />
<ClInclude Include="imguiManager.h" />
<ClInclude Include="include\backends\imgui_impl_dx11.h" /> <ClInclude Include="include\backends\imgui_impl_dx11.h" />
<ClInclude Include="include\backends\imgui_impl_win32.h" /> <ClInclude Include="include\backends\imgui_impl_win32.h" />
<ClInclude Include="include\imconfig.h" /> <ClInclude Include="include\imconfig.h" />
@ -93,158 +89,347 @@
<ClInclude Include="include\imstb_rectpack.h" /> <ClInclude Include="include\imstb_rectpack.h" />
<ClInclude Include="include\imstb_textedit.h" /> <ClInclude Include="include\imstb_textedit.h" />
<ClInclude Include="include\imstb_truetype.h" /> <ClInclude Include="include\imstb_truetype.h" />
<ClInclude Include="displayplaneclass.h" /> <ClInclude Include="include\Src\CMO.h" />
<ClInclude Include="fontclass.h" /> <ClInclude Include="include\Src\DDS.h" />
<ClInclude Include="fontshaderclass.h" /> <ClInclude Include="include\Src\LoaderHelpers.h" />
<ClInclude Include="fpsclass.h" /> <ClInclude Include="include\Src\pch.h" />
<ClInclude Include="frustumclass.h" /> <ClInclude Include="include\Src\PlatformHelpers.h" />
<ClInclude Include="inputclass.h" /> <ClInclude Include="src\inc\shader\alpha_map_shader_class.h" />
<ClInclude Include="lightclass.h" /> <ClInclude Include="src\inc\shader\celshade_class.h" />
<ClInclude Include="lightmapshaderclass.h" /> <ClInclude Include="src\inc\shader\color_shader_class.h" />
<ClInclude Include="lightshaderclass.h" /> <ClInclude Include="src\inc\shader\depth_shader_class.h" />
<ClInclude Include="Logger.h" /> <ClInclude Include="src\inc\shader\font_shader_class.h" />
<ClInclude Include="modelclass.h" /> <ClInclude Include="src\inc\shader\light_map_shader_class.h" />
<ClInclude Include="object.h" /> <ClInclude Include="src\inc\shader\light_shader_class.h" />
<ClInclude Include="modellistclass.h" /> <ClInclude Include="src\inc\shader\master_shader.h" />
<ClInclude Include="Multitextureshaderclass.h" /> <ClInclude Include="src\inc\shader\multi_texture_shader_class.h" />
<ClInclude Include="normalmapshaderclass.h" /> <ClInclude Include="src\inc\shader\normal_map_shader_class.h" />
<ClInclude Include="refractionshaderclass.h" /> <ClInclude Include="src\inc\shader\reflection_shader_class.h" />
<ClInclude Include="shadermanagerclass.h" /> <ClInclude Include="src\inc\shader\refraction_shader_class.h" />
<ClInclude Include="physics.h" /> <ClInclude Include="src\inc\shader\shader_manager_class.h" />
<ClInclude Include="positionclass.h" /> <ClInclude Include="src\inc\shader\skybox_shader_class.h" />
<ClInclude Include="reflectionshaderclass.h" /> <ClInclude Include="src\inc\shader\spec_map_shader_class.h" />
<ClInclude Include="rendertextureclass.h" /> <ClInclude Include="src\inc\shader\sunlight_shader_class.h" />
<ClInclude Include="resources.h" /> <ClInclude Include="src\inc\shader\texture_shader_class.h" />
<ClInclude Include="specmapshaderclass.h" /> <ClInclude Include="src\inc\shader\translate_shader_class.h" />
<ClInclude Include="Spriteclass.h" /> <ClInclude Include="src\inc\shader\transparent_shader_class.h" />
<ClInclude Include="systemclass.h" /> <ClInclude Include="src\inc\shader\water_shader_class.h" />
<ClInclude Include="textclass.h" /> <ClInclude Include="src\inc\system\application_class.h" />
<ClInclude Include="textureclass.h" /> <ClInclude Include="src\inc\system\bitmap_class.h" />
<ClInclude Include="textureshaderclass.h" /> <ClInclude Include="src\inc\system\camera_class.h" />
<ClInclude Include="Timerclass.h" /> <ClInclude Include="src\inc\system\d_3d_class.h" />
<ClInclude Include="translateshaderclass.h" /> <ClInclude Include="src\inc\system\display_plane_class.h" />
<ClInclude Include="transparentshaderclass.h" /> <ClInclude Include="src\inc\system\font_class.h" />
<ClInclude Include="watershaderclass.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\scene_manager.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\stats.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>
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="alphamap.ps"> <CopyFileToFolders Include="src\hlsl\alphamap.ps">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="alphamap.vs"> <CopyFileToFolders Include="src\hlsl\alphamap.vs">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="font.ps"> <CopyFileToFolders Include="src\hlsl\celshading.ps">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="font.vs"> <CopyFileToFolders Include="src\hlsl\celshading.vs">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="light.ps"> <CopyFileToFolders Include="src\hlsl\Color.ps">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="light.vs"> <CopyFileToFolders Include="src\hlsl\Color.vs">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="lightmap.ps"> <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> <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>
<CopyFileToFolders Include="lightmap.vs"> <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> <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>
<CopyFileToFolders Include="Multitexture.ps"> <CopyFileToFolders Include="src\hlsl\font.ps">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="Multitexture.vs"> <CopyFileToFolders Include="src\hlsl\font.vs">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="normalmap.ps"> <CopyFileToFolders Include="src\hlsl\light.ps">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="normalmap.vs"> <CopyFileToFolders Include="src\hlsl\light.vs">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="..\KhaoticDemo\water.ps"> <CopyFileToFolders Include="src\hlsl\lightmap.ps">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="celshading.ps"> <CopyFileToFolders Include="src\hlsl\lightmap.vs">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="celshading.vs"> <CopyFileToFolders Include="src\hlsl\Multitexture.ps">
<FileType>Document</FileType> <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>
<None Include="packages.config" /> <CopyFileToFolders Include="src\hlsl\Multitexture.vs">
<CopyFileToFolders Include="reflection.ps">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="reflection.vs"> <CopyFileToFolders Include="src\hlsl\normalmap.ps">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="specmap.ps"> <CopyFileToFolders Include="src\hlsl\normalmap.vs">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="specmap.vs"> <CopyFileToFolders Include="src\hlsl\reflection.ps">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="texture.ps"> <CopyFileToFolders Include="src\hlsl\reflection.vs">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="texture.vs"> <CopyFileToFolders Include="src\hlsl\refraction.ps">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="transparent.ps"> <CopyFileToFolders Include="src\hlsl\refraction.vs">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="transparent.vs"> <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> <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>
<CopyFileToFolders Include="refraction.ps"> <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> <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>
<CopyFileToFolders Include="refraction.vs"> <CopyFileToFolders Include="src\hlsl\specmap.ps">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="water.vs"> <CopyFileToFolders Include="src\hlsl\specmap.vs">
<FileType>Document</FileType> <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>
</ItemGroup> <CopyFileToFolders Include="src\hlsl\sunlight.ps">
<ItemGroup>
<CopyFileToFolders Include="Color.ps">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="Color.vs"> <CopyFileToFolders Include="src\hlsl\sunlight.vs">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
<FileType>Document</FileType> <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> </CopyFileToFolders>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="font01.tga" /> <CopyFileToFolders Include="font01.tga" />
<Image Include="assets\Texture\alpha01.png" /> <CopyFileToFolders Include="assets\Texture\Bricks2K.png">
<Image Include="assets\Texture\Bricks2K.png" /> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<Image Include="assets\Texture\BricksGLOSS2K.png" /> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<Image Include="assets\Texture\BricksNRM2K.png" /> </CopyFileToFolders>
<Image Include="assets\Texture\dirt01.png" /> <CopyFileToFolders Include="assets\Texture\BricksGLOSS2K.png">
<Image Include="assets\Texture\font01.png" /> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<Image Include="assets\Texture\ground01.png" /> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<Image Include="assets\Texture\light01.png" /> </CopyFileToFolders>
<Image Include="assets\Texture\marble01.png" /> <CopyFileToFolders Include="assets\Texture\BricksNRM2K.png">
<Image Include="assets\Texture\moss01.png" /> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<Image Include="assets\Texture\normal01.png" /> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<Image Include="assets\Texture\spec02.png" /> </CopyFileToFolders>
<Image Include="assets\Texture\sprite01.png" /> <CopyFileToFolders Include="assets\Skybox\skybox.png">
<Image Include="assets\Texture\sprite02.png" /> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox</DestinationFolders>
<Image Include="assets\Texture\sprite03.png" /> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox</DestinationFolders>
<Image Include="assets\Texture\sprite04.png" /> </CopyFileToFolders>
<Image Include="assets\Texture\stone01.png" /> <CopyFileToFolders Include="assets\Texture\dirt01.png">
<Image Include="assets\Texture\wall.png" /> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<Image Include="assets\Texture\wall01.png" /> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<Image Include="assets\Texture\water01.png" /> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\EmptyTexture.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\font01.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\ground01.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\light01.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\marble01.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\moss01.png">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ExcludedFromBuild>
<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\normal01.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\spec02.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\sprite01.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\sprite02.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\sprite03.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\sprite04.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\stone01.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\stone01.tga">
<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\wall.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\wall01.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\water01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<Image Include="KhaoticIcon.ico" /> <Image Include="KhaoticIcon.ico" />
<CopyFileToFolders Include="sprite01.tga" /> <CopyFileToFolders Include="sprite01.tga" />
<CopyFileToFolders Include="sprite02.tga" /> <CopyFileToFolders Include="sprite02.tga" />
@ -255,47 +440,140 @@
<CopyFileToFolders Include="font01.txt" /> <CopyFileToFolders Include="font01.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="translate.ps"> <ResourceCompile Include="resources.rc" />
<SubType>Designer</SubType> </ItemGroup>
<FileType>Document</FileType> <ItemGroup>
</CopyFileToFolders> <CopyFileToFolders Include="sprite_data_01.txt" />
<CopyFileToFolders Include="translate.vs"> </ItemGroup>
<SubType>Designer</SubType> <ItemGroup>
<Content Include="assets\Model\OBJ\86.obj" />
<Content Include="assets\Model\OBJ\cone.obj" />
<Content Include="assets\Model\OBJ\invertcube.obj" />
<Content Include="assets\Model\OBJ\isosphere.obj" />
<Content Include="assets\Model\OBJ\monke.obj" />
<Content Include="assets\Model\OBJ\plane.obj" />
<Content Include="assets\Model\OBJ\vaisseautri.obj" />
<Content Include="assets\Model\TXT\bath.txt" />
<Content Include="assets\Model\TXT\chunk.txt" />
<Content Include="assets\Model\TXT\cube.txt" />
<Content Include="assets\Model\TXT\ground.txt" />
<Content Include="assets\Model\TXT\plane.txt" />
<Content Include="assets\Model\TXT\sphere.txt" />
<Content Include="assets\Model\TXT\square.txt" />
<Content Include="assets\Model\TXT\wall.txt" />
<Content Include="assets\Model\TXT\water.txt" />
<CopyFileToFolders Include="assets\Texture\alpha01.png" />
<Content Include="assets\Texture\dirt01.png" />
<Content Include="assets\Texture\EmptyTexture.png" />
<Content Include="assets\Texture\font01.png" />
<Content Include="assets\Texture\ground01.png" />
<Content Include="assets\Texture\imgui.ini" />
<Content Include="assets\Texture\light01.png" />
<Content Include="assets\Texture\marble01.png" />
<Content Include="assets\Texture\moss01.png" />
<Content Include="assets\Texture\normal01.png" />
<Content Include="assets\Texture\spec02.png" />
<Content Include="assets\Texture\sprite01.png" />
<Content Include="assets\Texture\sprite02.png" />
<Content Include="assets\Texture\sprite03.png" />
<Content Include="assets\Texture\sprite04.png" />
<Content Include="assets\Texture\stone01.png" />
<Content Include="assets\Texture\stone01.tga" />
<Content Include="assets\Texture\wall.png" />
<Content Include="assets\Texture\wall01.png" />
<Content Include="assets\Texture\water01.png" />
<Content Include="TODO.txt" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="assets\Model\OBJ\skysphere.obj">
<FileType>Document</FileType> <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> </CopyFileToFolders>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="resources.rc" /> <None Include="assets\Texture\imgui.ini" />
<None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="assets\Model\OBJ\86.obj"> <CopyFileToFolders Include="assets\Model\OBJ\86.obj">
<FileType>Document</FileType> <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> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\cone.obj"> <CopyFileToFolders Include="assets\Model\OBJ\cone.obj">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="assets\Model\OBJ\invertcube.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> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\isosphere.obj"> <CopyFileToFolders Include="assets\Model\OBJ\isosphere.obj">
<FileType>Document</FileType> <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> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\monke.obj"> <CopyFileToFolders Include="assets\Model\OBJ\monke.obj">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="assets\Model\OBJ\plane.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> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseau.obj"> <CopyFileToFolders Include="assets\Model\OBJ\vaisseau.obj">
<FileType>Document</FileType> <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>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseautri.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> </CopyFileToFolders>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="assets\Model\TXT\bath.txt" /> <CopyFileToFolders Include="assets\Model\TXT\bath.txt">
<CopyFileToFolders Include="assets\Model\TXT\chunk.txt"> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<FileType>Text</FileType> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\chunk.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\cube.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\ground.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\plane.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\sphere.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\square.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\wall.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\water.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\cube.txt" />
<CopyFileToFolders Include="assets\Model\TXT\ground.txt" />
<CopyFileToFolders Include="assets\Model\TXT\plane.txt" />
<CopyFileToFolders Include="assets\Model\TXT\sphere.txt" />
<CopyFileToFolders Include="assets\Model\TXT\square.txt" />
<CopyFileToFolders Include="assets\Model\TXT\wall.txt" />
<CopyFileToFolders Include="assets\Model\TXT\water.txt" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion> <VCProjectVersion>17.0</VCProjectVersion>
@ -383,12 +661,13 @@
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <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> <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)enginecustom\include\Vulkan\Lib;$(SolutionDir)enginecustom\include\GLFW\lib-vc2022;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -400,13 +679,14 @@
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <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> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)enginecustom\include\Vulkan\Lib;$(SolutionDir)enginecustom\include\GLFW\lib-vc2022;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -49,35 +49,23 @@
<Filter Include="Assets\Model\TXT"> <Filter Include="Assets\Model\TXT">
<UniqueIdentifier>{f67d85e0-106e-47a1-bb9c-a5ea9111509a}</UniqueIdentifier> <UniqueIdentifier>{f67d85e0-106e-47a1-bb9c-a5ea9111509a}</UniqueIdentifier>
</Filter> </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>
<ItemGroup> <ItemGroup>
<ClCompile Include="Main.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="Systemclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="inputclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="applicationclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="d3dclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="Colorshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="modelclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="Cameraclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="include\imgui_demo.cpp">
<Filter>Fichiers sources\ImGui</Filter>
</ClCompile>
<ClCompile Include="include\backends\imgui_impl_dx11.cpp"> <ClCompile Include="include\backends\imgui_impl_dx11.cpp">
<Filter>Fichiers sources\ImGui</Filter> <Filter>Fichiers sources\ImGui</Filter>
</ClCompile> </ClCompile>
@ -96,140 +84,170 @@
<ClCompile Include="include\imgui_widgets.cpp"> <ClCompile Include="include\imgui_widgets.cpp">
<Filter>Fichiers sources\ImGui</Filter> <Filter>Fichiers sources\ImGui</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="imguiManager.cpp"> <ClCompile Include="include\Src\DDSTextureLoader.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="lightclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="lightshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="object.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="textureclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="bitmapclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="fontclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="fontshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="fpsclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="Spriteclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="Multitextureshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="textclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="textureshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="Timerclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="fpsclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="alphamapshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="specmapshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="frustumclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="modellistclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="positionclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="displayplaneclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="rendertextureclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="translateshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="reflectionshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="shadermanagerclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="transparentshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="lightmapshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="watershaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="refractionshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="physics.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="normalmapshaderclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="CelShadingShader.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DDSTextureLoader.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter> <Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DirectXHelpers.cpp"> <ClCompile Include="include\Src\DirectXHelpers.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter> <Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\pch.cpp"> <ClCompile Include="include\Src\pch.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter> <Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\SimpleMath.cpp"> <ClCompile Include="include\Src\SimpleMath.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter> <Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\WICTextureLoader.cpp"> <ClCompile Include="include\Src\WICTextureLoader.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter> <Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile> </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>
<ClCompile Include="src\src\system\scene_manager.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\stats.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="systemclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="inputclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="applicationclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="d3dclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="Colorshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="modelclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="Cameraclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="include\imconfig.h"> <ClInclude Include="include\imconfig.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter> <Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude> </ClInclude>
@ -254,191 +272,179 @@
<ClInclude Include="include\backends\imgui_impl_win32.h"> <ClInclude Include="include\backends\imgui_impl_win32.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter> <Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="imguiManager.h"> <ClInclude Include="include\Src\CMO.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="lightshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="object.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="textureclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="bitmapclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="fontclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="fontshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="fpsclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="lightclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="Multitextureshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="Spriteclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="textclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="textureshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="Timerclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="fpsclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="lightmapshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="alphamapshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="normalmapshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="specmapshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="frustumclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="modellistclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="positionclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="displayplaneclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="rendertextureclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="translateshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="reflectionshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="resources.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="shadermanagerclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="transparentshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="Logger.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="watershaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="refractionshaderclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="physics.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="CelShadingShader.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\PlatformHelpers.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter> <Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\pch.h"> <ClInclude Include="include\Src\DDS.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter> <Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\LoaderHelpers.h"> <ClInclude Include="include\Src\LoaderHelpers.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter> <Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\DDS.h"> <ClInclude Include="include\Src\pch.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter> <Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="C:\Users\Bacon\Downloads\DirectXTK-main\DirectXTK-main\Src\CMO.h"> <ClInclude Include="include\Src\PlatformHelpers.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter> <Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude> </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>
<ClInclude Include="src\inc\system\scene_manager.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\stats.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="KhaoticIcon.ico"> <Image Include="KhaoticIcon.ico">
<Filter>Assets</Filter> <Filter>Assets</Filter>
</Image> </Image>
<Image Include="assets\Texture\BricksGLOSS2K.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\BricksNRM2K.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\alpha01.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\Bricks2K.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\dirt01.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\font01.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\ground01.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\light01.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\marble01.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\moss01.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\normal01.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\spec02.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\sprite01.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\sprite02.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\sprite03.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\sprite04.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\stone01.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\wall.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\wall01.png">
<Filter>Assets\Texture</Filter>
</Image>
<Image Include="assets\Texture\water01.png">
<Filter>Assets\Texture</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="resources.rc"> <ResourceCompile Include="resources.rc">
@ -446,113 +452,158 @@
</ResourceCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="font.vs">
<Filter>Fonts</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="font.ps">
<Filter>Fonts</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="Color.vs">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="light.ps">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="font01.txt"> <CopyFileToFolders Include="font01.txt">
<Filter>Fonts</Filter> <Filter>Fonts</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="font01.tga"> <CopyFileToFolders Include="font01.tga">
<Filter>fonts</Filter> <Filter>fonts</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="sprite01.tga"> <CopyFileToFolders Include="sprite_data_01.txt">
<Filter>Assets</Filter> <Filter>Assets</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="sprite01.tga">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="sprite02.tga"> <CopyFileToFolders Include="sprite02.tga">
<Filter>Assets</Filter> <Filter>Assets\Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="sprite03.tga"> <CopyFileToFolders Include="sprite03.tga">
<Filter>Assets</Filter> <Filter>Assets\Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="sprite04.tga"> <CopyFileToFolders Include="sprite04.tga">
<Filter>Assets</Filter> <Filter>Assets\Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="Color.ps"> <CopyFileToFolders Include="src\hlsl\alphamap.ps" />
<Filter>shader</Filter> <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>
<CopyFileToFolders Include="light.vs"> <CopyFileToFolders Include="assets\Texture\BricksNRM2K.png">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="lightmap.ps">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="lightmap.vs">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="reflection.ps">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="reflection.vs">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="translate.ps">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="translate.vs">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="transparent.ps">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="transparent.vs">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="Multitexture.ps">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="Multitexture.vs"> <CopyFileToFolders Include="assets\Texture\BricksGLOSS2K.png">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="normalmap.ps"> <CopyFileToFolders Include="assets\Texture\Bricks2K.png">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="normalmap.vs"> <CopyFileToFolders Include="assets\Skybox\skybox.png">
<Filter>Assets\Skybox</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\depth.ps" />
<CopyFileToFolders Include="src\hlsl\depth.vs" />
<CopyFileToFolders Include="assets\Texture\alpha01.png">
<Filter>Fichiers de ressources</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\dirt01.png">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="specmap.ps"> <CopyFileToFolders Include="assets\Texture\EmptyTexture.png">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="specmap.vs"> <CopyFileToFolders Include="assets\Texture\font01.png">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="texture.ps"> <CopyFileToFolders Include="assets\Texture\ground01.png">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="texture.vs"> <CopyFileToFolders Include="assets\Texture\light01.png">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="alphamap.vs"> <CopyFileToFolders Include="assets\Texture\marble01.png">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="alphamap.ps"> <CopyFileToFolders Include="assets\Texture\moss01.png">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="refraction.ps"> <CopyFileToFolders Include="assets\Texture\normal01.png">
<Filter>shader</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="refraction.vs"> <CopyFileToFolders Include="assets\Texture\spec02.png">
<Filter>shader</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="..\KhaoticDemo\water.ps"> <CopyFileToFolders Include="assets\Texture\sprite01.png">
<Filter>shader</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="water.vs"> <CopyFileToFolders Include="assets\Texture\sprite02.png">
<Filter>shader</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="celshading.vs"> <CopyFileToFolders Include="assets\Texture\sprite03.png">
<Filter>shader</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="celshading.ps"> <CopyFileToFolders Include="assets\Texture\sprite04.png">
<Filter>shader</Filter> <Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.tga">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\water01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseautri.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseau.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\plane.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\monke.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\isosphere.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\invertcube.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\cone.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\86.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\bath.txt"> <CopyFileToFolders Include="assets\Model\TXT\bath.txt">
<Filter>Assets\Model\TXT</Filter> <Filter>Assets\Model\TXT</Filter>
@ -581,20 +632,11 @@
<CopyFileToFolders Include="assets\Model\TXT\water.txt"> <CopyFileToFolders Include="assets\Model\TXT\water.txt">
<Filter>Assets\Model\TXT</Filter> <Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseau.obj"> </ItemGroup>
<Filter>Assets\Model\OBJ</Filter> <ItemGroup>
</CopyFileToFolders> <None Include="packages.config" />
<CopyFileToFolders Include="assets\Model\OBJ\monke.obj"> <None Include="assets\Texture\imgui.ini">
<Filter>Assets\Model\OBJ</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </None>
<CopyFileToFolders Include="assets\Model\OBJ\isosphere.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\cone.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\86.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,62 +0,0 @@
#ifndef _FONTSHADERCLASS_H_
#define _FONTSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: FontShaderClass
////////////////////////////////////////////////////////////////////////////////
class FontShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct PixelBufferType
{
XMFLOAT4 pixelColor;
};
public:
FontShaderClass();
FontShaderClass(const FontShaderClass&);
~FontShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11Buffer* m_matrixBuffer;
ID3D11SamplerState* m_sampleState;
ID3D11Buffer* m_pixelBuffer;
};
#endif

View File

@ -1,46 +0,0 @@
#include "fpsclass.h"
FpsClass::FpsClass()
{
}
FpsClass::FpsClass(const FpsClass& other)
{
}
FpsClass::~FpsClass()
{
}
void FpsClass::Initialize()
{
m_fps = 0;
m_count = 0;
m_startTime = timeGetTime();
return;
}
void FpsClass::Frame()
{
m_count++;
if (timeGetTime() >= (m_startTime + 1000))
{
m_fps = m_count;
m_count = 0;
m_startTime = timeGetTime();
}
return;
}
int FpsClass::GetFps()
{
return m_fps;
}

View File

@ -1,24 +1,37 @@
[Window][DockSpace]
Pos=0,0
Size=1584,861
Collapsed=0
[Window][Debug##Default] [Window][Debug##Default]
Pos=60,60 Pos=60,60
Size=400,400 Size=400,400
Collapsed=0
[Window][Khaotic Engine] [Window][Khaotic Engine]
Pos=1128,39 Pos=1267,19
Size=392,273 Size=317,842
Collapsed=0
DockId=0x00000002,0
[Window][render Stats]
Pos=275,630
Size=1309,231
Collapsed=0
DockId=0x00000004,0
[Window][Objects] [Window][Objects]
Pos=934,36 Pos=0,19
Size=457,294 Size=273,842
Collapsed=0
DockId=0x00000005,0
[Window][Terrain] [Docking][Data]
Pos=60,60 DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=X
Size=342,82 DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=273,842 Selected=0x031DC75C
DockNode ID=0x00000006 Parent=0xCCBD8CF7 SizeRef=1309,842 Split=Y
[Window][Light] DockNode ID=0x00000003 Parent=0x00000006 SizeRef=1584,609 Split=X
Pos=1551,17 DockNode ID=0x00000001 Parent=0x00000003 SizeRef=990,842 CentralNode=1
Size=358,535 DockNode ID=0x00000002 Parent=0x00000003 SizeRef=317,842 Selected=0x9F035453
DockNode ID=0x00000004 Parent=0x00000006 SizeRef=1584,231 Selected=0xF5D1BB37
[Window][Shader Manager]
Pos=34,253
Size=172,284

View File

@ -1,381 +0,0 @@
#include "imguiManager.h"
#include "applicationclass.h"
#include <string>
imguiManager::imguiManager()
{
io = nullptr;
}
imguiManager::~imguiManager()
{
}
bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext)
{
Logger::Get().Log("Initializing imgui", __FILE__, __LINE__, Logger::LogLevel::Initialize);
m_device = device;
m_deviceContext = deviceContext;
IMGUI_CHECKVERSION();
ImGui::CreateContext();
io = &ImGui::GetIO();
ImGui_ImplWin32_Init(hwnd);
ImGui_ImplDX11_Init(m_device, m_deviceContext);
ImGui::StyleColorsDark();
Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true;
}
void imguiManager::Shutdown()
{
Logger::Get().Log("Shutting down imgui", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
ImGui_ImplDX11_Shutdown();
ImGui_ImplWin32_Shutdown();
ImGui::DestroyContext();
Logger::Get().Log("imgui shutdown", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
}
void imguiManager::Render()
{
ImGui::Render();
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
}
void imguiManager::NewFrame()
{
ImGui_ImplDX11_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
}
void imguiManager::WidgetSpeedSlider(float* speed)
{
ImGui::SliderFloat("Speed", speed, 0.0f, 100.0f);
}
void imguiManager::WidgetButton()
{
static int counter = 0;
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d", counter);
}
void imguiManager::WidgetFPS()
{
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io->Framerate, io->Framerate);
}
void imguiManager::WidgetAddObject(ApplicationClass* app)
{
if (ImGui::CollapsingHeader("Objects"))
{
if (ImGui::Button("Add Cube"))
{
app->AddCube();
}
ImGui::SameLine();
if (ImGui::Button("Import Object"))
{
// Open file dialog
OPENFILENAME ofn;
WCHAR szFile[260];
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"TXT\0*.txt\0KOBJ\0*.kobj\0*OBJ\0*.obj";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn))
{
app->AddKobject(ofn.lpstrFile);
}
}
ImGui::SameLine();
ImGui::Text("Number of cubes: %d", app->GetCubeCount());
}
}
void imguiManager::WidgetShaderWindow(ApplicationClass* app)
{
ImGui::Begin("Shader Manager");
// Checkbox for toggling cel shading globally in the application class by calling the SetCelShading function in the application class when the checkbox state changes
ImGui::Checkbox("Enable Cel Shading", &m_EnableCelShading);
app->SetCelShading(m_EnableCelShading);
ImGui::End();
}
void imguiManager::WidgetObjectWindow(ApplicationClass* app)
{
ImGui::Begin("Objects", &showObjectWindow);
int index = 0;
for (auto& object : app->GetKobjects())
{
std::string headerName = object->GetName() + " " + std::to_string(index);
if (ImGui::CollapsingHeader(headerName.c_str()))
{
XMVECTOR position = object->GetPosition();
XMVECTOR rotation = object->GetRotation();
XMVECTOR scale = object->GetScale();
float pos[3] = { XMVectorGetX(position), XMVectorGetY(position), XMVectorGetZ(position) };
std::string posLabel = "Position##" + std::to_string(index);
if (ImGui::DragFloat3(posLabel.c_str(), pos))
{
object->SetPosition(XMVectorSet(pos[0], pos[1], pos[2], 0.0f));
}
float rot[3] = { XMVectorGetX(rotation), XMVectorGetY(rotation), XMVectorGetZ(rotation) };
std::string rotLabel = "Rotation##" + std::to_string(index);
if (ImGui::DragFloat3(rotLabel.c_str(), rot))
{
object->SetRotation(XMVectorSet(rot[0], rot[1], rot[2], 0.0f));
}
float scl[3] = { XMVectorGetX(scale), XMVectorGetY(scale), XMVectorGetZ(scale) };
std::string sclLabel = "Scale##" + std::to_string(index);
if (ImGui::DragFloat3(sclLabel.c_str(), scl))
{
object->SetScale(XMVectorSet(scl[0], scl[1], scl[2], 0.0f));
}
ImGui::Separator();
// Texture
// add all texture category names to a vector
std::vector<std::string> textureCategories = { "Diffuse", "Normal", "Specular", "Alpha", "Light", "Change Me" };
for (int count = 0; count < 6; count++)
{
std::string textureLabel = "Texture##" + std::to_string(index);
ID3D11ShaderResourceView* texture = object->GetTexture(count);
if (texture != nullptr)
{
// Set the cursor position
ImGui::SetCursorPosX(count * (64 + 20) + 10); // 64 is the width of the image, 10 is the spacing
// Display the texture name
std::string textureName = textureCategories[count];
ImGui::Text(textureName.c_str());
if(count < 5)
{
ImGui::SameLine();
}
}
}
// Display all images
for (int count = 0; count < 6; count++)
{
std::string textureLabel = "Texture##" + std::to_string(index);
ID3D11ShaderResourceView* texture = object->GetTexture(count);
if (texture != nullptr)
{
// Set the cursor position
ImGui::SetCursorPosX(count * (64 + 20) + 10); // 64 is the width of the image, 10 is the spacing
if (ImGui::ImageButton((ImTextureID)texture, ImVec2(64, 64)))
{
// Open file dialog
OPENFILENAME ofn;
WCHAR szFile[260];
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"Texture\0*.png\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn))
{
// Load the selected texture
object->ChangeTexture(m_device, m_deviceContext, ofn.lpstrFile, index);
}
}
if (ImGui::IsItemHovered())
{
ImGui::BeginTooltip();
ImGui::Image((ImTextureID)texture, ImVec2(256, 256));
ImGui::EndTooltip();
}
// If this is not the last texture, put the next button on the same line
if (count < 5)
{
ImGui::SameLine();
}
}
}
ImGui::Separator();
// Delete button
std::string deleteLabel = "Delete##" + std::to_string(index);
if (ImGui::Button(deleteLabel.c_str()))
{
app->DeleteKobject(index);
}
ImGui::Separator();
// Demo spinning
std::string demoLabel = "Demo spinning##" + std::to_string(index);
ImGui::Checkbox(demoLabel.c_str(), &object->m_demoSpinning);
}
index++;
}
ImGui::End();
}
void imguiManager::WidgetTerrainWindow(ApplicationClass* app)
{
ImGui::Begin("Terrain", &showTerrainWindow);
ImGui::Text("Number of terrain cubes: %d", app->GetTerrainCubeCount());
ImGui::Separator();
if (ImGui::Button("Generate Terrain"))
{
app->GenerateTerrain();
}
ImGui::SameLine();
if (ImGui::Button("Delete All Terrain Cubes"))
{
app->DeleteTerrain();
}
ImGui::End();
}
bool imguiManager::ImGuiWidgetRenderer(ApplicationClass* app)
{
// Start the Dear ImGui frame
NewFrame();
//ImGui Widget
ImGui::Begin("Khaotic Engine", NULL);
float speed = app->GetSpeed();
WidgetSpeedSlider(&speed);
app->SetSpeed(speed);
WidgetButton();
WidgetFPS();
WidgetAddObject(app);
ImGui::Separator();
// Add buttons for opening windows
if (ImGui::Button("Open Object Window"))
{
showObjectWindow = true;
}
if (ImGui::Button("Open Terrain Window"))
{
showTerrainWindow = true;
}
if (ImGui::Button("Open Light Window"))
{
showLightWindow = true;
}
if (ImGui::Button("Open Shader Window"))
{
showShaderWindow = true;
}
ImGui::End();
// Show windows if their corresponding variables are true
if (showObjectWindow)
{
WidgetObjectWindow(app);
}
if (showTerrainWindow)
{
WidgetTerrainWindow(app);
}
if (showLightWindow)
{
WidgetLightWindow(app);
}
if (showShaderWindow)
{
WidgetShaderWindow(app);
}
//render imgui
Render();
return true;
}
void imguiManager::WidgetLightWindow(ApplicationClass* app)
{
ImGui::Begin("Light", &showLightWindow);
int index = 0;
for(auto& light : app->GetLights())
{
std::string headerName = "Light " + std::to_string(index);
if (ImGui::CollapsingHeader(headerName.c_str()))
{
XMVECTOR position = app->GetLightPosition(index);
XMVECTOR color = app->GetLightColor(index);
float pos[3] = { XMVectorGetX(position), XMVectorGetY(position), XMVectorGetZ(position) };
float col[3] = { XMVectorGetX(color), XMVectorGetY(color), XMVectorGetZ(color) };
std::string posLabel = "Position##" + std::to_string(index);
std::string colLabel = "Color##" + std::to_string(index);
if (ImGui::DragFloat3(posLabel.c_str(), pos))
{
app->SetLightPosition(index, XMVectorSet(pos[0], pos[1], pos[2], 0.0f));
}
if (ImGui::ColorEdit3(colLabel.c_str(), col))
{
app->SetLightColor(index, XMVectorSet(col[0], col[1], col[2], 0.0f));
}
}
index++;
};
ImGui::End();
}

View File

@ -1,56 +0,0 @@
#pragma once
#ifndef _IMGUI_MANAGER_H_
#define _IMGUI_MANAGER_H_
#include "Logger.h"
#include <imgui.h>
#include <imgui_impl_dx11.h>
#include <imgui_impl_win32.h>
#include <windows.h>
class ApplicationClass;
class imguiManager
{
public:
imguiManager();
~imguiManager();
bool Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext);
void Shutdown();
void Render();
void NewFrame();
// Widgets
void WidgetSpeedSlider(float* speed);
void WidgetButton();
void WidgetFPS();
void WidgetAddObject(ApplicationClass* app);
void WidgetObjectWindow(ApplicationClass* app);
void WidgetTerrainWindow(ApplicationClass* app);
void WidgetLightWindow(ApplicationClass* app);
void WidgetShaderWindow(ApplicationClass* app);
bool ImGuiWidgetRenderer(ApplicationClass* app);
// Shader toggles
bool m_EnableCelShading;
private :
bool showObjectWindow = false;
bool showTerrainWindow = false;
bool showLightWindow = false;
bool showShaderWindow = false;
private:
ImGuiIO* io;
ID3D11Device* m_device;
ID3D11DeviceContext* m_deviceContext;
};
#endif

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_ */

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");

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"

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: */

View File

@ -0,0 +1,570 @@
/*
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_config_h_
#define SDL_config_h_
/**
* \file SDL_config.h.in
*
* This is a set of defines to configure the SDL features
*/
/* General platform specific identifiers */
#include "SDL_platform.h"
/* C language features */
/* #undef const */
/* #undef inline */
/* #undef volatile */
/* C datatypes */
/* Define SIZEOF_VOIDP for 64/32 architectures */
#if defined(__LP64__) || defined(_LP64) || defined(_WIN64)
#define SIZEOF_VOIDP 8
#else
#define SIZEOF_VOIDP 4
#endif
/* #undef HAVE_GCC_ATOMICS */
/* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */
/* Comment this if you want to build without any C library requirements */
/* #undef HAVE_LIBC */
#ifdef HAVE_LIBC
/* Useful headers */
/* #undef STDC_HEADERS */
/* #undef HAVE_ALLOCA_H */
/* #undef HAVE_CTYPE_H */
/* #undef HAVE_FLOAT_H */
/* #undef HAVE_ICONV_H */
/* #undef HAVE_INTTYPES_H */
/* #undef HAVE_LIMITS_H */
/* #undef HAVE_MALLOC_H */
/* #undef HAVE_MATH_H */
/* #undef HAVE_MEMORY_H */
/* #undef HAVE_SIGNAL_H */
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
/* #undef HAVE_STDIO_H */
/* #undef HAVE_STDLIB_H */
/* #undef HAVE_STRINGS_H */
/* #undef HAVE_STRING_H */
/* #undef HAVE_SYS_TYPES_H */
/* #undef HAVE_WCHAR_H */
/* #undef HAVE_LINUX_INPUT_H */
/* #undef HAVE_PTHREAD_NP_H */
/* #undef HAVE_LIBUNWIND_H */
/* C library functions */
/* #undef HAVE_DLOPEN */
/* #undef HAVE_MALLOC */
/* #undef HAVE_CALLOC */
/* #undef HAVE_REALLOC */
/* #undef HAVE_FREE */
/* #undef HAVE_ALLOCA */
#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
/* #undef HAVE_GETENV */
/* #undef HAVE_SETENV */
/* #undef HAVE_PUTENV */
/* #undef HAVE_UNSETENV */
#endif
/* #undef HAVE_QSORT */
/* #undef HAVE_BSEARCH */
/* #undef HAVE_ABS */
/* #undef HAVE_BCOPY */
/* #undef HAVE_MEMSET */
/* #undef HAVE_MEMCPY */
/* #undef HAVE_MEMMOVE */
/* #undef HAVE_MEMCMP */
/* #undef HAVE_WCSLEN */
/* #undef HAVE_WCSLCPY */
/* #undef HAVE_WCSLCAT */
/* #undef HAVE__WCSDUP */
/* #undef HAVE_WCSDUP */
/* #undef HAVE_WCSSTR */
/* #undef HAVE_WCSCMP */
/* #undef HAVE_WCSNCMP */
/* #undef HAVE_WCSCASECMP */
/* #undef HAVE__WCSICMP */
/* #undef HAVE_WCSNCASECMP */
/* #undef HAVE__WCSNICMP */
/* #undef HAVE_STRLEN */
/* #undef HAVE_STRLCPY */
/* #undef HAVE_STRLCAT */
/* #undef HAVE__STRREV */
/* #undef HAVE__STRUPR */
/* #undef HAVE__STRLWR */
/* #undef HAVE_INDEX */
/* #undef HAVE_RINDEX */
/* #undef HAVE_STRCHR */
/* #undef HAVE_STRRCHR */
/* #undef HAVE_STRSTR */
/* #undef HAVE_STRTOK_R */
/* #undef HAVE_ITOA */
/* #undef HAVE__LTOA */
/* #undef HAVE__UITOA */
/* #undef HAVE__ULTOA */
/* #undef HAVE_STRTOL */
/* #undef HAVE_STRTOUL */
/* #undef HAVE__I64TOA */
/* #undef HAVE__UI64TOA */
/* #undef HAVE_STRTOLL */
/* #undef HAVE_STRTOULL */
/* #undef HAVE_STRTOD */
/* #undef HAVE_ATOI */
/* #undef HAVE_ATOF */
/* #undef HAVE_STRCMP */
/* #undef HAVE_STRNCMP */
/* #undef HAVE__STRICMP */
/* #undef HAVE_STRCASECMP */
/* #undef HAVE__STRNICMP */
/* #undef HAVE_STRNCASECMP */
/* #undef HAVE_STRCASESTR */
/* #undef HAVE_SSCANF */
/* #undef HAVE_VSSCANF */
/* #undef HAVE_VSNPRINTF */
/* #undef HAVE_M_PI */
/* #undef HAVE_ACOS */
/* #undef HAVE_ACOSF */
/* #undef HAVE_ASIN */
/* #undef HAVE_ASINF */
/* #undef HAVE_ATAN */
/* #undef HAVE_ATANF */
/* #undef HAVE_ATAN2 */
/* #undef HAVE_ATAN2F */
/* #undef HAVE_CEIL */
/* #undef HAVE_CEILF */
/* #undef HAVE_COPYSIGN */
/* #undef HAVE_COPYSIGNF */
/* #undef HAVE_COS */
/* #undef HAVE_COSF */
/* #undef HAVE_EXP */
/* #undef HAVE_EXPF */
/* #undef HAVE_FABS */
/* #undef HAVE_FABSF */
/* #undef HAVE_FLOOR */
/* #undef HAVE_FLOORF */
/* #undef HAVE_FMOD */
/* #undef HAVE_FMODF */
/* #undef HAVE_LOG */
/* #undef HAVE_LOGF */
/* #undef HAVE_LOG10 */
/* #undef HAVE_LOG10F */
/* #undef HAVE_LROUND */
/* #undef HAVE_LROUNDF */
/* #undef HAVE_POW */
/* #undef HAVE_POWF */
/* #undef HAVE_ROUND */
/* #undef HAVE_ROUNDF */
/* #undef HAVE_SCALBN */
/* #undef HAVE_SCALBNF */
/* #undef HAVE_SIN */
/* #undef HAVE_SINF */
/* #undef HAVE_SQRT */
/* #undef HAVE_SQRTF */
/* #undef HAVE_TAN */
/* #undef HAVE_TANF */
/* #undef HAVE_TRUNC */
/* #undef HAVE_TRUNCF */
/* #undef HAVE_FOPEN64 */
/* #undef HAVE_FSEEKO */
/* #undef HAVE_FSEEKO64 */
/* #undef HAVE_MEMFD_CREATE */
/* #undef HAVE_POSIX_FALLOCATE */
/* #undef HAVE_SIGACTION */
/* #undef HAVE_SA_SIGACTION */
/* #undef HAVE_SETJMP */
/* #undef HAVE_NANOSLEEP */
/* #undef HAVE_SYSCONF */
/* #undef HAVE_SYSCTLBYNAME */
/* #undef HAVE_CLOCK_GETTIME */
/* #undef HAVE_GETPAGESIZE */
/* #undef HAVE_MPROTECT */
/* #undef HAVE_ICONV */
/* #undef SDL_USE_LIBICONV */
/* #undef HAVE_PTHREAD_SETNAME_NP */
/* #undef HAVE_PTHREAD_SET_NAME_NP */
/* #undef HAVE_SEM_TIMEDWAIT */
/* #undef HAVE_GETAUXVAL */
/* #undef HAVE_ELF_AUX_INFO */
/* #undef HAVE_POLL */
/* #undef HAVE__EXIT */
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
/* #undef HAVE_FLOAT_H */
#endif /* HAVE_LIBC */
/* #undef HAVE_ALTIVEC_H */
/* #undef HAVE_DBUS_DBUS_H */
/* #undef HAVE_FCITX */
/* #undef HAVE_IBUS_IBUS_H */
/* #undef HAVE_SYS_INOTIFY_H */
/* #undef HAVE_INOTIFY_INIT */
/* #undef HAVE_INOTIFY_INIT1 */
/* #undef HAVE_INOTIFY */
/* #undef HAVE_LIBUSB */
/* #undef HAVE_O_CLOEXEC */
/* Apple platforms might be building universal binaries, where Intel builds
can use immintrin.h but other architectures can't. */
#ifdef __APPLE__
# if defined(__has_include) && (defined(__i386__) || defined(__x86_64))
# if __has_include(<immintrin.h>)
# define HAVE_IMMINTRIN_H 1
# endif
# endif
#else /* non-Apple platforms can use the normal CMake check for this. */
#define HAVE_IMMINTRIN_H 1
#endif
/* #undef HAVE_LIBUDEV_H */
/* #undef HAVE_LIBSAMPLERATE_H */
/* #undef HAVE_LIBDECOR_H */
#define HAVE_D3D_H 1
#define HAVE_D3D11_H 1
#define HAVE_D3D12_H 1
#define HAVE_DDRAW_H 1
#define HAVE_DSOUND_H 1
#define HAVE_DINPUT_H 1
#define HAVE_XINPUT_H 1
#define HAVE_WINDOWS_GAMING_INPUT_H 1
#define HAVE_DXGI_H 1
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
#define HAVE_TPCSHRD_H 1
#define HAVE_SENSORSAPI_H 1
#define HAVE_ROAPI_H 1
#define HAVE_SHELLSCALINGAPI_H 1
/* #undef USE_POSIX_SPAWN */
/* SDL internal assertion support */
#if 0
/* #undef SDL_DEFAULT_ASSERT_LEVEL */
#endif
/* Allow disabling of core subsystems */
/* #undef SDL_ATOMIC_DISABLED */
/* #undef SDL_AUDIO_DISABLED */
/* #undef SDL_CPUINFO_DISABLED */
/* #undef SDL_EVENTS_DISABLED */
/* #undef SDL_FILE_DISABLED */
/* #undef SDL_JOYSTICK_DISABLED */
/* #undef SDL_HAPTIC_DISABLED */
/* #undef SDL_HIDAPI_DISABLED */
/* #undef SDL_SENSOR_DISABLED */
/* #undef SDL_LOADSO_DISABLED */
/* #undef SDL_RENDER_DISABLED */
/* #undef SDL_THREADS_DISABLED */
/* #undef SDL_TIMERS_DISABLED */
/* #undef SDL_VIDEO_DISABLED */
/* #undef SDL_POWER_DISABLED */
/* #undef SDL_FILESYSTEM_DISABLED */
/* #undef SDL_LOCALE_DISABLED */
/* #undef SDL_MISC_DISABLED */
/* Enable various audio drivers */
/* #undef SDL_AUDIO_DRIVER_ALSA */
/* #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_ANDROID */
/* #undef SDL_AUDIO_DRIVER_OPENSLES */
/* #undef SDL_AUDIO_DRIVER_AAUDIO */
/* #undef SDL_AUDIO_DRIVER_ARTS */
/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_COREAUDIO */
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* #undef SDL_AUDIO_DRIVER_EMSCRIPTEN */
/* #undef SDL_AUDIO_DRIVER_ESD */
/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */
/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_HAIKU */
/* #undef SDL_AUDIO_DRIVER_JACK */
/* #undef SDL_AUDIO_DRIVER_JACK_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_NAS */
/* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_NETBSD */
/* #undef SDL_AUDIO_DRIVER_OSS */
/* #undef SDL_AUDIO_DRIVER_PAUDIO */
/* #undef SDL_AUDIO_DRIVER_PIPEWIRE */
/* #undef SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */
/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_QSA */
/* #undef SDL_AUDIO_DRIVER_SNDIO */
/* #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */
/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */
#define SDL_AUDIO_DRIVER_WASAPI 1
#define SDL_AUDIO_DRIVER_WINMM 1
/* #undef SDL_AUDIO_DRIVER_OS2 */
/* #undef SDL_AUDIO_DRIVER_VITA */
/* #undef SDL_AUDIO_DRIVER_PSP */
/* #undef SDL_AUDIO_DRIVER_PS2 */
/* #undef SDL_AUDIO_DRIVER_N3DS */
/* Enable various input drivers */
/* #undef SDL_INPUT_LINUXEV */
/* #undef SDL_INPUT_LINUXKD */
/* #undef SDL_INPUT_FBSDKBIO */
/* #undef SDL_INPUT_WSCONS */
/* #undef SDL_JOYSTICK_ANDROID */
/* #undef SDL_JOYSTICK_HAIKU */
#define SDL_JOYSTICK_WGI 1
#define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_XINPUT 1
/* #undef SDL_JOYSTICK_DUMMY */
/* #undef SDL_JOYSTICK_IOKIT */
/* #undef SDL_JOYSTICK_MFI */
/* #undef SDL_JOYSTICK_LINUX */
/* #undef SDL_JOYSTICK_OS2 */
/* #undef SDL_JOYSTICK_USBHID */
/* #undef SDL_HAVE_MACHINE_JOYSTICK_H */
#define SDL_JOYSTICK_HIDAPI 1
#define SDL_JOYSTICK_RAWINPUT 1
/* #undef SDL_JOYSTICK_EMSCRIPTEN */
#define SDL_JOYSTICK_VIRTUAL 1
/* #undef SDL_JOYSTICK_VITA */
/* #undef SDL_JOYSTICK_PSP */
/* #undef SDL_JOYSTICK_PS2 */
/* #undef SDL_JOYSTICK_N3DS */
/* #undef SDL_HAPTIC_DUMMY */
/* #undef SDL_HAPTIC_LINUX */
/* #undef SDL_HAPTIC_IOKIT */
#define SDL_HAPTIC_DINPUT 1
#define SDL_HAPTIC_XINPUT 1
/* #undef SDL_HAPTIC_ANDROID */
/* #undef SDL_LIBUSB_DYNAMIC */
/* #undef SDL_UDEV_DYNAMIC */
/* Enable various sensor drivers */
/* #undef SDL_SENSOR_ANDROID */
/* #undef SDL_SENSOR_COREMOTION */
#define SDL_SENSOR_WINDOWS 1
/* #undef SDL_SENSOR_DUMMY */
/* #undef SDL_SENSOR_VITA */
/* #undef SDL_SENSOR_N3DS */
/* Enable various shared object loading systems */
/* #undef SDL_LOADSO_DLOPEN */
/* #undef SDL_LOADSO_DUMMY */
/* #undef SDL_LOADSO_LDG */
#define SDL_LOADSO_WINDOWS 1
/* #undef SDL_LOADSO_OS2 */
/* Enable various threading systems */
#define SDL_THREAD_GENERIC_COND_SUFFIX 1
/* #undef SDL_THREAD_PTHREAD */
/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX */
/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */
#define SDL_THREAD_WINDOWS 1
/* #undef SDL_THREAD_OS2 */
/* #undef SDL_THREAD_VITA */
/* #undef SDL_THREAD_PSP */
/* #undef SDL_THREAD_PS2 */
/* #undef SDL_THREAD_N3DS */
/* Enable various timer systems */
/* #undef SDL_TIMER_HAIKU */
/* #undef SDL_TIMER_DUMMY */
/* #undef SDL_TIMER_UNIX */
#define SDL_TIMER_WINDOWS 1
/* #undef SDL_TIMER_OS2 */
/* #undef SDL_TIMER_VITA */
/* #undef SDL_TIMER_PSP */
/* #undef SDL_TIMER_PS2 */
/* #undef SDL_TIMER_N3DS */
/* Enable various video drivers */
/* #undef SDL_VIDEO_DRIVER_ANDROID */
/* #undef SDL_VIDEO_DRIVER_EMSCRIPTEN */
/* #undef SDL_VIDEO_DRIVER_HAIKU */
/* #undef SDL_VIDEO_DRIVER_COCOA */
/* #undef SDL_VIDEO_DRIVER_UIKIT */
/* #undef SDL_VIDEO_DRIVER_DIRECTFB */
/* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_OFFSCREEN 1
#define SDL_VIDEO_DRIVER_WINDOWS 1
/* #undef SDL_VIDEO_DRIVER_WINRT */
/* #undef SDL_VIDEO_DRIVER_WAYLAND */
/* #undef SDL_VIDEO_DRIVER_RPI */
/* #undef SDL_VIDEO_DRIVER_VIVANTE */
/* #undef SDL_VIDEO_DRIVER_VIVANTE_VDK */
/* #undef SDL_VIDEO_DRIVER_OS2 */
/* #undef SDL_VIDEO_DRIVER_QNX */
/* #undef SDL_VIDEO_DRIVER_RISCOS */
/* #undef SDL_VIDEO_DRIVER_PSP */
/* #undef SDL_VIDEO_DRIVER_PS2 */
/* #undef SDL_VIDEO_DRIVER_KMSDRM */
/* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC */
/* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM */
/* #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL */
/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR */
/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON */
/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR */
/* #undef SDL_VIDEO_DRIVER_X11 */
/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC */
/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT */
/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR */
/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 */
/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES */
/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR */
/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS */
/* #undef SDL_VIDEO_DRIVER_X11_XCURSOR */
/* #undef SDL_VIDEO_DRIVER_X11_XDBE */
/* #undef SDL_VIDEO_DRIVER_X11_XINPUT2 */
/* #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */
/* #undef SDL_VIDEO_DRIVER_X11_XFIXES */
/* #undef SDL_VIDEO_DRIVER_X11_XRANDR */
/* #undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER */
/* #undef SDL_VIDEO_DRIVER_X11_XSHAPE */
/* #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */
/* #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM */
/* #undef SDL_VIDEO_DRIVER_VITA */
/* #undef SDL_VIDEO_DRIVER_N3DS */
#define SDL_VIDEO_RENDER_D3D 1
#define SDL_VIDEO_RENDER_D3D11 1
#define SDL_VIDEO_RENDER_D3D12 1
#define SDL_VIDEO_RENDER_OGL 1
/* #undef SDL_VIDEO_RENDER_OGL_ES */
#define SDL_VIDEO_RENDER_OGL_ES2 1
/* #undef SDL_VIDEO_RENDER_DIRECTFB */
/* #undef SDL_VIDEO_RENDER_METAL */
/* #undef SDL_VIDEO_RENDER_VITA_GXM */
/* #undef SDL_VIDEO_RENDER_PS2 */
/* #undef SDL_VIDEO_RENDER_PSP */
/* Enable OpenGL support */
#define SDL_VIDEO_OPENGL 1
/* #undef SDL_VIDEO_OPENGL_ES */
#define SDL_VIDEO_OPENGL_ES2 1
/* #undef SDL_VIDEO_OPENGL_BGL */
/* #undef SDL_VIDEO_OPENGL_CGL */
/* #undef SDL_VIDEO_OPENGL_GLX */
#define SDL_VIDEO_OPENGL_WGL 1
#define SDL_VIDEO_OPENGL_EGL 1
/* #undef SDL_VIDEO_OPENGL_OSMESA */
/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
/* Enable Vulkan support */
#define SDL_VIDEO_VULKAN 1
/* Enable Metal support */
/* #undef SDL_VIDEO_METAL */
/* Enable system power support */
/* #undef SDL_POWER_ANDROID */
/* #undef SDL_POWER_LINUX */
#define SDL_POWER_WINDOWS 1
/* #undef SDL_POWER_WINRT */
/* #undef SDL_POWER_MACOSX */
/* #undef SDL_POWER_UIKIT */
/* #undef SDL_POWER_HAIKU */
/* #undef SDL_POWER_EMSCRIPTEN */
/* #undef SDL_POWER_HARDWIRED */
/* #undef SDL_POWER_VITA */
/* #undef SDL_POWER_PSP */
/* #undef SDL_POWER_N3DS */
/* Enable system filesystem support */
/* #undef SDL_FILESYSTEM_ANDROID */
/* #undef SDL_FILESYSTEM_HAIKU */
/* #undef SDL_FILESYSTEM_COCOA */
/* #undef SDL_FILESYSTEM_DUMMY */
/* #undef SDL_FILESYSTEM_RISCOS */
/* #undef SDL_FILESYSTEM_UNIX */
#define SDL_FILESYSTEM_WINDOWS 1
/* #undef SDL_FILESYSTEM_EMSCRIPTEN */
/* #undef SDL_FILESYSTEM_OS2 */
/* #undef SDL_FILESYSTEM_VITA */
/* #undef SDL_FILESYSTEM_PSP */
/* #undef SDL_FILESYSTEM_PS2 */
/* #undef SDL_FILESYSTEM_N3DS */
/* Enable misc subsystem */
/* #undef SDL_MISC_DUMMY */
/* Enable locale subsystem */
/* #undef SDL_LOCALE_DUMMY */
/* Enable assembly routines */
/* #undef SDL_ALTIVEC_BLITTERS */
/* #undef SDL_ARM_SIMD_BLITTERS */
/* #undef SDL_ARM_NEON_BLITTERS */
/* Whether SDL_DYNAMIC_API needs dlopen */
/* #undef DYNAPI_NEEDS_DLOPEN */
/* Enable dynamic libsamplerate support */
/* #undef SDL_LIBSAMPLERATE_DYNAMIC */
/* Enable ime support */
/* #undef SDL_USE_IME */
/* Platform specific definitions */
/* #undef SDL_IPHONE_KEYBOARD */
/* #undef SDL_IPHONE_LAUNCHSCREEN */
/* #undef SDL_VIDEO_VITA_PIB */
/* #undef SDL_VIDEO_VITA_PVR */
/* #undef SDL_VIDEO_VITA_PVR_OGL */
/* #undef SDL_HAVE_LIBDECOR_GET_MIN_MAX */
#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_)
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#endif /* Visual Studio 2008 */
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#endif /* SDL_config_h_ */

View File

@ -0,0 +1,20 @@
/*
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.
*/

View File

@ -0,0 +1,602 @@
/*
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.
*/
/* WIKI CATEGORY: CPUInfo */
/**
* # CategoryCPUInfo
*
* CPU feature detection for SDL.
*
* These functions are largely concerned with reporting if the system has
* access to various SIMD instruction sets, but also has other important info
* to share, such as number of logical CPU cores.
*/
#ifndef SDL_cpuinfo_h_
#define SDL_cpuinfo_h_
#include "SDL_stdinc.h"
/* Need to do this here because intrin.h has C++ code in it */
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
#ifdef __clang__
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
#ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_m_prefetch(void *__P)
{
__builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */);
}
#endif /* __PRFCHWINTRIN_H */
#endif /* __clang__ */
#include <intrin.h>
#ifndef _WIN64
#ifndef __MMX__
#define __MMX__
#endif
/*
#ifndef __3dNOW__
#define __3dNOW__
#endif
*/
#endif
#ifndef __SSE__
#define __SSE__
#endif
#ifndef __SSE2__
#define __SSE2__
#endif
#ifndef __SSE3__
#define __SSE3__
#endif
#elif defined(__MINGW64_VERSION_MAJOR)
#include <intrin.h>
#if !defined(SDL_DISABLE_ARM_NEON_H) && defined(__ARM_NEON)
# include <arm_neon.h>
#endif
#else
/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */
#if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H)
#include <altivec.h>
#endif
#if !defined(SDL_DISABLE_ARM_NEON_H)
# if defined(__ARM_NEON)
# include <arm_neon.h>
# elif defined(__WINDOWS__) || defined(__WINRT__) || defined(__GDK__)
/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
# if defined(_M_ARM)
# include <armintr.h>
# include <arm_neon.h>
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
# endif
# if defined (_M_ARM64)
# include <arm64intr.h>
# include <arm64_neon.h>
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
# define __ARM_ARCH 8
# endif
# endif
#endif
#endif /* compiler version */
#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H)
#include <mm3dnow.h>
#endif
#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H)
#include <lsxintrin.h>
#define __LSX__
#endif
#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX_H)
#include <lasxintrin.h>
#define __LASX__
#endif
#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
#include <immintrin.h>
#else
#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
#include <mmintrin.h>
#endif
#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
#include <xmmintrin.h>
#endif
#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
#include <emmintrin.h>
#endif
#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
#include <pmmintrin.h>
#endif
#endif /* HAVE_IMMINTRIN_H */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* This is a guess for the cacheline size used for padding.
* Most x86 processors have a 64 byte cache line.
* The 64-bit PowerPC processors have a 128 byte cache line.
* We'll use the larger value to be generally safe.
*/
#define SDL_CACHELINE_SIZE 128
/**
* Get the number of CPU cores available.
*
* \returns the total number of logical CPU cores. On CPUs that include
* technologies such as hyperthreading, the number of logical cores
* may be more than the number of physical cores.
*
* \since This function is available since SDL 2.0.0.
*/
extern DECLSPEC int SDLCALL SDL_GetCPUCount(void);
/**
* Determine the L1 cache line size of the CPU.
*
* This is useful for determining multi-threaded structure padding or SIMD
* prefetch sizes.
*
* \returns the L1 cache line size of the CPU, in bytes.
*
* \since This function is available since SDL 2.0.0.
*/
extern DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void);
/**
* Determine whether the CPU has the RDTSC instruction.
*
* This always returns false on CPUs that aren't using Intel instruction sets.
*
* \returns SDL_TRUE if the CPU has the RDTSC instruction or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_Has3DNow
* \sa SDL_HasAltiVec
* \sa SDL_HasAVX
* \sa SDL_HasAVX2
* \sa SDL_HasMMX
* \sa SDL_HasSSE
* \sa SDL_HasSSE2
* \sa SDL_HasSSE3
* \sa SDL_HasSSE41
* \sa SDL_HasSSE42
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
/**
* Determine whether the CPU has AltiVec features.
*
* This always returns false on CPUs that aren't using PowerPC instruction
* sets.
*
* \returns SDL_TRUE if the CPU has AltiVec features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_Has3DNow
* \sa SDL_HasAVX
* \sa SDL_HasAVX2
* \sa SDL_HasMMX
* \sa SDL_HasRDTSC
* \sa SDL_HasSSE
* \sa SDL_HasSSE2
* \sa SDL_HasSSE3
* \sa SDL_HasSSE41
* \sa SDL_HasSSE42
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
/**
* Determine whether the CPU has MMX features.
*
* This always returns false on CPUs that aren't using Intel instruction sets.
*
* \returns SDL_TRUE if the CPU has MMX features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_Has3DNow
* \sa SDL_HasAltiVec
* \sa SDL_HasAVX
* \sa SDL_HasAVX2
* \sa SDL_HasRDTSC
* \sa SDL_HasSSE
* \sa SDL_HasSSE2
* \sa SDL_HasSSE3
* \sa SDL_HasSSE41
* \sa SDL_HasSSE42
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
/**
* Determine whether the CPU has 3DNow! features.
*
* This always returns false on CPUs that aren't using AMD instruction sets.
*
* \returns SDL_TRUE if the CPU has 3DNow! features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_HasAltiVec
* \sa SDL_HasAVX
* \sa SDL_HasAVX2
* \sa SDL_HasMMX
* \sa SDL_HasRDTSC
* \sa SDL_HasSSE
* \sa SDL_HasSSE2
* \sa SDL_HasSSE3
* \sa SDL_HasSSE41
* \sa SDL_HasSSE42
*/
extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
/**
* Determine whether the CPU has SSE features.
*
* This always returns false on CPUs that aren't using Intel instruction sets.
*
* \returns SDL_TRUE if the CPU has SSE features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_Has3DNow
* \sa SDL_HasAltiVec
* \sa SDL_HasAVX
* \sa SDL_HasAVX2
* \sa SDL_HasMMX
* \sa SDL_HasRDTSC
* \sa SDL_HasSSE2
* \sa SDL_HasSSE3
* \sa SDL_HasSSE41
* \sa SDL_HasSSE42
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
/**
* Determine whether the CPU has SSE2 features.
*
* This always returns false on CPUs that aren't using Intel instruction sets.
*
* \returns SDL_TRUE if the CPU has SSE2 features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_Has3DNow
* \sa SDL_HasAltiVec
* \sa SDL_HasAVX
* \sa SDL_HasAVX2
* \sa SDL_HasMMX
* \sa SDL_HasRDTSC
* \sa SDL_HasSSE
* \sa SDL_HasSSE3
* \sa SDL_HasSSE41
* \sa SDL_HasSSE42
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
/**
* Determine whether the CPU has SSE3 features.
*
* This always returns false on CPUs that aren't using Intel instruction sets.
*
* \returns SDL_TRUE if the CPU has SSE3 features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_Has3DNow
* \sa SDL_HasAltiVec
* \sa SDL_HasAVX
* \sa SDL_HasAVX2
* \sa SDL_HasMMX
* \sa SDL_HasRDTSC
* \sa SDL_HasSSE
* \sa SDL_HasSSE2
* \sa SDL_HasSSE41
* \sa SDL_HasSSE42
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void);
/**
* Determine whether the CPU has SSE4.1 features.
*
* This always returns false on CPUs that aren't using Intel instruction sets.
*
* \returns SDL_TRUE if the CPU has SSE4.1 features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_Has3DNow
* \sa SDL_HasAltiVec
* \sa SDL_HasAVX
* \sa SDL_HasAVX2
* \sa SDL_HasMMX
* \sa SDL_HasRDTSC
* \sa SDL_HasSSE
* \sa SDL_HasSSE2
* \sa SDL_HasSSE3
* \sa SDL_HasSSE42
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void);
/**
* Determine whether the CPU has SSE4.2 features.
*
* This always returns false on CPUs that aren't using Intel instruction sets.
*
* \returns SDL_TRUE if the CPU has SSE4.2 features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_Has3DNow
* \sa SDL_HasAltiVec
* \sa SDL_HasAVX
* \sa SDL_HasAVX2
* \sa SDL_HasMMX
* \sa SDL_HasRDTSC
* \sa SDL_HasSSE
* \sa SDL_HasSSE2
* \sa SDL_HasSSE3
* \sa SDL_HasSSE41
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void);
/**
* Determine whether the CPU has AVX features.
*
* This always returns false on CPUs that aren't using Intel instruction sets.
*
* \returns SDL_TRUE if the CPU has AVX features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.2.
*
* \sa SDL_Has3DNow
* \sa SDL_HasAltiVec
* \sa SDL_HasAVX2
* \sa SDL_HasMMX
* \sa SDL_HasRDTSC
* \sa SDL_HasSSE
* \sa SDL_HasSSE2
* \sa SDL_HasSSE3
* \sa SDL_HasSSE41
* \sa SDL_HasSSE42
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void);
/**
* Determine whether the CPU has AVX2 features.
*
* This always returns false on CPUs that aren't using Intel instruction sets.
*
* \returns SDL_TRUE if the CPU has AVX2 features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.4.
*
* \sa SDL_Has3DNow
* \sa SDL_HasAltiVec
* \sa SDL_HasAVX
* \sa SDL_HasMMX
* \sa SDL_HasRDTSC
* \sa SDL_HasSSE
* \sa SDL_HasSSE2
* \sa SDL_HasSSE3
* \sa SDL_HasSSE41
* \sa SDL_HasSSE42
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
/**
* Determine whether the CPU has AVX-512F (foundation) features.
*
* This always returns false on CPUs that aren't using Intel instruction sets.
*
* \returns SDL_TRUE if the CPU has AVX-512F features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.9.
*
* \sa SDL_HasAVX
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
/**
* Determine whether the CPU has ARM SIMD (ARMv6) features.
*
* This is different from ARM NEON, which is a different instruction set.
*
* This always returns false on CPUs that aren't using ARM instruction sets.
*
* \returns SDL_TRUE if the CPU has ARM SIMD features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.12.
*
* \sa SDL_HasNEON
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
/**
* Determine whether the CPU has NEON (ARM SIMD) features.
*
* This always returns false on CPUs that aren't using ARM instruction sets.
*
* \returns SDL_TRUE if the CPU has ARM NEON features or SDL_FALSE if not.
*
* \since This function is available since SDL 2.0.6.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void);
/**
* Determine whether the CPU has LSX (LOONGARCH SIMD) features.
*
* This always returns false on CPUs that aren't using LOONGARCH instruction
* sets.
*
* \returns SDL_TRUE if the CPU has LOONGARCH LSX features or SDL_FALSE if
* not.
*
* \since This function is available since SDL 2.24.0.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasLSX(void);
/**
* Determine whether the CPU has LASX (LOONGARCH SIMD) features.
*
* This always returns false on CPUs that aren't using LOONGARCH instruction
* sets.
*
* \returns SDL_TRUE if the CPU has LOONGARCH LASX features or SDL_FALSE if
* not.
*
* \since This function is available since SDL 2.24.0.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_HasLASX(void);
/**
* Get the amount of RAM configured in the system.
*
* \returns the amount of RAM configured in the system in MiB.
*
* \since This function is available since SDL 2.0.1.
*/
extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void);
/**
* Report the alignment this system needs for SIMD allocations.
*
* This will return the minimum number of bytes to which a pointer must be
* aligned to be compatible with SIMD instructions on the current machine. For
* example, if the machine supports SSE only, it will return 16, but if it
* supports AVX-512F, it'll return 64 (etc). This only reports values for
* instruction sets SDL knows about, so if your SDL build doesn't have
* SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and
* not 64 for the AVX-512 instructions that exist but SDL doesn't know about.
* Plan accordingly.
*
* \returns the alignment in bytes needed for available, known SIMD
* instructions.
*
* \since This function is available since SDL 2.0.10.
*/
extern DECLSPEC size_t SDLCALL SDL_SIMDGetAlignment(void);
/**
* Allocate memory in a SIMD-friendly way.
*
* This will allocate a block of memory that is suitable for use with SIMD
* instructions. Specifically, it will be properly aligned and padded for the
* system's supported vector instructions.
*
* The memory returned will be padded such that it is safe to read or write an
* incomplete vector at the end of the memory block. This can be useful so you
* don't have to drop back to a scalar fallback at the end of your SIMD
* processing loop to deal with the final elements without overflowing the
* allocated buffer.
*
* You must free this memory with SDL_FreeSIMD(), not free() or SDL_free() or
* delete[], etc.
*
* Note that SDL will only deal with SIMD instruction sets it is aware of; for
* example, SDL 2.0.8 knows that SSE wants 16-byte vectors (SDL_HasSSE()), and
* AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't know that AVX-512 wants
* 64. To be clear: if you can't decide to use an instruction set with an
* SDL_Has*() function, don't use that instruction set with memory allocated
* through here.
*
* SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't
* out of memory, but you are not allowed to dereference it (because you only
* own zero bytes of that buffer).
*
* \param len The length, in bytes, of the block to allocate. The actual
* allocated block might be larger due to padding, etc.
* \returns a pointer to the newly-allocated block, NULL if out of memory.
*
* \since This function is available since SDL 2.0.10.
*
* \sa SDL_SIMDGetAlignment
* \sa SDL_SIMDRealloc
* \sa SDL_SIMDFree
*/
extern DECLSPEC void * SDLCALL SDL_SIMDAlloc(const size_t len);
/**
* Reallocate memory obtained from SDL_SIMDAlloc
*
* It is not valid to use this function on a pointer from anything but
* SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc,
* SDL_malloc, memalign, new[], etc.
*
* \param mem The pointer obtained from SDL_SIMDAlloc. This function also
* accepts NULL, at which point this function is the same as
* calling SDL_SIMDAlloc with a NULL pointer.
* \param len The length, in bytes, of the block to allocated. The actual
* allocated block might be larger due to padding, etc. Passing 0
* will return a non-NULL pointer, assuming the system isn't out of
* memory.
* \returns a pointer to the newly-reallocated block, NULL if out of memory.
*
* \since This function is available since SDL 2.0.14.
*
* \sa SDL_SIMDGetAlignment
* \sa SDL_SIMDAlloc
* \sa SDL_SIMDFree
*/
extern DECLSPEC void * SDLCALL SDL_SIMDRealloc(void *mem, const size_t len);
/**
* Deallocate memory obtained from SDL_SIMDAlloc
*
* It is not valid to use this function on a pointer from anything but
* SDL_SIMDAlloc() or SDL_SIMDRealloc(). It can't be used on pointers from
* malloc, realloc, SDL_malloc, memalign, new[], etc.
*
* However, SDL_SIMDFree(NULL) is a legal no-op.
*
* The memory pointed to by `ptr` is no longer valid for access upon return,
* and may be returned to the system or reused by a future allocation. The
* pointer passed to this function is no longer safe to dereference once this
* function returns, and should be discarded.
*
* \param ptr The pointer, returned from SDL_SIMDAlloc or SDL_SIMDRealloc, to
* deallocate. NULL is a legal no-op.
*
* \since This function is available since SDL 2.0.10.
*
* \sa SDL_SIMDAlloc
* \sa SDL_SIMDRealloc
*/
extern DECLSPEC void SDLCALL SDL_SIMDFree(void *ptr);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_cpuinfo_h_ */
/* vi: set ts=4 sw=4 expandtab: */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,396 @@
/*
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.
*/
/**
* # CategoryEndian
*
* Functions for reading and writing endian-specific values
*/
#ifndef SDL_endian_h_
#define SDL_endian_h_
#include "SDL_stdinc.h"
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
#ifdef __clang__
#ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H
static __inline__ void __attribute__((__always_inline__, __nodebug__))
_m_prefetch(void *__P)
{
__builtin_prefetch(__P, 0, 3 /* _MM_HINT_T0 */);
}
#endif /* __PRFCHWINTRIN_H */
#endif /* __clang__ */
#include <intrin.h>
#endif
/**
* \name The two types of endianness
*/
/* @{ */
#define SDL_LIL_ENDIAN 1234
#define SDL_BIG_ENDIAN 4321
/* @} */
#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
#ifdef __linux__
#include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER
#elif defined(__sun) && defined(__SVR4) /* Solaris */
#include <sys/byteorder.h>
#if defined(_LITTLE_ENDIAN)
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#elif defined(_BIG_ENDIAN)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#error Unsupported endianness
#endif
#elif defined(__OpenBSD__) || defined(__DragonFly__)
#include <endian.h>
#define SDL_BYTEORDER BYTE_ORDER
#elif defined(__FreeBSD__) || defined(__NetBSD__)
#include <sys/endian.h>
#define SDL_BYTEORDER BYTE_ORDER
/* predefs from newer gcc and clang versions: */
#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__BYTE_ORDER__)
#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#error Unsupported endianness
#endif /**/
#else
#if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MIPSEB__)) || \
defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \
defined(__sparc__) || defined(__sparc)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif
#endif /* __linux__ */
#endif /* !SDL_BYTEORDER */
#ifndef SDL_FLOATWORDORDER /* Not defined in SDL_config.h? */
/* predefs from newer gcc versions: */
#if defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__FLOAT_WORD_ORDER__)
#if (__FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
#elif (__FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__)
#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
#else
#error Unsupported endianness
#endif /**/
#elif defined(__MAVERICK__)
/* For Maverick, float words are always little-endian. */
#define SDL_FLOATWORDORDER SDL_LIL_ENDIAN
#elif (defined(__arm__) || defined(__thumb__)) && !defined(__VFP_FP__) && !defined(__ARM_EABI__)
/* For FPA, float words are always big-endian. */
#define SDL_FLOATWORDORDER SDL_BIG_ENDIAN
#else
/* By default, assume that floats words follow the memory system mode. */
#define SDL_FLOATWORDORDER SDL_BYTEORDER
#endif /* __FLOAT_WORD_ORDER__ */
#endif /* !SDL_FLOATWORDORDER */
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \file SDL_endian.h
*/
/* various modern compilers may have builtin swap */
#if defined(__GNUC__) || defined(__clang__)
# define HAS_BUILTIN_BSWAP16 (_SDL_HAS_BUILTIN(__builtin_bswap16)) || \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8))
# define HAS_BUILTIN_BSWAP32 (_SDL_HAS_BUILTIN(__builtin_bswap32)) || \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
# define HAS_BUILTIN_BSWAP64 (_SDL_HAS_BUILTIN(__builtin_bswap64)) || \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
/* this one is broken */
# define HAS_BROKEN_BSWAP (__GNUC__ == 2 && __GNUC_MINOR__ <= 95)
#else
# define HAS_BUILTIN_BSWAP16 0
# define HAS_BUILTIN_BSWAP32 0
# define HAS_BUILTIN_BSWAP64 0
# define HAS_BROKEN_BSWAP 0
#endif
#if HAS_BUILTIN_BSWAP16
#define SDL_Swap16(x) __builtin_bswap16(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_ushort)
#define SDL_Swap16(x) _byteswap_ushort(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0": "=q"(x):"0"(x));
return x;
}
#elif defined(__x86_64__)
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0": "=Q"(x):"0"(x));
return x;
}
#elif (defined(__powerpc__) || defined(__ppc__))
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
int result;
__asm__("rlwimi %0,%2,8,16,23": "=&r"(result):"0"(x >> 8), "r"(x));
return (Uint16)result;
}
#elif (defined(__m68k__) && !defined(__mcoldfire__))
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
__asm__("rorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline Uint16 SDL_Swap16(Uint16);
#pragma aux SDL_Swap16 = \
"xchg al, ah" \
parm [ax] \
modify [ax];
#else
/**
* Use this function to swap the byte order of a 16-bit value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapBE16
* \sa SDL_SwapLE16
*/
SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x)
{
return SDL_static_cast(Uint16, ((x << 8) | (x >> 8)));
}
#endif
#if HAS_BUILTIN_BSWAP32
#define SDL_Swap32(x) __builtin_bswap32(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_ulong)
#define SDL_Swap32(x) _byteswap_ulong(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("bswap %0": "=r"(x):"0"(x));
return x;
}
#elif defined(__x86_64__)
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("bswapl %0": "=r"(x):"0"(x));
return x;
}
#elif (defined(__powerpc__) || defined(__ppc__))
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
Uint32 result;
__asm__("rlwimi %0,%2,24,16,23": "=&r"(result): "0" (x>>24), "r"(x));
__asm__("rlwimi %0,%2,8,8,15" : "=&r"(result): "0" (result), "r"(x));
__asm__("rlwimi %0,%2,24,0,7" : "=&r"(result): "0" (result), "r"(x));
return result;
}
#elif (defined(__m68k__) && !defined(__mcoldfire__))
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
__asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc");
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline Uint32 SDL_Swap32(Uint32);
#pragma aux SDL_Swap32 = \
"bswap eax" \
parm [eax] \
modify [eax];
#else
/**
* Use this function to swap the byte order of a 32-bit value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapBE32
* \sa SDL_SwapLE32
*/
SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x)
{
return SDL_static_cast(Uint32, ((x << 24) | ((x << 8) & 0x00FF0000) |
((x >> 8) & 0x0000FF00) | (x >> 24)));
}
#endif
#if HAS_BUILTIN_BSWAP64
#define SDL_Swap64(x) __builtin_bswap64(x)
#elif (defined(_MSC_VER) && (_MSC_VER >= 1400)) && !defined(__ICL)
#pragma intrinsic(_byteswap_uint64)
#define SDL_Swap64(x) _byteswap_uint64(x)
#elif defined(__i386__) && !HAS_BROKEN_BSWAP
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
union {
struct {
Uint32 a, b;
} s;
Uint64 u;
} v;
v.u = x;
__asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
: "=r"(v.s.a), "=r"(v.s.b)
: "0" (v.s.a), "1"(v.s.b));
return v.u;
}
#elif defined(__x86_64__)
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
__asm__("bswapq %0": "=r"(x):"0"(x));
return x;
}
#elif defined(__WATCOMC__) && defined(__386__)
extern __inline Uint64 SDL_Swap64(Uint64);
#pragma aux SDL_Swap64 = \
"bswap eax" \
"bswap edx" \
"xchg eax,edx" \
parm [eax edx] \
modify [eax edx];
#else
/**
* Use this function to swap the byte order of a 64-bit value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapBE64
* \sa SDL_SwapLE64
*/
SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x)
{
Uint32 hi, lo;
/* Separate into high and low 32-bit values and swap them */
lo = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
x >>= 32;
hi = SDL_static_cast(Uint32, x & 0xFFFFFFFF);
x = SDL_Swap32(lo);
x <<= 32;
x |= SDL_Swap32(hi);
return (x);
}
#endif
/**
* Use this function to swap the byte order of a floating point value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapFloatBE
* \sa SDL_SwapFloatLE
*/
SDL_FORCE_INLINE float
SDL_SwapFloat(float x)
{
union {
float f;
Uint32 ui32;
} swapper;
swapper.f = x;
swapper.ui32 = SDL_Swap32(swapper.ui32);
return swapper.f;
}
/* remove extra macros */
#undef HAS_BROKEN_BSWAP
#undef HAS_BUILTIN_BSWAP16
#undef HAS_BUILTIN_BSWAP32
#undef HAS_BUILTIN_BSWAP64
/**
* \name Swap to native
* Byteswap item from the specified endianness to the native endianness.
*/
/* @{ */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define SDL_SwapLE16(X) (X)
#define SDL_SwapLE32(X) (X)
#define SDL_SwapLE64(X) (X)
#define SDL_SwapFloatLE(X) (X)
#define SDL_SwapBE16(X) SDL_Swap16(X)
#define SDL_SwapBE32(X) SDL_Swap32(X)
#define SDL_SwapBE64(X) SDL_Swap64(X)
#define SDL_SwapFloatBE(X) SDL_SwapFloat(X)
#else
#define SDL_SwapLE16(X) SDL_Swap16(X)
#define SDL_SwapLE32(X) SDL_Swap32(X)
#define SDL_SwapLE64(X) SDL_Swap64(X)
#define SDL_SwapFloatLE(X) SDL_SwapFloat(X)
#define SDL_SwapBE16(X) (X)
#define SDL_SwapBE32(X) (X)
#define SDL_SwapBE64(X) (X)
#define SDL_SwapFloatBE(X) (X)
#endif
/* @} *//* Swap to native */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_endian_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@ -0,0 +1,163 @@
/*
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.
*/
/**
* # CategoryError
*
* Simple error message routines for SDL.
*/
#ifndef SDL_error_h_
#define SDL_error_h_
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/* Public functions */
/**
* Set the SDL error message for the current thread.
*
* Calling this function will replace any previous error message that was set.
*
* This function always returns -1, since SDL frequently uses -1 to signify an
* failing result, leading to this idiom:
*
* ```c
* if (error_code) {
* return SDL_SetError("This operation has failed: %d", error_code);
* }
* ```
*
* \param fmt a printf()-style message format string.
* \param ... additional parameters matching % tokens in the `fmt` string, if
* any.
* \returns always -1.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_ClearError
* \sa SDL_GetError
*/
extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
/**
* Retrieve a message about the last error that occurred on the current
* thread.
*
* It is possible for multiple errors to occur before calling SDL_GetError().
* Only the last error is returned.
*
* The message is only applicable when an SDL function has signaled an error.
* You must check the return values of SDL function calls to determine when to
* appropriately call SDL_GetError(). You should *not* use the results of
* SDL_GetError() to decide if an error has occurred! Sometimes SDL will set
* an error string even when reporting success.
*
* SDL will *not* clear the error string for successful API calls. You *must*
* check return values for failure cases before you can assume the error
* string applies.
*
* Error strings are set per-thread, so an error set in a different thread
* will not interfere with the current thread's operation.
*
* The returned string is internally allocated and must not be freed by the
* application.
*
* \returns a message with information about the specific error that occurred,
* or an empty string if there hasn't been an error message set since
* the last call to SDL_ClearError(). The message is only applicable
* when an SDL function has signaled an error. You must check the
* return values of SDL function calls to determine when to
* appropriately call SDL_GetError().
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_ClearError
* \sa SDL_SetError
*/
extern DECLSPEC const char *SDLCALL SDL_GetError(void);
/**
* Get the last error message that was set for the current thread.
*
* This allows the caller to copy the error string into a provided buffer, but
* otherwise operates exactly the same as SDL_GetError().
*
* \param errstr A buffer to fill with the last error message that was set for
* the current thread.
* \param maxlen The size of the buffer pointed to by the errstr parameter.
* \returns the pointer passed in as the `errstr` parameter.
*
* \since This function is available since SDL 2.0.14.
*
* \sa SDL_GetError
*/
extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
/**
* Clear any previous error message for this thread.
*
* \since This function is available since SDL 2.0.0.
*
* \sa SDL_GetError
* \sa SDL_SetError
*/
extern DECLSPEC void SDLCALL SDL_ClearError(void);
/**
* \name Internal error functions
*
* \internal
* Private error reporting function - used internally.
*/
/* @{ */
#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
#define SDL_InvalidParamError(param) SDL_SetError("Parameter '%s' is invalid", (param))
typedef enum
{
SDL_ENOMEM,
SDL_EFREAD,
SDL_EFWRITE,
SDL_EFSEEK,
SDL_UNSUPPORTED,
SDL_LASTERROR
} SDL_errorcode;
/* SDL_Error() unconditionally returns -1. */
extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code);
/* @} *//* Internal error functions */
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_error_h_ */
/* vi: set ts=4 sw=4 expandtab: */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,149 @@
/*
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.
*/
/**
* # CategoryFilesystem
*
* Include file for filesystem SDL API functions
*/
#ifndef SDL_filesystem_h_
#define SDL_filesystem_h_
#include "SDL_stdinc.h"
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif
/**
* Get the directory where the application was run from.
*
* This is not necessarily a fast call, so you should call this once near
* startup and save the string if you need it.
*
* **Mac OS X and iOS Specific Functionality**: If the application is in a
* ".app" bundle, this function returns the Resource directory (e.g.
* MyApp.app/Contents/Resources/). This behaviour can be overridden by adding
* a property to the Info.plist file. Adding a string key with the name
* SDL_FILESYSTEM_BASE_DIR_TYPE with a supported value will change the
* behaviour.
*
* Supported values for the SDL_FILESYSTEM_BASE_DIR_TYPE property (Given an
* application in /Applications/SDLApp/MyApp.app):
*
* - `resource`: bundle resource directory (the default). For example:
* `/Applications/SDLApp/MyApp.app/Contents/Resources`
* - `bundle`: the Bundle directory. For example:
* `/Applications/SDLApp/MyApp.app/`
* - `parent`: the containing directory of the bundle. For example:
* `/Applications/SDLApp/`
*
* **Nintendo 3DS Specific Functionality**: This function returns "romfs"
* directory of the application as it is uncommon to store resources outside
* the executable. As such it is not a writable directory.
*
* The returned path is guaranteed to end with a path separator ('\\' on
* Windows, '/' on most other platforms).
*
* The pointer returned is owned by the caller. Please call SDL_free() on the
* pointer when done with it.
*
* \returns an absolute path in UTF-8 encoding to the application data
* directory. NULL will be returned on error or when the platform
* doesn't implement this functionality, call SDL_GetError() for more
* information.
*
* \since This function is available since SDL 2.0.1.
*
* \sa SDL_GetPrefPath
*/
extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
/**
* Get the user-and-app-specific path where files can be written.
*
* Get the "pref dir". This is meant to be where users can write personal
* files (preferences and save games, etc) that are specific to your
* application. This directory is unique per user, per application.
*
* This function will decide the appropriate location in the native
* filesystem, create the directory if necessary, and return a string of the
* absolute path to the directory in UTF-8 encoding.
*
* On Windows, the string might look like:
*
* `C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\`
*
* On Linux, the string might look like:
*
* `/home/bob/.local/share/My Program Name/`
*
* On Mac OS X, the string might look like:
*
* `/Users/bob/Library/Application Support/My Program Name/`
*
* You should assume the path returned by this function is the only safe place
* to write files (and that SDL_GetBasePath(), while it might be writable, or
* even the parent of the returned path, isn't where you should be writing
* things).
*
* Both the org and app strings may become part of a directory name, so please
* follow these rules:
*
* - Try to use the same org string (_including case-sensitivity_) for all
* your applications that use this function.
* - Always use a unique app string for each one, and make sure it never
* changes for an app once you've decided on it.
* - Unicode characters are legal, as long as it's UTF-8 encoded, but...
* - ...only use letters, numbers, and spaces. Avoid punctuation like "Game
* Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
*
* The returned path is guaranteed to end with a path separator ('\\' on
* Windows, '/' on most other platforms).
*
* The pointer returned is owned by the caller. Please call SDL_free() on the
* pointer when done with it.
*
* \param org the name of your organization.
* \param app the name of your application.
* \returns a UTF-8 string of the user directory in platform-dependent
* notation. NULL if there's a problem (creating directory failed,
* etc.).
*
* \since This function is available since SDL 2.0.1.
*
* \sa SDL_GetBasePath
*/
extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}
#endif
#include "close_code.h"
#endif /* SDL_filesystem_h_ */
/* vi: set ts=4 sw=4 expandtab: */

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