From 1b2530749ea3dc4937cdd7aa37e5a144e6d10183 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 12 Nov 2017 20:14:15 -0800 Subject: Updated to version 2.1 --- .../build/GhostCubeScene.Assets.vcxitems | 29 ++ .../build/GhostCubeScene.Assets.vcxitems.filters | 16 + .../build/UWP/Assets/LockScreenLogo.scale-200.png | Bin 0 -> 1430 bytes .../build/UWP/Assets/SplashScreen.scale-200.png | Bin 0 -> 7700 bytes .../UWP/Assets/Square150x150Logo.scale-200.png | Bin 0 -> 2937 bytes .../build/UWP/Assets/Square44x44Logo.scale-200.png | Bin 0 -> 1647 bytes ...are44x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 1255 bytes .../GhostCubeScene/build/UWP/Assets/StoreLogo.png | Bin 0 -> 1451 bytes .../build/UWP/Assets/Wide310x150Logo.scale-200.png | Bin 0 -> 3204 bytes .../build/UWP/GhostCubeScene.vcxproj | 360 +++++++++++++++++++++ .../build/UWP/GhostCubeScene.vcxproj.filters | 76 +++++ .../build/UWP/GhostCubeScene_TemporaryKey.pfx | Bin 0 -> 2448 bytes .../GhostCubeScene/build/UWP/Package.appxmanifest | 28 ++ .../GhostCubeScene/build/Win32/!README!.txt | 7 + .../GhostCubeScene/build/Win32/AndroidManifest.xml | 20 ++ .../build/Win32/GhostCubeScene-Debug.vgdbsettings | 90 ++++++ .../Win32/GhostCubeScene-Release.vgdbsettings | 81 +++++ .../build/Win32/GhostCubeScene.vcxproj | 264 +++++++++++++++ .../build/Win32/GhostCubeScene.vcxproj.filters | 69 ++++ .../GhostCubeScene/build/Win32/android_build.txt | 16 + unityplugin/GhostCubeScene/build/Win32/build.xml | 96 ++++++ .../GhostCubeScene/build/Win32/jni/Android.mk | 117 +++++++ .../GhostCubeScene/build/Win32/jni/Application.mk | 7 + .../build/Win32/res/drawable-hdpi/ic_launcher.png | Bin 0 -> 8203 bytes .../build/Win32/res/drawable-ldpi/ic_launcher.png | Bin 0 -> 2556 bytes .../build/Win32/res/drawable-mdpi/ic_launcher.png | Bin 0 -> 4064 bytes .../build/Win32/res/drawable-xhdpi/ic_launcher.png | Bin 0 -> 13541 bytes .../build/Win32/res/layout/widgets.xml | 17 + .../build/Win32/res/values-v11/styles.xml | 11 + .../build/Win32/res/values-v14/styles.xml | 12 + .../build/Win32/res/values/strings.xml | 6 + .../build/Win32/res/values/styles.xml | 20 ++ unityplugin/GhostCubeScene/build/Win32/run.bat | 15 + .../GhostCubeScene/build/Win32/run_d3d11_32d.bat | 1 + .../GhostCubeScene/build/Win32/run_d3d11_32r.bat | 1 + .../GhostCubeScene/build/Win32/run_d3d11_64d.bat | 1 + .../GhostCubeScene/build/Win32/run_d3d11_64r.bat | 1 + .../GhostCubeScene/build/Win32/run_d3d12_32r.bat | 1 + .../GhostCubeScene/build/Win32/run_d3d12_64d.bat | 1 + .../GhostCubeScene/build/Win32/run_d3d12_64r.bat | 1 + .../GhostCubeScene/build/Win32/run_gl_32d.bat | 1 + .../GhostCubeScene/build/Win32/run_gl_32r.bat | 1 + .../GhostCubeScene/build/Win32/run_gl_64d.bat | 1 + .../GhostCubeScene/build/Win32/run_gl_64r.bat | 1 + .../Windows.Shared/GhostCubeScene.Shared.vcxitems | 27 ++ .../GhostCubeScene.Shared.vcxitems.filters | 27 ++ .../build/Windows.Shared/GhostCubeScene.props | 37 +++ .../GhostCubeScene/build/assets/shaders/Mirror.psh | 14 + .../GhostCubeScene/build/assets/shaders/Mirror.vsh | 33 ++ .../GhostCubeScene/src/Android/AndroidMain.cpp | 58 ++++ unityplugin/GhostCubeScene/src/GhostCubeScene.cpp | 215 ++++++++++++ unityplugin/GhostCubeScene/src/GhostCubeScene.h | 58 ++++ .../src/GhostCubeSceneResTrsnHelper.cpp | 62 ++++ .../src/GhostCubeSceneResTrsnHelper.h | 38 +++ 54 files changed, 1937 insertions(+) create mode 100644 unityplugin/GhostCubeScene/build/GhostCubeScene.Assets.vcxitems create mode 100644 unityplugin/GhostCubeScene/build/GhostCubeScene.Assets.vcxitems.filters create mode 100644 unityplugin/GhostCubeScene/build/UWP/Assets/LockScreenLogo.scale-200.png create mode 100644 unityplugin/GhostCubeScene/build/UWP/Assets/SplashScreen.scale-200.png create mode 100644 unityplugin/GhostCubeScene/build/UWP/Assets/Square150x150Logo.scale-200.png create mode 100644 unityplugin/GhostCubeScene/build/UWP/Assets/Square44x44Logo.scale-200.png create mode 100644 unityplugin/GhostCubeScene/build/UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 unityplugin/GhostCubeScene/build/UWP/Assets/StoreLogo.png create mode 100644 unityplugin/GhostCubeScene/build/UWP/Assets/Wide310x150Logo.scale-200.png create mode 100644 unityplugin/GhostCubeScene/build/UWP/GhostCubeScene.vcxproj create mode 100644 unityplugin/GhostCubeScene/build/UWP/GhostCubeScene.vcxproj.filters create mode 100644 unityplugin/GhostCubeScene/build/UWP/GhostCubeScene_TemporaryKey.pfx create mode 100644 unityplugin/GhostCubeScene/build/UWP/Package.appxmanifest create mode 100644 unityplugin/GhostCubeScene/build/Win32/!README!.txt create mode 100644 unityplugin/GhostCubeScene/build/Win32/AndroidManifest.xml create mode 100644 unityplugin/GhostCubeScene/build/Win32/GhostCubeScene-Debug.vgdbsettings create mode 100644 unityplugin/GhostCubeScene/build/Win32/GhostCubeScene-Release.vgdbsettings create mode 100644 unityplugin/GhostCubeScene/build/Win32/GhostCubeScene.vcxproj create mode 100644 unityplugin/GhostCubeScene/build/Win32/GhostCubeScene.vcxproj.filters create mode 100644 unityplugin/GhostCubeScene/build/Win32/android_build.txt create mode 100644 unityplugin/GhostCubeScene/build/Win32/build.xml create mode 100644 unityplugin/GhostCubeScene/build/Win32/jni/Android.mk create mode 100644 unityplugin/GhostCubeScene/build/Win32/jni/Application.mk create mode 100644 unityplugin/GhostCubeScene/build/Win32/res/drawable-hdpi/ic_launcher.png create mode 100644 unityplugin/GhostCubeScene/build/Win32/res/drawable-ldpi/ic_launcher.png create mode 100644 unityplugin/GhostCubeScene/build/Win32/res/drawable-mdpi/ic_launcher.png create mode 100644 unityplugin/GhostCubeScene/build/Win32/res/drawable-xhdpi/ic_launcher.png create mode 100644 unityplugin/GhostCubeScene/build/Win32/res/layout/widgets.xml create mode 100644 unityplugin/GhostCubeScene/build/Win32/res/values-v11/styles.xml create mode 100644 unityplugin/GhostCubeScene/build/Win32/res/values-v14/styles.xml create mode 100644 unityplugin/GhostCubeScene/build/Win32/res/values/strings.xml create mode 100644 unityplugin/GhostCubeScene/build/Win32/res/values/styles.xml create mode 100644 unityplugin/GhostCubeScene/build/Win32/run.bat create mode 100644 unityplugin/GhostCubeScene/build/Win32/run_d3d11_32d.bat create mode 100644 unityplugin/GhostCubeScene/build/Win32/run_d3d11_32r.bat create mode 100644 unityplugin/GhostCubeScene/build/Win32/run_d3d11_64d.bat create mode 100644 unityplugin/GhostCubeScene/build/Win32/run_d3d11_64r.bat create mode 100644 unityplugin/GhostCubeScene/build/Win32/run_d3d12_32r.bat create mode 100644 unityplugin/GhostCubeScene/build/Win32/run_d3d12_64d.bat create mode 100644 unityplugin/GhostCubeScene/build/Win32/run_d3d12_64r.bat create mode 100644 unityplugin/GhostCubeScene/build/Win32/run_gl_32d.bat create mode 100644 unityplugin/GhostCubeScene/build/Win32/run_gl_32r.bat create mode 100644 unityplugin/GhostCubeScene/build/Win32/run_gl_64d.bat create mode 100644 unityplugin/GhostCubeScene/build/Win32/run_gl_64r.bat create mode 100644 unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.Shared.vcxitems create mode 100644 unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.Shared.vcxitems.filters create mode 100644 unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.props create mode 100644 unityplugin/GhostCubeScene/build/assets/shaders/Mirror.psh create mode 100644 unityplugin/GhostCubeScene/build/assets/shaders/Mirror.vsh create mode 100644 unityplugin/GhostCubeScene/src/Android/AndroidMain.cpp create mode 100644 unityplugin/GhostCubeScene/src/GhostCubeScene.cpp create mode 100644 unityplugin/GhostCubeScene/src/GhostCubeScene.h create mode 100644 unityplugin/GhostCubeScene/src/GhostCubeSceneResTrsnHelper.cpp create mode 100644 unityplugin/GhostCubeScene/src/GhostCubeSceneResTrsnHelper.h (limited to 'unityplugin/GhostCubeScene') diff --git a/unityplugin/GhostCubeScene/build/GhostCubeScene.Assets.vcxitems b/unityplugin/GhostCubeScene/build/GhostCubeScene.Assets.vcxitems new file mode 100644 index 0000000..7808a78 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/GhostCubeScene.Assets.vcxitems @@ -0,0 +1,29 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {CAF59C31-47E1-4F26-8455-C5E49F75BB3C} + RenderScript + GhostCubeScene.Assets + 248F659F-DAC5-46E8-AC09-60EC9FC95053 + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + + + + true + Document + + + true + Document + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/GhostCubeScene.Assets.vcxitems.filters b/unityplugin/GhostCubeScene/build/GhostCubeScene.Assets.vcxitems.filters new file mode 100644 index 0000000..316e269 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/GhostCubeScene.Assets.vcxitems.filters @@ -0,0 +1,16 @@ + + + + + {e5ff4d8e-5106-442e-848b-f56d1baa2645} + + + + + shaders + + + shaders + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/UWP/Assets/LockScreenLogo.scale-200.png b/unityplugin/GhostCubeScene/build/UWP/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000..735f57a Binary files /dev/null and b/unityplugin/GhostCubeScene/build/UWP/Assets/LockScreenLogo.scale-200.png differ diff --git a/unityplugin/GhostCubeScene/build/UWP/Assets/SplashScreen.scale-200.png b/unityplugin/GhostCubeScene/build/UWP/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000..023e7f1 Binary files /dev/null and b/unityplugin/GhostCubeScene/build/UWP/Assets/SplashScreen.scale-200.png differ diff --git a/unityplugin/GhostCubeScene/build/UWP/Assets/Square150x150Logo.scale-200.png b/unityplugin/GhostCubeScene/build/UWP/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000..af49fec Binary files /dev/null and b/unityplugin/GhostCubeScene/build/UWP/Assets/Square150x150Logo.scale-200.png differ diff --git a/unityplugin/GhostCubeScene/build/UWP/Assets/Square44x44Logo.scale-200.png b/unityplugin/GhostCubeScene/build/UWP/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000..ce342a2 Binary files /dev/null and b/unityplugin/GhostCubeScene/build/UWP/Assets/Square44x44Logo.scale-200.png differ diff --git a/unityplugin/GhostCubeScene/build/UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/unityplugin/GhostCubeScene/build/UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000..f6c02ce Binary files /dev/null and b/unityplugin/GhostCubeScene/build/UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/unityplugin/GhostCubeScene/build/UWP/Assets/StoreLogo.png b/unityplugin/GhostCubeScene/build/UWP/Assets/StoreLogo.png new file mode 100644 index 0000000..7385b56 Binary files /dev/null and b/unityplugin/GhostCubeScene/build/UWP/Assets/StoreLogo.png differ diff --git a/unityplugin/GhostCubeScene/build/UWP/Assets/Wide310x150Logo.scale-200.png b/unityplugin/GhostCubeScene/build/UWP/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000..288995b Binary files /dev/null and b/unityplugin/GhostCubeScene/build/UWP/Assets/Wide310x150Logo.scale-200.png differ diff --git a/unityplugin/GhostCubeScene/build/UWP/GhostCubeScene.vcxproj b/unityplugin/GhostCubeScene/build/UWP/GhostCubeScene.vcxproj new file mode 100644 index 0000000..2571e58 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/UWP/GhostCubeScene.vcxproj @@ -0,0 +1,360 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + + {BDD3DD22-64FA-4E48-BDF0-FD0B1C28C87F} + DirectXApp + GhostCubeScene + en-US + 14.0 + true + Windows Store + 10.0.10586.0 + 10.0.10240.0 + 10.0 + + + + Application + true + v140 + + + Application + true + v140 + + + Application + true + v140 + + + Application + false + true + v140 + true + + + Application + false + true + v140 + true + + + Application + false + true + v140 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GhostCubeScene_TemporaryKey.pfx + + + $(SamplesRoot)\Samples\SampleBase\src\UWP;$(IncludePath) + + + $(SamplesRoot)\Samples\SampleBase\src\UWP;$(IncludePath) + + + $(SamplesRoot)\Samples\SampleBase\src\UWP;$(IncludePath) + + + $(SamplesRoot)\Samples\SampleBase\src\UWP;$(IncludePath) + + + $(SamplesRoot)\Samples\SampleBase\src\UWP;$(IncludePath) + + + $(SamplesRoot)\Samples\SampleBase\src\UWP;$(IncludePath) + + + + mincore.lib;d3d12.lib;dxgi.lib;dxguid.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + _DEBUG;%(PreprocessorDefinitions) + NotUsing + + + + + mincore.lib;d3d12.lib;dxgi.lib;dxguid.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + NDEBUG;%(PreprocessorDefinitions) + NotUsing + + + + + mincore.lib;d3d12.lib;dxgi.lib;dxguid.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + _DEBUG;%(PreprocessorDefinitions) + NotUsing + + + + + mincore.lib;d3d12.lib;dxgi.lib;dxguid.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + NDEBUG;%(PreprocessorDefinitions) + NotUsing + + + + + mincore.lib;d3d12.lib;dxgi.lib;dxguid.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + _DEBUG;%(PreprocessorDefinitions) + NotUsing + + + + + mincore.lib;d3d12.lib;dxgi.lib;dxguid.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 + + + pch.h + $(IntDir)pch.pch + $(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + NDEBUG;%(PreprocessorDefinitions) + NotUsing + + + + + + + + + + + + + + Designer + + + Document + copy "%(RelativeDir)%(Filename).dll" "$(ProjectDir)Assets" + copying "%(Filename).dll" to "$(ProjectDir)Assets" + $(ProjectDir)Assets\%(Filename).dll + + + Document + $(ProjectDir)Assets\%(Filename).dll + copy "%(RelativeDir)%(Filename).dll" "$(ProjectDir)Assets" + copying "%(Filename).dll" to "$(ProjectDir)Assets" + + + Document + copy "%(RelativeDir)%(Filename).dll" "$(ProjectDir)Assets" + copying "%(Filename).dll" to "$(ProjectDir)Assets" + $(ProjectDir)Assets\%(Filename).dll + + + Document + copy "%(RelativeDir)%(Filename).dll" "$(ProjectDir)Assets" + copying "%(Filename).dll" to "$(ProjectDir)Assets" + $(ProjectDir)Assets\%(Filename).dll + + + Document + copy "%(RelativeDir)%(Filename).dll" "$(ProjectDir)Assets" + copying "%(Filename).dll" to "$(ProjectDir)Assets" + $(ProjectDir)Assets\%(Filename).dll + + + Document + copy "%(RelativeDir)%(Filename).dll" "$(ProjectDir)Assets" + copying "%(Filename).dll" to "$(ProjectDir)Assets" + $(ProjectDir)Assets\%(Filename).dll + + + true + false + false + false + false + false + + + false + true + false + false + false + false + + + true + Document + false + false + false + false + false + + + false + false + false + false + false + true + + + false + false + true + false + false + false + + + false + false + false + true + false + false + + + + + + {6de3eb2b-8a56-4d27-8a39-587f7a70584c} + + + {29acd2a7-4c49-4973-9673-8f57ef37070f} + + + {1a5a1c1d-c717-4680-a929-40e6324fe048} + + + {acd6f956-ff3b-4fe9-8be3-c0eecfdbbf93} + + + {dfe6435d-cc9d-4ca1-bf4e-5640c522d815} + + + {7a1a6e2c-3952-4a57-ad30-abd92aa39c69} + + + {ff7d4949-dc3e-488b-8f78-1d32f1ca3b4c} + + + {91adc1dd-aa8e-492a-ac19-3e0dab9ad665} + + + {17597734-2fbf-481f-99d4-3315b70fe3e2} + + + + + + + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/UWP/GhostCubeScene.vcxproj.filters b/unityplugin/GhostCubeScene/build/UWP/GhostCubeScene.vcxproj.filters new file mode 100644 index 0000000..c9613a3 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/UWP/GhostCubeScene.vcxproj.filters @@ -0,0 +1,76 @@ + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + SourceDLLs + + + SourceDLLs + + + SourceDLLs + + + SourceDLLs + + + SourceDLLs + + + SourceDLLs + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + {1be0445e-de96-4b5e-9c3c-6b6fca9400ee} + + + {c64a1209-12b4-40a7-9e1f-d482a039c93d} + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/UWP/GhostCubeScene_TemporaryKey.pfx b/unityplugin/GhostCubeScene/build/UWP/GhostCubeScene_TemporaryKey.pfx new file mode 100644 index 0000000..cbe5c59 Binary files /dev/null and b/unityplugin/GhostCubeScene/build/UWP/GhostCubeScene_TemporaryKey.pfx differ diff --git a/unityplugin/GhostCubeScene/build/UWP/Package.appxmanifest b/unityplugin/GhostCubeScene/build/UWP/Package.appxmanifest new file mode 100644 index 0000000..68d1400 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/UWP/Package.appxmanifest @@ -0,0 +1,28 @@ + + + + + + GhostCubeSceneEmulator + Egor + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/!README!.txt b/unityplugin/GhostCubeScene/build/Win32/!README!.txt new file mode 100644 index 0000000..4326d21 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/!README!.txt @@ -0,0 +1,7 @@ +To build the demo for Win32 platform, open ..\..\build\Win32\UnityPlugin.sln solution + +To run the demo, execute one of the run_*.bat files (do not execute run.bat!) + +To run the sample from the Visual Studio, set the following debugging properties: +WorkingDirectory : $(AssetsPath) +Command Arguments : mode={D3D11|D3D12|GL} (do not use spaces!) \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/AndroidManifest.xml b/unityplugin/GhostCubeScene/build/Win32/AndroidManifest.xml new file mode 100644 index 0000000..e6a7d0f --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/AndroidManifest.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene-Debug.vgdbsettings b/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene-Debug.vgdbsettings new file mode 100644 index 0000000..ddc029c --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene-Debug.vgdbsettings @@ -0,0 +1,90 @@ + + + Debug + + + + MinGWWindowsSlash + + $(ProjectDir) + + + android-19 + true + false + bin;obj + false + false + + + + + + false + false + true + false + false + false + false + true + true + KillApp + + false + false + false + false + false + false + false + false + + false + false + main + true + false + false + + + false + + true + 5039 + 5039 + 10000 + 0 + false + Relaunch + true + true + + + + + /data/local/tmp + + + + + + + + + + + + + + + + + Default + + + + true + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene-Release.vgdbsettings b/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene-Release.vgdbsettings new file mode 100644 index 0000000..17856d6 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene-Release.vgdbsettings @@ -0,0 +1,81 @@ + + + Release + + + + MinGWWindowsSlash + + $(ProjectDir) + + + android-19 + false + false + bin;obj + false + false + + + + + + false + false + true + false + false + false + false + true + false + KillApp + + false + false + false + false + false + false + false + false + + false + false + main + true + false + false + + + false + false + 5039 + 5039 + 10000 + 0 + false + Ask + true + true + + /data/local/tmp + + + + + + + + + + + + Default + + + + true + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene.vcxproj b/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene.vcxproj new file mode 100644 index 0000000..68dc552 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene.vcxproj @@ -0,0 +1,264 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + {516AA088-64B1-4DCF-9631-59F91F0E849A} + GhostCubeScene + 10.0.10240.0 + + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + v120 + Makefile + + + v120 + Makefile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(ProjectDir)..\..\..\..\Common\Android\gcc_Debug.h;$(NMakeForcedIncludes) + $(ProjectDir)GhostCubeScene-Debug.vgdbsettings + + + $(ProjectDir)..\..\..\..\Common\Android\gcc_Release.h;$(NMakeForcedIncludes) + $(ProjectDir)GhostCubeScene-Release.vgdbsettings + + + + Level3 + Disabled + true + NotUsing + + + true + Windows + opengl32.lib;%(AdditionalDependencies) + + + copy "$(VC_ExecutablePath_x86_x86)\D3Dcompiler_47.dll" "$(TargetDir)" + Copying D3DCompiler_47.dll to $(TargetDir)... + + + + + Level3 + Disabled + true + NotUsing + + + true + Windows + opengl32.lib;%(AdditionalDependencies) + + + copy "$(VC_ExecutablePath_x64_x64)\D3Dcompiler_47.dll" "$(TargetDir)" + Copying D3DCompiler_47.dll to $(TargetDir)... + + + + + Level3 + MaxSpeed + true + true + true + NotUsing + + + true + true + true + Windows + opengl32.lib;%(AdditionalDependencies) + + + copy "$(VC_ExecutablePath_x86_x86)\D3Dcompiler_47.dll" "$(TargetDir)" + Copying D3DCompiler_47.dll to $(TargetDir)... + + + + + Level3 + MaxSpeed + true + true + true + NotUsing + + + true + true + true + Windows + opengl32.lib;%(AdditionalDependencies) + + + copy "$(VC_ExecutablePath_x64_x64)\D3Dcompiler_47.dll" "$(TargetDir)" + Copying D3DCompiler_47.dll to $(TargetDir)... + + + + + Document + copy "%(RelativeDir)%(Filename).dll" "$(TargetDir)" +copy "%(RelativeDir)%(Filename).pdb" "$(TargetDir)" + Copying %(Filename).dll and %(Filename).pdb + $(TargetDir)%(Filename).dll + + + Document + copy "%(RelativeDir)%(Filename).dll" "$(TargetDir)" +copy "%(RelativeDir)%(Filename).pdb" "$(TargetDir)" + Copying %(Filename).dll and %(Filename).pdb + $(TargetDir)%(Filename).dll + + + Document + copy "%(RelativeDir)%(Filename).dll" "$(TargetDir)" +copy "%(RelativeDir)%(Filename).pdb" "$(TargetDir)" + Copying %(Filename).dll and %(Filename).pdb + $(TargetDir)%(Filename).dll + + + Document + copy "%(RelativeDir)%(Filename).dll" "$(TargetDir)" +copy "%(RelativeDir)%(Filename).pdb" "$(TargetDir)" + Copying %(Filename).dll and %(Filename).pdb + $(TargetDir)%(Filename).dll + + + + + + + + + + + + + {7380f7e6-315f-4b4e-92eb-e6aeee865298} + + + {664e6f0d-6784-4760-9565-d54f8eb1edf4} + + + {e333476e-15e3-4d43-a4cf-8748058b3be9} + + + {8ada5f93-7a38-4ad8-b8f5-1ffd4d4f630c} + + + {58f32677-436b-412a-bbf8-2b1310d82cd8} + + + {f40021ac-6d7b-4828-81c4-2d04f946a88e} + + + + + true + true + true + true + + + true + true + true + true + + + + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene.vcxproj.filters b/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene.vcxproj.filters new file mode 100644 index 0000000..3ecc134 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/GhostCubeScene.vcxproj.filters @@ -0,0 +1,69 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {99c6c817-b02b-4b78-8b27-011a6f68c396} + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {1e08520a-5f84-419f-9ab8-b20c4af153a3} + + + {cd80a81f-81ce-45e0-a041-ad1424d39aef} + + + {450ce8ab-a0ce-402c-97d8-aa38f90f85bd} + + + + + Android\jni + + + Android\jni + + + + + Android + + + Android + + + Android\res + + + Android\res + + + + + DLLs + + + DLLs + + + DLLs + + + DLLs + + + + + Android\src + + + Android\src + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/android_build.txt b/unityplugin/GhostCubeScene/build/Win32/android_build.txt new file mode 100644 index 0000000..226503c --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/android_build.txt @@ -0,0 +1,16 @@ +To build: + +1. cd to AntTweakBar\build\Win32 folder + +2. First time only, initialize the project (do not miss the dot at the end of the command): + android update project -p . + +3. ndk-build + +4. Build the APK + ant debug + +5. Install the APK + adb install -r ./bin/EngineSampleNativeActivity-debug.apk + +6. Run the app on the device \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/build.xml b/unityplugin/GhostCubeScene/build/Win32/build.xml new file mode 100644 index 0000000..b2dcec5 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/build.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/unityplugin/GhostCubeScene/build/Win32/jni/Android.mk b/unityplugin/GhostCubeScene/build/Win32/jni/Android.mk new file mode 100644 index 0000000..f3ec778 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/jni/Android.mk @@ -0,0 +1,117 @@ + +DEPENDENCY_PATH := $(call my-dir) +LOCAL_PATH := $(abspath $(DEPENDENCY_PATH)) + +include $(CLEAR_VARS) +# Project configuration +LOCAL_MODULE := GhostCubeSceneEmulator +LOCAL_CFLAGS := -std=c++11 +LOCAL_CPP_FEATURES := exceptions +LOCAL_LDLIBS := -lGLESv3 -lEGL -llog -landroid + +# !!!!! VERY IMPORTANT !!!!! +# Not too smart gcc linker links libraries in the order they are declared. From each library it only exports the +# methods/functions required to resolve CURRENTLY OUTSTANDING dependencies and ignores the rest. +# If a subsequent library then uses methods/functions that were not originally required by the objects, you will +# have missing dependencies. +LOCAL_STATIC_LIBRARIES := UnityEmulator-prebuilt GraphicsEngine-prebuilt GraphicsTools-prebuilt cpufeatures android_native_app_glue ndk_helper +# These libraries depend on each other +LOCAL_WHOLE_STATIC_LIBRARIES := AndroidPlatform-prebuilt BasicPlatform-prebuilt Common-prebuilt +LOCAL_SHARED_LIBRARIES := GhostCubePlugin-prebuilt GraphicsEngineOpenGL-prebuilt + +# Include paths +PROJECT_ROOT := $(LOCAL_PATH)/../../.. +ENGINE_ROOT := $(PROJECT_ROOT)/../.. +CORE_ROOT := $(ENGINE_ROOT)/diligentcore +TOOLS_ROOT := $(ENGINE_ROOT)/diligenttools +SAMPLES_ROOT := $(ENGINE_ROOT)/diligentsamples + +LOCAL_C_INCLUDES += $(PROJECT_ROOT)/../GhostCubePlugin/PluginSource/src/Unity +# include directories for static libraries are declared in corresponding LOCAL_EXPORT_C_INCLUDES sections + + +# Source files +#VisualGDBAndroid: AutoUpdateSourcesInNextLine +LOCAL_SRC_FILES := ../../../src/Android/AndroidMain.cpp ../../../src/GhostCubeScene.cpp + +include $(BUILD_SHARED_LIBRARY) + + +# Declare pre-built static libraries + +include $(CLEAR_VARS) +# Declare pre-built Common library +LOCAL_MODULE := UnityEmulator-prebuilt +LOCAL_SRC_FILES := $(PROJECT_ROOT)/../UnityEmulator/build/Win32/obj/local/$(TARGET_ARCH_ABI)/libUnityEmulator.a + +# The LOCAL_EXPORT_C_INCLUDES definition ensures that any module that depends on the +# prebuilt one will have its LOCAL_C_INCLUDES automatically prepended with the path to the +# prebuilt's include directory, and will thus be able to find headers inside that. +LOCAL_EXPORT_C_INCLUDES := $(PROJECT_ROOT)/../UnityEmulator/include + +include $(PREBUILT_STATIC_LIBRARY) + + +# Declare pre-built static libraries + +include $(CLEAR_VARS) +# Declare pre-built Common library +LOCAL_MODULE := Common-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Common/build/Win32/obj/local/$(TARGET_ARCH_ABI)/libCommon.a + +# The LOCAL_EXPORT_C_INCLUDES definition ensures that any module that depends on the +# prebuilt one will have its LOCAL_C_INCLUDES automatically prepended with the path to the +# prebuilt's include directory, and will thus be able to find headers inside that. +LOCAL_EXPORT_C_INCLUDES := $(CORE_ROOT)/Common/include $(CORE_ROOT)/Common/interface $(CORE_ROOT)/Platforms/interface + +include $(PREBUILT_STATIC_LIBRARY) + + +include $(CLEAR_VARS) +# Declare pre-built AndroidPlatform library +LOCAL_MODULE := AndroidPlatform-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Platforms/Android/build/Windows/obj/local/$(TARGET_ARCH_ABI)/libAndroidPlatform.a +LOCAL_EXPORT_C_INCLUDES := $(CORE_ROOT)/Platforms/interface +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +# Declare pre-built BasicPlatform library +LOCAL_MODULE := BasicPlatform-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Platforms/Basic/build/Win32/obj/local/$(TARGET_ARCH_ABI)/libBasicPlatform.a +include $(PREBUILT_STATIC_LIBRARY) + + +include $(CLEAR_VARS) +# Declare pre-built GraphicsEngine library +LOCAL_MODULE := GraphicsEngine-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Graphics/GraphicsEngine/build/Win32/obj/local/$(TARGET_ARCH_ABI)/libGraphicsEngine.a +LOCAL_EXPORT_C_INCLUDES := $(CORE_ROOT)/Graphics/GraphicsEngine/interface +include $(PREBUILT_STATIC_LIBRARY) + + +include $(CLEAR_VARS) +# Declare pre-built GraphicsEngineOpenGL library +LOCAL_MODULE := GraphicsEngineOpenGL-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Graphics/GraphicsEngineOpenGL/build/Win32/libs/$(TARGET_ARCH_ABI)/libGraphicsEngineOpenGL.so +LOCAL_EXPORT_C_INCLUDES := $(CORE_ROOT)/Graphics/GraphicsEngineOpenGL/interface +include $(PREBUILT_SHARED_LIBRARY) + +include $(CLEAR_VARS) +# Declare pre-built Graphics Tools library +LOCAL_MODULE := GraphicsTools-prebuilt +LOCAL_SRC_FILES := $(CORE_ROOT)/Graphics/GraphicsTools/build/Win32/obj/local/$(TARGET_ARCH_ABI)/libGraphicsTools.a +LOCAL_EXPORT_C_INCLUDES := $(CORE_ROOT)/Graphics/GraphicsTools/include +include $(PREBUILT_STATIC_LIBRARY) + + +include $(CLEAR_VARS) +# Declare pre-built GhostCubePlugin library +LOCAL_MODULE := GhostCubePlugin-prebuilt +LOCAL_SRC_FILES := $(PROJECT_ROOT)/../GhostCubePlugin/PluginSource/build/Win32/libs/$(TARGET_ARCH_ABI)/libGhostCubePlugin.so +include $(PREBUILT_SHARED_LIBRARY) + + +$(call import-module,android/ndk_helper) +$(call import-module,android/native_app_glue) +$(call import-module,android/cpufeatures) + diff --git a/unityplugin/GhostCubeScene/build/Win32/jni/Application.mk b/unityplugin/GhostCubeScene/build/Win32/jni/Application.mk new file mode 100644 index 0000000..08521c2 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/jni/Application.mk @@ -0,0 +1,7 @@ +# Generated by VisualGDB + +DEPENDENCY_PATH := $(call my-dir) +LOCAL_PATH := $(abspath $(DEPENDENCY_PATH)) +include $(LOCAL_PATH)/../../../../../diligentcore/Common/make/AppCommon.mk + +APP_MODULES := GhostCubeSceneEmulator \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/res/drawable-hdpi/ic_launcher.png b/unityplugin/GhostCubeScene/build/Win32/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..ea01cbf Binary files /dev/null and b/unityplugin/GhostCubeScene/build/Win32/res/drawable-hdpi/ic_launcher.png differ diff --git a/unityplugin/GhostCubeScene/build/Win32/res/drawable-ldpi/ic_launcher.png b/unityplugin/GhostCubeScene/build/Win32/res/drawable-ldpi/ic_launcher.png new file mode 100644 index 0000000..a3d6a18 Binary files /dev/null and b/unityplugin/GhostCubeScene/build/Win32/res/drawable-ldpi/ic_launcher.png differ diff --git a/unityplugin/GhostCubeScene/build/Win32/res/drawable-mdpi/ic_launcher.png b/unityplugin/GhostCubeScene/build/Win32/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..8f80897 Binary files /dev/null and b/unityplugin/GhostCubeScene/build/Win32/res/drawable-mdpi/ic_launcher.png differ diff --git a/unityplugin/GhostCubeScene/build/Win32/res/drawable-xhdpi/ic_launcher.png b/unityplugin/GhostCubeScene/build/Win32/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..b779a2b Binary files /dev/null and b/unityplugin/GhostCubeScene/build/Win32/res/drawable-xhdpi/ic_launcher.png differ diff --git a/unityplugin/GhostCubeScene/build/Win32/res/layout/widgets.xml b/unityplugin/GhostCubeScene/build/Win32/res/layout/widgets.xml new file mode 100644 index 0000000..36b64f3 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/res/layout/widgets.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/res/values-v11/styles.xml b/unityplugin/GhostCubeScene/build/Win32/res/values-v11/styles.xml new file mode 100644 index 0000000..541752f --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/res/values-v11/styles.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/res/values-v14/styles.xml b/unityplugin/GhostCubeScene/build/Win32/res/values-v14/styles.xml new file mode 100644 index 0000000..f20e015 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/res/values-v14/styles.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/res/values/strings.xml b/unityplugin/GhostCubeScene/build/Win32/res/values/strings.xml new file mode 100644 index 0000000..f29ce4e --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/res/values/strings.xml @@ -0,0 +1,6 @@ + + + Ghost cube scene emulator + GhostCubePlugin + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/res/values/styles.xml b/unityplugin/GhostCubeScene/build/Win32/res/values/styles.xml new file mode 100644 index 0000000..4a10ca4 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/res/values/styles.xml @@ -0,0 +1,20 @@ + + + + + + + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/run.bat b/unityplugin/GhostCubeScene/build/Win32/run.bat new file mode 100644 index 0000000..043e72e --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run.bat @@ -0,0 +1,15 @@ +@echo off +cd ..\. +SET SAMPLE_PATH="..\..\..\..\build\Win32\bin\%~1\GhostCubeScene\GhostCubeScene.exe" + +if not exist %SAMPLE_PATH% ( + rem echo Executable not found in the diligentsamples\build\Win32 directory. Checking parent directory. + SET SAMPLE_PATH="..\"%SAMPLE_PATH% +) + +if not exist %SAMPLE_PATH% ( + echo Executable not found. Please build the solution for the selected configuration. + exit /B 1 +) + +%SAMPLE_PATH% mode=%~2 diff --git a/unityplugin/GhostCubeScene/build/Win32/run_d3d11_32d.bat b/unityplugin/GhostCubeScene/build/Win32/run_d3d11_32d.bat new file mode 100644 index 0000000..fcbcf78 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run_d3d11_32d.bat @@ -0,0 +1 @@ +call run.bat Debug_Win32 D3D11 \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/run_d3d11_32r.bat b/unityplugin/GhostCubeScene/build/Win32/run_d3d11_32r.bat new file mode 100644 index 0000000..5b6c8f9 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run_d3d11_32r.bat @@ -0,0 +1 @@ +call run.bat Release_Win32 D3D11 \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/run_d3d11_64d.bat b/unityplugin/GhostCubeScene/build/Win32/run_d3d11_64d.bat new file mode 100644 index 0000000..7b0b91b --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run_d3d11_64d.bat @@ -0,0 +1 @@ +call run.bat Debug_x64 D3D11 \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/run_d3d11_64r.bat b/unityplugin/GhostCubeScene/build/Win32/run_d3d11_64r.bat new file mode 100644 index 0000000..e0ebaf4 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run_d3d11_64r.bat @@ -0,0 +1 @@ +call run.bat Release_x64 D3D11 \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/run_d3d12_32r.bat b/unityplugin/GhostCubeScene/build/Win32/run_d3d12_32r.bat new file mode 100644 index 0000000..848b7b8 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run_d3d12_32r.bat @@ -0,0 +1 @@ +call run.bat Release_Win32 D3D12 \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/run_d3d12_64d.bat b/unityplugin/GhostCubeScene/build/Win32/run_d3d12_64d.bat new file mode 100644 index 0000000..f74f35c --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run_d3d12_64d.bat @@ -0,0 +1 @@ +call run.bat Debug_x64 D3D12 \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/run_d3d12_64r.bat b/unityplugin/GhostCubeScene/build/Win32/run_d3d12_64r.bat new file mode 100644 index 0000000..21e7b30 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run_d3d12_64r.bat @@ -0,0 +1 @@ +call run.bat Release_x64 D3D12 \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/run_gl_32d.bat b/unityplugin/GhostCubeScene/build/Win32/run_gl_32d.bat new file mode 100644 index 0000000..bd2e2d5 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run_gl_32d.bat @@ -0,0 +1 @@ +call run.bat Debug_Win32 GL \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/run_gl_32r.bat b/unityplugin/GhostCubeScene/build/Win32/run_gl_32r.bat new file mode 100644 index 0000000..25b66c3 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run_gl_32r.bat @@ -0,0 +1 @@ +call run.bat Release_Win32 GL \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/run_gl_64d.bat b/unityplugin/GhostCubeScene/build/Win32/run_gl_64d.bat new file mode 100644 index 0000000..c01b4e3 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run_gl_64d.bat @@ -0,0 +1 @@ +call run.bat Debug_x64 GL \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Win32/run_gl_64r.bat b/unityplugin/GhostCubeScene/build/Win32/run_gl_64r.bat new file mode 100644 index 0000000..3025ab2 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Win32/run_gl_64r.bat @@ -0,0 +1 @@ +call run.bat Release_x64 GL \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.Shared.vcxitems b/unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.Shared.vcxitems new file mode 100644 index 0000000..4bdbd66 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.Shared.vcxitems @@ -0,0 +1,27 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {f26d9028-cfb4-45bc-9ab9-28e332480564} + GhostCubeScene + GhostCubeScene.Shared + ee85241f-efeb-4c0a-a2dc-724cc15edec0 + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + + + + + + + + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.Shared.vcxitems.filters b/unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.Shared.vcxitems.filters new file mode 100644 index 0000000..674de74 --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.Shared.vcxitems.filters @@ -0,0 +1,27 @@ + + + + + {c8b2817b-474c-4084-89e1-6e79260fbf11} + + + {038e521a-1981-43c0-a93a-5dcb35a59f70} + + + + + src + + + src + + + + + include + + + include + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.props b/unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.props new file mode 100644 index 0000000..a0c341c --- /dev/null +++ b/unityplugin/GhostCubeScene/build/Windows.Shared/GhostCubeScene.props @@ -0,0 +1,37 @@ + + + + + ..\.. + $(ProjectRoot)\build\assets + $(ProjectRoot)\..\.. + $(EngineRoot)\diligentcore + $(EngineRoot)\diligenttools + + + $(CoreRoot)\Graphics\GraphicsEngine\interface;$(CoreRoot)\Graphics\GraphicsEngineD3D11\interface;$(CoreRoot)\Graphics\GraphicsEngineD3D12\interface;$(CoreRoot)\Graphics\GraphicsEngineOpenGL\interface;$(CoreRoot)\Common\include;$(CoreRoot)\Common\interface;$(CoreRoot)\Platforms\interface;$(CoreRoot)\Graphics\GraphicsTools\include;$(ProjectRoot)\..\UnityEmulator\Include;$(ProjectRoot)\..\GhostCubePlugin\PluginSource\src\Unity;$(IncludePath) + + + + + d3d11.lib;d3d12.lib;dxgi.lib;d3dcompiler.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + $(ProjectRoot) + + + $(AssetsPath) + + + $(EngineRoot) + + + $(CoreRoot) + + + $(ToolsRoot) + + + \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/build/assets/shaders/Mirror.psh b/unityplugin/GhostCubeScene/build/assets/shaders/Mirror.psh new file mode 100644 index 0000000..86b4beb --- /dev/null +++ b/unityplugin/GhostCubeScene/build/assets/shaders/Mirror.psh @@ -0,0 +1,14 @@ + +Texture2D g_tex2Reflection; +SamplerState g_tex2Reflection_sampler; + +struct PSInput +{ + float4 Pos : SV_POSITION; + float2 UV : TEX_COORD; +}; + +float4 main(PSInput In) : SV_Target +{ + return g_tex2Reflection.Sample(g_tex2Reflection_sampler, In.UV); +} diff --git a/unityplugin/GhostCubeScene/build/assets/shaders/Mirror.vsh b/unityplugin/GhostCubeScene/build/assets/shaders/Mirror.vsh new file mode 100644 index 0000000..bdeaaca --- /dev/null +++ b/unityplugin/GhostCubeScene/build/assets/shaders/Mirror.vsh @@ -0,0 +1,33 @@ +cbuffer Constants +{ + float4x4 g_WorldViewProj; +}; + +struct PSInput +{ + float4 Pos : SV_POSITION; + float2 UV : TEX_COORD; +}; + +PSInput main(uint VertId : SV_VertexID) +{ + float4 Pos[] = + { + float4(-0.5, +0.5, 0.0, 1.0), + float4(-0.5, -0.5, 0.0, 1.0), + float4(+0.5, +0.5, 0.0, 1.0), + float4(+0.5, -0.5, 0.0, 1.0) + }; + float2 UV[] = + { + float2(0.0, 1.0), + float2(0.0, 0.0), + float2(1.0, 1.0), + float2(1.0, 0.0) + }; + + PSInput ps; + ps.Pos = mul( Pos[VertId], g_WorldViewProj); + ps.UV = UV[VertId]; + return ps; +} diff --git a/unityplugin/GhostCubeScene/src/Android/AndroidMain.cpp b/unityplugin/GhostCubeScene/src/Android/AndroidMain.cpp new file mode 100644 index 0000000..e2e659c --- /dev/null +++ b/unityplugin/GhostCubeScene/src/Android/AndroidMain.cpp @@ -0,0 +1,58 @@ +/* Copyright 2015-2017 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +// This header must be included, otherwise the linker will somehow fail to find android_main() +#include +#include +#include "IUnityInterface.h" + +extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetMatrixFromUnity + (float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33); + +extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API SetTexturesFromUnity(void* renderTargetHandle, void *depthBufferHandle); + +// Actual implementation of the android_main() +void android_main_impl( struct android_app* state ); + + +void *LoadPluginFunction(const char *name) +{ + static std::unordered_map functions_map = + { + {"SetMatrixFromUnity", reinterpret_cast(SetMatrixFromUnity) }, + {"SetTexturesFromUnity", reinterpret_cast(SetTexturesFromUnity) } + }; + auto it = functions_map.find(name); + return it != functions_map.end() ? it->second : nullptr; +} + +// When a native library is being loaded, JNI loader looks for the android_main function. +// If the entry does not export that function, it will fail to load. So we have to define +// android_main() in every android native application +void android_main( android_app* state ) +{ + android_main_impl(state); +} diff --git a/unityplugin/GhostCubeScene/src/GhostCubeScene.cpp b/unityplugin/GhostCubeScene/src/GhostCubeScene.cpp new file mode 100644 index 0000000..2fb3a97 --- /dev/null +++ b/unityplugin/GhostCubeScene/src/GhostCubeScene.cpp @@ -0,0 +1,215 @@ +/* Copyright 2015-2017 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "GhostCubeScene.h" +#include "BasicMath.h" +#include +#include "BasicShaderSourceStreamFactory.h" +#include "GraphicsUtilities.h" +#include "MapHelper.h" +#include "CommonlyUsedStates.h" + +#if defined(PLATFORM_WIN32) || defined(PLATFORM_UNIVERSAL_WINDOWS) +# define D3D12_SUPPORTED 1 +#else +# define D3D12_SUPPORTED 0 +#endif + +#if D3D12_SUPPORTED +# include "GhostCubeSceneResTrsnHelper.h" +#endif + +using namespace Diligent; + +UnitySceneBase* CreateScene() +{ + return new GhostCubeScene; +} + + +void GhostCubeScene::OnPluginLoad(TLoadPluginFunction LoadPluginFunctionCallback) +{ + SetMatrixFromUnity = reinterpret_cast( LoadPluginFunctionCallback("SetMatrixFromUnity") ); + VERIFY_EXPR(SetMatrixFromUnity != nullptr); + + SetTexturesFromUnity = reinterpret_cast( LoadPluginFunctionCallback("SetTexturesFromUnity") ); + VERIFY_EXPR(SetTexturesFromUnity != nullptr); +} + +void GhostCubeScene::OnPluginUnload() +{ +} + +void GhostCubeScene::OnGraphicsInitialized() +{ + auto pDevice = m_DiligentGraphics->GetDevice(); + TextureDesc TexDesc; + TexDesc.Name = "Mirror render target"; + TexDesc.Type = RESOURCE_DIM_TEX_2D; + TexDesc.Width = 1024; + TexDesc.Height = 1024; + TexDesc.Format = TEX_FORMAT_RGBA8_UNORM_SRGB; + TexDesc.BindFlags = BIND_RENDER_TARGET | BIND_SHADER_RESOURCE; + TexDesc.ClearValue.Color[0] = 0.f; + TexDesc.ClearValue.Color[1] = 0.2f; + TexDesc.ClearValue.Color[2] = 0.5f; + TexDesc.ClearValue.Color[3] = 1.0f; + pDevice->CreateTexture(TexDesc, TextureData(), &m_pRenderTarget); + + TexDesc.Name = "Mirror depth buffer"; + TexDesc.Format = TEX_FORMAT_D32_FLOAT; + TexDesc.BindFlags = BIND_DEPTH_STENCIL | BIND_SHADER_RESOURCE; + TexDesc.ClearValue.DepthStencil.Depth = 0.f; + pDevice->CreateTexture(TexDesc, TextureData(), &m_pDepthBuffer); + + auto deviceType = pDevice->GetDeviceCaps().DevType; + { + const auto &SCDesc = m_DiligentGraphics->GetSwapChain()->GetDesc(); + auto UseReverseZ = m_DiligentGraphics->UsesReverseZ(); + + PipelineStateDesc PSODesc; + PSODesc.IsComputePipeline = false; + PSODesc.Name = "Render sample cube PSO"; + PSODesc.GraphicsPipeline.NumRenderTargets = 1; + + PSODesc.GraphicsPipeline.RTVFormats[0] = SCDesc.ColorBufferFormat == TEX_FORMAT_RGBA8_UNORM ? TEX_FORMAT_RGBA8_UNORM_SRGB : SCDesc.ColorBufferFormat; + PSODesc.GraphicsPipeline.DSVFormat = SCDesc.DepthBufferFormat; + PSODesc.GraphicsPipeline.PrimitiveTopologyType = PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE; + PSODesc.GraphicsPipeline.RasterizerDesc.CullMode = CULL_MODE_BACK; + PSODesc.GraphicsPipeline.DepthStencilDesc.DepthFunc = UseReverseZ ? COMPARISON_FUNC_GREATER_EQUAL : COMPARISON_FUNC_LESS_EQUAL; + + ShaderCreationAttribs CreationAttribs; + BasicShaderSourceStreamFactory BasicSSSFactory("shaders"); + CreationAttribs.pShaderSourceStreamFactory = &BasicSSSFactory; + CreationAttribs.SourceLanguage = SHADER_SOURCE_LANGUAGE_HLSL; + CreationAttribs.Desc.DefaultVariableType = SHADER_VARIABLE_TYPE_STATIC; + + CreateUniformBuffer(pDevice, sizeof(float4x4), "Mirror VS constants CB", &m_pMirrorVSConstants); + + RefCntAutoPtr pVS; + { + CreationAttribs.Desc.ShaderType = SHADER_TYPE_VERTEX; + CreationAttribs.EntryPoint = "main"; + CreationAttribs.Desc.Name = "Mirror VS"; + CreationAttribs.FilePath = "Mirror.vsh"; + pDevice->CreateShader(CreationAttribs, &pVS); + pVS->GetShaderVariable("Constants")->Set(m_pMirrorVSConstants); + } + + + RefCntAutoPtr pPS; + { + CreationAttribs.Desc.ShaderType = SHADER_TYPE_PIXEL; + CreationAttribs.EntryPoint = "main"; + CreationAttribs.Desc.Name = "Mirror PS"; + CreationAttribs.FilePath = "Mirror.psh"; + StaticSamplerDesc StaticSamplers[] = + { + {"g_tex2Reflection", Sam_Aniso4xClamp} + }; + CreationAttribs.Desc.StaticSamplers = StaticSamplers; + CreationAttribs.Desc.NumStaticSamplers = _countof(StaticSamplers); + pDevice->CreateShader(CreationAttribs, &pPS); + pPS->GetShaderVariable("g_tex2Reflection")->Set(m_pRenderTarget->GetDefaultView(TEXTURE_VIEW_SHADER_RESOURCE)); + } + + PSODesc.GraphicsPipeline.pVS = pVS; + PSODesc.GraphicsPipeline.pPS = pPS; + pDevice->CreatePipelineState(PSODesc, &m_pMirrorPSO); + } +#if D3D12_SUPPORTED + m_pStateTransitionHandler.reset(new GhostCubeSceneResTrsnHelper(*this)); +#endif +} + +void GhostCubeScene::Render(UnityRenderingEvent RenderEventFunc, double CurrTime, double ElapsedTime) +{ + auto pDevice = m_DiligentGraphics->GetDevice(); + auto pCtx = m_DiligentGraphics->GetContext(); + auto DevType = pDevice->GetDeviceCaps().DevType; + bool IsDX = DevType == DeviceType::D3D11 || DevType == DeviceType::D3D12; + auto ReverseZ = m_DiligentGraphics->UsesReverseZ(); + + // In OpenGL, render targets must be bound to the pipeline to be cleared + ITextureView *pRTVs[] = { m_pRenderTarget->GetDefaultView(TEXTURE_VIEW_RENDER_TARGET) }; + ITextureView *pDSV = m_pDepthBuffer->GetDefaultView(TEXTURE_VIEW_DEPTH_STENCIL); + pCtx->SetRenderTargets(1, pRTVs, pDSV); + const float ClearColor[] = { 0.f, 0.2f, 0.5f, 1.0f }; + pCtx->ClearRenderTarget(pRTVs[0], ClearColor); + pCtx->ClearDepthStencil(pDSV, CLEAR_DEPTH_FLAG, ReverseZ ? 0.f : 1.f, 0); + + if (DevType == DeviceType::D3D12) + { + // D3D12 context must be flushed so that the commands are submitted before the + // commands issued by the plugin + pCtx->Flush(); + } + + + // Render ghost cube into the mirror texture + { + // Create fake reflection matrix + float4x4 CubeWorldView = scaleMatrix(1,2,1) * rotationY( -static_cast(CurrTime) * 2.0f) * rotationX(-PI_F*0.3f) * translationMatrix(0.f, 0.0f, 10.0f); + float NearPlane = 0.3f; + float FarPlane = 1000.f; + if (ReverseZ) + std::swap(NearPlane, FarPlane); + float aspectRatio = 1.0f; + float4x4 ReflectionCameraProj = Projection(PI_F / 4.f, aspectRatio, NearPlane, FarPlane, IsDX); + auto wvp = CubeWorldView * ReflectionCameraProj; + float ReverseZ = IsDX ? -1.f : +1.f; + SetMatrixFromUnity(wvp._m00, ReverseZ * wvp._m01, wvp._m02, wvp._m03, + wvp._m10, ReverseZ * wvp._m11, wvp._m12, wvp._m13, + wvp._m20, ReverseZ * wvp._m21, wvp._m22, wvp._m23, + wvp._m30, ReverseZ * wvp._m31, wvp._m32, wvp._m33); + + SetTexturesFromUnity(m_pRenderTarget->GetNativeHandle(), m_pDepthBuffer->GetNativeHandle()); + + // Call the plugin + RenderEventFunc(0); + } + + // We need to invalidate the context state since the plugin has used d3d11 context + pCtx->InvalidateState(); + pCtx->SetRenderTargets(0, nullptr, nullptr); + pCtx->SetPipelineState(m_pMirrorPSO); + pCtx->CommitShaderResources(nullptr, COMMIT_SHADER_RESOURCES_FLAG_TRANSITION_RESOURCES); + + { + float4x4 MirrorWorldView = scaleMatrix(5,5,5) * rotationX(PI_F*0.6f) * translationMatrix(0.f, -3.0f, 10.0f); + float NearPlane = 0.3f; + float FarPlane = 1000.f; + if (ReverseZ) + std::swap(NearPlane, FarPlane); + float AspectRatio = static_cast(m_WindowWidth) / static_cast(std::max(m_WindowHeight, 1)); + float4x4 MainCameraProj = Projection(PI_F / 3.f, AspectRatio, NearPlane, FarPlane, IsDX); + auto wvp = MirrorWorldView * MainCameraProj; + MapHelper CBConstants(pCtx, m_pMirrorVSConstants, MAP_WRITE, MAP_FLAG_DISCARD); + *CBConstants = transposeMatrix(wvp); + } + + DrawAttribs DrawAttrs; + DrawAttrs.NumVertices = 4; + DrawAttrs.Topology = PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; + pCtx->Draw(DrawAttrs); +} diff --git a/unityplugin/GhostCubeScene/src/GhostCubeScene.h b/unityplugin/GhostCubeScene/src/GhostCubeScene.h new file mode 100644 index 0000000..546acaf --- /dev/null +++ b/unityplugin/GhostCubeScene/src/GhostCubeScene.h @@ -0,0 +1,58 @@ +/* Copyright 2015-2017 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "UnitySceneBase.h" +#include "IUnityInterface.h" + +using TSetMatrixFromUnity = void (UNITY_INTERFACE_API *) (float m00, float m01, float m02, float m03, + float m10, float m11, float m12, float m13, + float m20, float m21, float m22, float m23, + float m30, float m31, float m32, float m33); +using TSetTexturesFromUnity = void (UNITY_INTERFACE_API *)(void* renderTargetHandle, void *depthBufferHandle); + +class GhostCubeScene : public UnitySceneBase +{ +public: + virtual void OnPluginLoad(TLoadPluginFunction LoadPluginFunctionCallback)override final; + + virtual void OnPluginUnload()override final; + + virtual void OnGraphicsInitialized()override final; + + virtual void Render(UnityRenderingEvent RenderEventFunc, double CurrTime, double ElapsedTime)override final; + + virtual const char* GetSceneName()override final { return "Ghost Cube Scene"; } + + virtual const char* GetPluginName()override final { return "GhostCubePlugin"; } + +private: + friend class GhostCubeSceneResTrsnHelper; + + TSetMatrixFromUnity SetMatrixFromUnity; + TSetTexturesFromUnity SetTexturesFromUnity; + + Diligent::RefCntAutoPtr m_pRenderTarget; + Diligent::RefCntAutoPtr m_pDepthBuffer; + Diligent::RefCntAutoPtr m_pMirrorVSConstants; + Diligent::RefCntAutoPtr m_pMirrorPSO; +}; \ No newline at end of file diff --git a/unityplugin/GhostCubeScene/src/GhostCubeSceneResTrsnHelper.cpp b/unityplugin/GhostCubeScene/src/GhostCubeSceneResTrsnHelper.cpp new file mode 100644 index 0000000..504a633 --- /dev/null +++ b/unityplugin/GhostCubeScene/src/GhostCubeSceneResTrsnHelper.cpp @@ -0,0 +1,62 @@ +/* Copyright 2015-2017 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ +#include + +#include "GhostCubeSceneResTrsnHelper.h" +#include "GhostCubeScene.h" +#include "IUnityGraphicsD3D12.h" +#include "TextureD3D12.h" +#include "DeviceContextD3D12.h" +#include "ValidatedCast.h" + + +using namespace Diligent; + +void GhostCubeSceneResTrsnHelper::TransitionResources(int stateCount, UnityGraphicsD3D12ResourceState* states) +{ + if (stateCount == 0) + return; + + auto *pCtx = ValidatedCast(m_TheScene.m_DiligentGraphics->GetContext()); + for (int i = 0; i < stateCount; ++i) + { + auto &ResState = states[i]; + ITextureD3D12 *pMirrorRT = ValidatedCast(m_TheScene.m_pRenderTarget.RawPtr()); + ITextureD3D12 *pMirrorDepth = ValidatedCast(m_TheScene.m_pDepthBuffer.RawPtr()); + ITextureD3D12 *pResToTransition = nullptr; + if (ResState.resource == pMirrorRT->GetD3D12Texture()) + pResToTransition = pMirrorRT; + else if(ResState.resource == pMirrorDepth->GetD3D12Texture()) + pResToTransition = pMirrorDepth; + else + { + UNEXPECTED("Unexpected resource to transition") + } + if (pResToTransition) + { + pCtx->TransitionTextureState(pResToTransition, ResState.expected); + pResToTransition->SetD3D12ResourceState(ResState.current); + } + } + pCtx->Flush(); +} diff --git a/unityplugin/GhostCubeScene/src/GhostCubeSceneResTrsnHelper.h b/unityplugin/GhostCubeScene/src/GhostCubeSceneResTrsnHelper.h new file mode 100644 index 0000000..794c2de --- /dev/null +++ b/unityplugin/GhostCubeScene/src/GhostCubeSceneResTrsnHelper.h @@ -0,0 +1,38 @@ +/* Copyright 2015-2017 Egor Yusov + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. + * + * In no event and under no legal theory, whether in tort (including negligence), + * contract, or otherwise, unless required by applicable law (such as deliberate + * and grossly negligent acts) or agreed to in writing, shall any Contributor be + * liable for any damages, including any direct, indirect, special, incidental, + * or consequential damages of any character arising as a result of this License or + * out of the use or inability to use the software (including but not limited to damages + * for loss of goodwill, work stoppage, computer failure or malfunction, or any and + * all other commercial damages or losses), even if such Contributor has been advised + * of the possibility of such damages. + */ + +#include "ResourceStateTransitionHandler.h" + +class GhostCubeScene; +class GhostCubeSceneResTrsnHelper : public IResourceStateTransitionHandler +{ +public: + GhostCubeSceneResTrsnHelper(GhostCubeScene& TheScene) : + m_TheScene(TheScene) + {} + virtual ~GhostCubeSceneResTrsnHelper()override {} + virtual void TransitionResources(int stateCount, UnityGraphicsD3D12ResourceState* states)override final; + +private: + GhostCubeScene& m_TheScene; +}; -- cgit v1.2.3