From aa69b18e04fd1786fb42e0ef4e017487a32f9d91 Mon Sep 17 00:00:00 2001 From: Turanszki Janos Date: Wed, 13 May 2020 22:42:57 +0100 Subject: [PATCH] uwp fixes and content packaging project --- Content.vcxitems | 655 ++++++++++++++++++++++++++++++++++++ Content.vcxitems.filters | 496 +++++++++++++++++++++++++++ Editor/Editor.cpp | 94 ++++++ Editor/Editor_UWP.vcxproj | 1 + WickedEngine.sln | 4 + WickedEngine/wiHelper.cpp | 6 +- WickedEngine/wiVersion.cpp | 2 +- models/Sponza/copyright.txt | 25 ++ 8 files changed, 1279 insertions(+), 4 deletions(-) create mode 100644 Content.vcxitems create mode 100644 Content.vcxitems.filters create mode 100644 models/Sponza/copyright.txt diff --git a/Content.vcxitems b/Content.vcxitems new file mode 100644 index 000000000..75b7452fd --- /dev/null +++ b/Content.vcxitems @@ -0,0 +1,655 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {c48f6bff-f91b-4db5-98b5-15287dfb7c95} + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Content.vcxitems.filters b/Content.vcxitems.filters new file mode 100644 index 000000000..4baf7563f --- /dev/null +++ b/Content.vcxitems.filters @@ -0,0 +1,496 @@ + + + + + {341af3e7-9353-4ed5-9a03-c6dc8d522336} + + + {1e52ef96-0bb7-4391-a08b-70de0073ef4b} + + + {3dd2f7b1-11bc-47f3-84b7-6a0b1430069c} + + + {79c15acb-1f18-400c-82b4-846dfdd4ab85} + + + {313c5c5a-2029-43a8-99ca-cc56f435121c} + + + {6f72400d-8b00-4dc0-8015-f88dd5d4c11b} + + + {2ba616fc-e2c9-4af4-9099-948f45e2dd80} + + + + + scripts + + + scripts + + + scripts + + + scripts + + + scripts + + + scripts + + + scripts + + + scripts + + + scripts + + + scripts + + + scripts + + + scripts + + + models\Sponza + + + models\Havoc + + + models\dungeon + + + models\dungeon + + + models\dungeon + + + models\dungeon + + + models\dungeon + + + models\dungeon + + + models\dungeon + + + models\dungeon + + + models\dungeon + + + models\dungeon + + + models\dungeon + + + models\dungeon + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + + + images + + + images + + + images + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Sponza\textures + + + models\Havoc + + + models\Havoc + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + models + + + + + models + + + + + models\Sponza + + + \ No newline at end of file diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index be3fa8dc6..ec5935227 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -28,6 +28,44 @@ #include +#ifdef PLATFORM_UWP +#include +#include +using namespace concurrency; +using namespace Platform; +using namespace Windows::Storage; +using namespace Windows::Storage::Pickers; +using namespace Windows::Storage::AccessCache; +using namespace Windows::Foundation::Collections; +void copy_folder(StorageFolder^ src, StorageFolder^ dst) { + create_task(src->GetItemsAsync()).then([=](IVectorView^ items) { + for (IStorageItem^ item : items) + { + if (item->IsOfType(StorageItemTypes::File)) + { + StorageFile^ file = (StorageFile^)item; + try { + file->CopyAsync(dst); + } + catch (...) { + // file already exists, we don't want to overwrite + } + } + else if (item->IsOfType(StorageItemTypes::Folder)) + { + StorageFolder^ src_child = (StorageFolder^)item; + create_task(dst->CreateFolderAsync(item->Name, CreationCollisionOption::OpenIfExists)).then([=](StorageFolder^ dst_child) { + if (dst_child) + { + copy_folder(src_child, dst_child); + } + }); + } + } + }); +}; +#endif // PLATFORM_UWP + using namespace std; using namespace wiGraphics; using namespace wiRectPacker; @@ -349,6 +387,62 @@ void EditorComponent::Load() { __super::Load(); +#ifdef PLATFORM_UWP + // On UWP we will copy the base content from application folder to 3D Objects directory + // for easy access to the user: + StorageFolder^ location = KnownFolders::Objects3D; + + // Objects3D/WickedEngine + create_task(location->CreateFolderAsync("WickedEngine", CreationCollisionOption::OpenIfExists)).then([=](StorageFolder^ destfolder) { + + string rootdir = wiHelper::ExpandPath(wiHelper::GetOriginalWorkingDirectory()); + wstring wstr; + + // images: + wiHelper::StringConvert(rootdir + "images\\", wstr); + create_task(StorageFolder::GetFolderFromPathAsync(ref new String(wstr.c_str()))).then([=](StorageFolder^ src) { + if (src) + { + create_task(destfolder->CreateFolderAsync("images", CreationCollisionOption::OpenIfExists)).then([=](StorageFolder^ dst) { + if (dst) + { + copy_folder(src, dst); + } + }); + } + }); + + // scripts: + wiHelper::StringConvert(rootdir + "scripts\\", wstr); + create_task(StorageFolder::GetFolderFromPathAsync(ref new String(wstr.c_str()))).then([=](StorageFolder^ src) { + if (src) + { + create_task(destfolder->CreateFolderAsync("scripts", CreationCollisionOption::OpenIfExists)).then([=](StorageFolder^ dst) { + if (dst) + { + copy_folder(src, dst); + } + }); + } + }); + + // models: + wiHelper::StringConvert(rootdir + "models\\", wstr); + create_task(StorageFolder::GetFolderFromPathAsync(ref new String(wstr.c_str()))).then([=](StorageFolder^ src) { + if (src) + { + create_task(destfolder->CreateFolderAsync("models", CreationCollisionOption::OpenIfExists)).then([=](StorageFolder^ dst) { + if (dst) + { + copy_folder(src, dst); + } + }); + } + }); + + }); +#endif // PLATFORM_UWP + wiJobSystem::context ctx; wiJobSystem::Execute(ctx, [this] { pointLightTex = wiResourceManager::Load("images/pointlight.dds"); }); wiJobSystem::Execute(ctx, [this] { spotLightTex = wiResourceManager::Load("images/spotlight.dds"); }); diff --git a/Editor/Editor_UWP.vcxproj b/Editor/Editor_UWP.vcxproj index 94135542a..ba4f3761c 100644 --- a/Editor/Editor_UWP.vcxproj +++ b/Editor/Editor_UWP.vcxproj @@ -106,6 +106,7 @@ + diff --git a/WickedEngine.sln b/WickedEngine.sln index 373129ad5..d24b8e278 100644 --- a/WickedEngine.sln +++ b/WickedEngine.sln @@ -29,6 +29,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WickedEngine_UWP", "WickedE EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WickedEngine_SHADERS", "WickedEngine\WickedEngine_SHADERS.vcxitems", "{92E86448-0724-4387-ABAC-96E63EDF4190}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Content", "Content.vcxitems", "{C48F6BFF-F91B-4DB5-98B5-15287DFB7C95}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution WickedEngine\WickedEngine_SHADERS.vcxitems*{06163dcb-b183-4ed9-9c62-13ef1658e049}*SharedItemsImports = 4 @@ -39,6 +41,8 @@ Global Editor\Editor_SOURCE.vcxitems*{867febca-09c4-4fe7-8a4c-4d9b1c27e7d0}*SharedItemsImports = 9 WickedEngine\WickedEngine_SHADERS.vcxitems*{92e86448-0724-4387-abac-96e63edf4190}*SharedItemsImports = 9 WickedEngine\WickedEngine_SHADERS.vcxitems*{c222218b-b6d1-406b-b2c0-8c1ced4a8d19}*SharedItemsImports = 4 + Content.vcxitems*{c48f6bff-f91b-4db5-98b5-15287dfb7c95}*SharedItemsImports = 9 + Content.vcxitems*{fa78bfad-4b23-4a6b-92fa-a48ce56bed03}*SharedItemsImports = 4 Editor\Editor_SOURCE.vcxitems*{fa78bfad-4b23-4a6b-92fa-a48ce56bed03}*SharedItemsImports = 4 WickedEngine\WickedEngine_SHADERS.vcxitems*{fa78bfad-4b23-4a6b-92fa-a48ce56bed03}*SharedItemsImports = 4 EndGlobalSection diff --git a/WickedEngine/wiHelper.cpp b/WickedEngine/wiHelper.cpp index 73c187fb1..107b15a54 100644 --- a/WickedEngine/wiHelper.cpp +++ b/WickedEngine/wiHelper.cpp @@ -203,13 +203,13 @@ namespace wiHelper return appDir; } + std::string workingdir = std::string(_getcwd(NULL, 0)) + "/"; + const std::string __originalWorkingDir = workingdir; string GetOriginalWorkingDirectory() { - static const string __originalWorkingDir = GetWorkingDirectory(); return __originalWorkingDir; } - std::string workingdir = std::string(_getcwd(NULL, 0)) + "/"; string GetWorkingDirectory() { return workingdir; @@ -699,7 +699,7 @@ namespace wiHelper case FileDialogParams::SAVE: { FileSavePicker^ picker = ref new FileSavePicker(); - picker->SuggestedStartLocation = PickerLocationId::ComputerFolder; + picker->SuggestedStartLocation = PickerLocationId::Objects3D; for (auto& x : params.extensions) { diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index d8a31dc06..9601767c7 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates const int minor = 42; // minor bug fixes, alterations, refactors, updates - const int revision = 1; + const int revision = 2; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision); diff --git a/models/Sponza/copyright.txt b/models/Sponza/copyright.txt new file mode 100644 index 000000000..1183020cc --- /dev/null +++ b/models/Sponza/copyright.txt @@ -0,0 +1,25 @@ +July 14, 2011 Morgan McGuire modified the model from Crytek's OBJ +export to correct some small errors. He computed bump maps from the +normal maps using normal2bump.cpp (since +MTL files expect height bumps, not normals), put the "mask" textures +into the alpha channel of the associated diffuse texture, cleaned up +noise in the masks, created the missing gi_flag.tga texture, and +removed the long untextured banner floating in the middle of the +atrium that appears in the file but in none of the published images of +the model. The banner is in banner.obj. + + + +http://www.crytek.com/cryengine/cryengine3/downloads + + +Sponza Model +August 19, 2010 +The Atrium Sponza Palace, Dubrovnik, is an elegant and improved model created by Frank Meinl. The original Sponza model was created by Marko Dabrovic in early 2002. Over the years, the Sponza Atrium scene has become one of the most popular 3D scenes for testing global illumination and radiosity due to it's specific architectural structure which is particularly complex for global illumination light. + +However, nowadays it is considered as a simple model, thus it was decided to crate a new model with highly improved appearance and scene complexity. It is donated to the public for radiosity and is represented in several different formats (3ds, Obj) for use with various commercial 3D applications and renderers. + + +Screenshot from the I3D paper +http://crytek.com/sites/default/files/20100301_lpv.pdf