diff --git a/.gitignore b/.gitignore index 0210746b..2c87b67c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,14 @@ [Ll]ibrary/ [Tt]emp/ [Oo]bj/ -[Bb]uild/ -[Bb]uilds/ +*[Bb]uild/ +*[Bb]uilds/*/*_BackUpThisFolder_ButDontShipItWithYourGame/ +*[Bb]uilds/*/MonoBleedingEdge/ +*[Bb]uilds/*/*_Data/ +*[Bb]uilds/*/*.exe +*[Bb]uilds/*/*.dll +*[Bb]uilds/*linux*/ +*[Bb]uilds/*macos*/ Assets/AssetStoreTools* # Visual Studio cache directory diff --git a/.idea/.idea.Materialize/.idea/contentModel.xml b/.idea/.idea.Materialize/.idea/contentModel.xml deleted file mode 100644 index 8ce1d54d..00000000 --- a/.idea/.idea.Materialize/.idea/contentModel.xml +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/.idea.Materialize/.idea/dictionaries/maikeu.xml b/.idea/.idea.Materialize/.idea/dictionaries/maikeu.xml deleted file mode 100644 index faeec120..00000000 --- a/.idea/.idea.Materialize/.idea/dictionaries/maikeu.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/.idea.Materialize/.idea/encodings.xml b/.idea/.idea.Materialize/.idea/encodings.xml deleted file mode 100644 index 15a15b21..00000000 --- a/.idea/.idea.Materialize/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/.idea.Materialize/.idea/indexLayout.xml b/.idea/.idea.Materialize/.idea/indexLayout.xml deleted file mode 100644 index 27ba142e..00000000 --- a/.idea/.idea.Materialize/.idea/indexLayout.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/.idea.Materialize/.idea/misc.xml b/.idea/.idea.Materialize/.idea/misc.xml deleted file mode 100644 index 1d8c84d0..00000000 --- a/.idea/.idea.Materialize/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/.idea.Materialize/.idea/modules.xml b/.idea/.idea.Materialize/.idea/modules.xml deleted file mode 100644 index c54070a4..00000000 --- a/.idea/.idea.Materialize/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/.idea.Materialize/.idea/vcs.xml b/.idea/.idea.Materialize/.idea/vcs.xml deleted file mode 100644 index 94a25f7f..00000000 --- a/.idea/.idea.Materialize/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/.idea.Materialize/.idea/workspace.xml b/.idea/.idea.Materialize/.idea/workspace.xml deleted file mode 100644 index f78fc236..00000000 --- a/.idea/.idea.Materialize/.idea/workspace.xml +++ /dev/null @@ -1,1723 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - format - original - temp - saveall - png - save pro - bmp - fil - CameraOffsetPos - alpha - CIH - CommandListExecutorScript - _jpgSelected - PostProcessGuiObject - clipboard - testObject - show full - show - materialgui - sample - MainGuiScript - suges - MGS - texture - key - windows.forms - _mainGui - smoothness - start - prev - - - MainGui.Instance - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1541032378210 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/.idea.Materialize/riderModule.iml b/.idea/.idea.Materialize/riderModule.iml deleted file mode 100644 index c63f8321..00000000 --- a/.idea/.idea.Materialize/riderModule.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.jpg.jpg b/.jpg.jpg deleted file mode 100644 index 2991395a..00000000 Binary files a/.jpg.jpg and /dev/null differ diff --git a/.mtz b/.mtz deleted file mode 100644 index 20072d0d..00000000 --- a/.mtz +++ /dev/null @@ -1,91 +0,0 @@ - - - - 0.0 - 0.0 - - 0 - 0 - 0 - 1 - - - 0 - 0 - - - 0 - 0 - 0 - 1 - - - 0 - 0 - - 0.3 - - null - - 0 - - null - null - - null - - - 0 - 0 - 0 - 1 - - - 0 - 0 - - - null - - - 0 - 0 - 0 - 1 - - - 0 - 0 - - - 0 - 0 - 0 - 1 - - - 0 - 0 - - - 0 - 0 - 0 - 1 - - - 0 - 0 - - - null - - null - - 50 - 0 - 0.0 - - null - - \ No newline at end of file diff --git a/.vsconfig b/.vsconfig new file mode 100644 index 00000000..d70cd98b --- /dev/null +++ b/.vsconfig @@ -0,0 +1,6 @@ +{ + "version": "1.0", + "components": [ + "Microsoft.VisualStudio.Workload.ManagedGame" + ] +} diff --git a/Assets/Main Canvas.prefab b/Assets/Main Canvas.prefab new file mode 100644 index 00000000..4bff69bf Binary files /dev/null and b/Assets/Main Canvas.prefab differ diff --git a/Assets/Main Canvas.prefab.meta b/Assets/Main Canvas.prefab.meta new file mode 100644 index 00000000..98baee7c --- /dev/null +++ b/Assets/Main Canvas.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 550b3105395d6af4893f2808748ae4f0 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MainScene.unity b/Assets/MainScene.unity index 495c2558..14f77218 100644 Binary files a/Assets/MainScene.unity and b/Assets/MainScene.unity differ diff --git a/Assets/MainScene/LightingData.asset b/Assets/MainScene/LightingData.asset index 046583c1..bc7ead43 100644 Binary files a/Assets/MainScene/LightingData.asset and b/Assets/MainScene/LightingData.asset differ diff --git a/Assets/MainScene/ReflectionProbe-0.exr b/Assets/MainScene/ReflectionProbe-0.exr index 59ede421..0638ee41 100644 Binary files a/Assets/MainScene/ReflectionProbe-0.exr and b/Assets/MainScene/ReflectionProbe-0.exr differ diff --git a/Assets/MainScene/ReflectionProbe-0.exr.meta b/Assets/MainScene/ReflectionProbe-0.exr.meta index 4e8678ad..6ea2b112 100644 --- a/Assets/MainScene/ReflectionProbe-0.exr.meta +++ b/Assets/MainScene/ReflectionProbe-0.exr.meta @@ -1,10 +1,9 @@ fileFormatVersion: 2 guid: 9e465a3418e37f542873f8deb0657be5 TextureImporter: - fileIDToRecycleName: - 8900000: generatedCubemap + internalIDToNameTable: [] externalObjects: {} - serializedVersion: 9 + serializedVersion: 10 mipmaps: mipMapMode: 0 enableMipMap: 1 @@ -59,7 +58,7 @@ TextureImporter: compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - - serializedVersion: 2 + - serializedVersion: 3 buildTarget: DefaultTexturePlatform maxTextureSize: 2048 resizeAlgorithm: 0 @@ -70,6 +69,7 @@ TextureImporter: allowsAlphaSplitting: 0 overridden: 0 androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 sprites: [] @@ -77,10 +77,12 @@ TextureImporter: physicsShape: [] bones: [] spriteID: + internalID: 0 vertices: [] indices: edges: [] weights: [] + secondaryTextures: [] spritePackingTag: pSDRemoveMatte: 0 pSDShowRemoveMatteOption: 0 diff --git a/Assets/MainScene_Profiles.meta b/Assets/MainScene_Profiles.meta new file mode 100644 index 00000000..80b5fd2d --- /dev/null +++ b/Assets/MainScene_Profiles.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ccf23c25d76140449815b040bfb128aa +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MainScene_Profiles/Main Camera Profile.asset b/Assets/MainScene_Profiles/Main Camera Profile.asset new file mode 100644 index 00000000..7bcd986f Binary files /dev/null and b/Assets/MainScene_Profiles/Main Camera Profile.asset differ diff --git a/Assets/MainScene_Profiles/Main Camera Profile.asset.meta b/Assets/MainScene_Profiles/Main Camera Profile.asset.meta new file mode 100644 index 00000000..0ec18e29 --- /dev/null +++ b/Assets/MainScene_Profiles/Main Camera Profile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 57a4cc51dbe85b74aa896f7f6bf76180 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/AO_Preview.mat b/Assets/Materials/AO_Preview.mat index d71c6743..ea474221 100644 Binary files a/Assets/Materials/AO_Preview.mat and b/Assets/Materials/AO_Preview.mat differ diff --git a/Assets/Materials/Edge_Preview.mat b/Assets/Materials/Edge_Preview.mat index c8584386..1e44c2a8 100644 Binary files a/Assets/Materials/Edge_Preview.mat and b/Assets/Materials/Edge_Preview.mat differ diff --git a/Assets/Materials/Edit_Diffuse_Preview.mat b/Assets/Materials/Edit_Diffuse_Preview.mat index 80b49a85..866697d0 100644 Binary files a/Assets/Materials/Edit_Diffuse_Preview.mat and b/Assets/Materials/Edit_Diffuse_Preview.mat differ diff --git a/Assets/Materials/Height_Preview.mat b/Assets/Materials/Height_Preview.mat index 989edded..374a5a2a 100644 Binary files a/Assets/Materials/Height_Preview.mat and b/Assets/Materials/Height_Preview.mat differ diff --git a/Assets/Materials/Metallic_Preview.mat b/Assets/Materials/Metallic_Preview.mat index 02ff754a..dc5bc1b5 100644 Binary files a/Assets/Materials/Metallic_Preview.mat and b/Assets/Materials/Metallic_Preview.mat differ diff --git a/Assets/Materials/Normal_Preview.mat b/Assets/Materials/Normal_Preview.mat index 56457e9d..27754d61 100644 Binary files a/Assets/Materials/Normal_Preview.mat and b/Assets/Materials/Normal_Preview.mat differ diff --git a/Assets/Materials/Skybox.mat b/Assets/Materials/Skybox.mat index f963b518..987531a1 100644 Binary files a/Assets/Materials/Skybox.mat and b/Assets/Materials/Skybox.mat differ diff --git a/Assets/Materials/SkyboxLEGACY.mat b/Assets/Materials/SkyboxLEGACY.mat new file mode 100644 index 00000000..584b4cc8 Binary files /dev/null and b/Assets/Materials/SkyboxLEGACY.mat differ diff --git a/Assets/Materials/SkyboxLEGACY.mat.meta b/Assets/Materials/SkyboxLEGACY.mat.meta new file mode 100644 index 00000000..b10dc0d2 --- /dev/null +++ b/Assets/Materials/SkyboxLEGACY.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7899467781d41434eb98fdfc9f1292da +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/Smoothness_Preview.mat b/Assets/Materials/Smoothness_Preview.mat index 2601887c..1893175f 100644 Binary files a/Assets/Materials/Smoothness_Preview.mat and b/Assets/Materials/Smoothness_Preview.mat differ diff --git a/Assets/OBJ-IO/Editor/OBJ-IO.Editor.asmdef b/Assets/OBJ-IO/Editor/OBJ-IO.Editor.asmdef new file mode 100644 index 00000000..27ef34ef --- /dev/null +++ b/Assets/OBJ-IO/Editor/OBJ-IO.Editor.asmdef @@ -0,0 +1,15 @@ +{ + "name": "OBJ-IO.Editor", + "references": [ + "OBJ-IO" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/OBJ-IO/Editor/OBJ-IO.Editor.asmdef.meta b/Assets/OBJ-IO/Editor/OBJ-IO.Editor.asmdef.meta new file mode 100644 index 00000000..4001f86d --- /dev/null +++ b/Assets/OBJ-IO/Editor/OBJ-IO.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: aa0f221ef70e6104ea72525af1dd25fe +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/OBJ-IO/Editor/OBJEditor.cs b/Assets/OBJ-IO/Editor/OBJEditor.cs index 2dba06ea..13447325 100644 --- a/Assets/OBJ-IO/Editor/OBJEditor.cs +++ b/Assets/OBJ-IO/Editor/OBJEditor.cs @@ -1,4 +1,4 @@ - +#if UNITY_EDITOR using System; using System.IO; using System.Collections; @@ -48,3 +48,4 @@ private void OnGUI() } } } +#endif \ No newline at end of file diff --git a/Assets/OBJ-IO/OBJ-IO.asmdef b/Assets/OBJ-IO/OBJ-IO.asmdef new file mode 100644 index 00000000..004b0498 --- /dev/null +++ b/Assets/OBJ-IO/OBJ-IO.asmdef @@ -0,0 +1,3 @@ +{ + "name": "OBJ-IO" +} diff --git a/Assets/OBJ-IO/OBJ-IO.asmdef.meta b/Assets/OBJ-IO/OBJ-IO.asmdef.meta new file mode 100644 index 00000000..126a33ec --- /dev/null +++ b/Assets/OBJ-IO/OBJ-IO.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a65ab7e4507a42f4f8bc009183640e34 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/ClipboardHelper.dll.meta b/Assets/Plugins/ClipboardHelper.dll.meta index a6547311..2bf18416 100644 --- a/Assets/Plugins/ClipboardHelper.dll.meta +++ b/Assets/Plugins/ClipboardHelper.dll.meta @@ -1,14 +1,15 @@ fileFormatVersion: 2 guid: d3215659d71d2184bb0d24ec3976c7f2 -timeCreated: 1461458104 -licenseType: Pro PluginImporter: externalObjects: {} serializedVersion: 2 iconMap: {} executionOrder: {} + defineConstraints: [] isPreloaded: 0 isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 platformData: - first: '': Any @@ -59,7 +60,7 @@ PluginImporter: second: enabled: 1 settings: - CPU: x86_64 + CPU: AnyCPU - first: Standalone: LinuxUniversal second: diff --git a/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll b/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll index 7ac0900e..05082ac4 100644 Binary files a/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll and b/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll differ diff --git a/Assets/Plugins/Mono.Posix.dll b/Assets/Plugins/Mono.Posix.dll new file mode 100644 index 00000000..f901510f Binary files /dev/null and b/Assets/Plugins/Mono.Posix.dll differ diff --git a/Assets/Plugins/Mono.Posix.dll.meta b/Assets/Plugins/Mono.Posix.dll.meta new file mode 100644 index 00000000..d4176f2c --- /dev/null +++ b/Assets/Plugins/Mono.Posix.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 6e30e458f3eab634baa1793fe70c0a7b +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Mono.WebBrowser.dll b/Assets/Plugins/Mono.WebBrowser.dll new file mode 100644 index 00000000..eea3a5e8 Binary files /dev/null and b/Assets/Plugins/Mono.WebBrowser.dll differ diff --git a/Assets/Plugins/Mono.WebBrowser.dll.meta b/Assets/Plugins/Mono.WebBrowser.dll.meta new file mode 100644 index 00000000..abf85660 --- /dev/null +++ b/Assets/Plugins/Mono.WebBrowser.dll.meta @@ -0,0 +1,33 @@ +fileFormatVersion: 2 +guid: 0ebb5e4ad365c4945bc7c49ef38cc2ae +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + Any: + second: + enabled: 1 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Runtime.unity b/Assets/Runtime.unity new file mode 100644 index 00000000..1b00898c Binary files /dev/null and b/Assets/Runtime.unity differ diff --git a/Assets/Runtime.unity.meta b/Assets/Runtime.unity.meta new file mode 100644 index 00000000..0e203635 --- /dev/null +++ b/Assets/Runtime.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b1b0b5ce114cae443975e40aacdce7f9 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/AlignmentGui.cs b/Assets/Scripts/AlignmentGui.cs index b7251d49..f00b6c5f 100644 --- a/Assets/Scripts/AlignmentGui.cs +++ b/Assets/Scripts/AlignmentGui.cs @@ -1,4 +1,28 @@ -#region +//TODO: Some names suck, I don't really understand what this is used for and what is the blit shader used for +/* TODO: Separating the AlignmentGui script into several single responsibility scripts will involve breaking up the functionality of the script into smaller, independent scripts that each have a specific responsibility. Here are some suggestions on how you could accomplish this: + +You can extract the GUI-related functionality into a separate script. This script would be responsible for handling the user interface elements, such as buttons, sliders, and labels, that are used to control the alignment process. +You can extract the functionality related to the alignment maps (lensMap, perspectiveMap and alignMap) into a separate script. This script would be responsible for creating and updating the alignment maps, and applying the necessary filters and effects to them. +Extract the functionality related to the alignment points( PointTl, PointTr, PointBl, PointBr), into a separate script. This script would be responsible for handling the user's interactions with the alignment points, such as selecting and dragging them. +Extract the functionality related to the processing of the maps into a separate script. This script would be responsible for handling the processing of the maps, such as rescaling, and setting properties. +You can extract the functionality related to the material properties into a separate script. This script would be responsible for setting the properties of the material to be aligned +*/ +/* Description: + The Awake() function is used to set the _camera variable to the main camera in the scene. +Initialize() is used to set up the initial values and states of the object. It sets the gameObject active, initializes the _mainGui variable, sets the TestObject's shared material to ThisMaterial, and creates a new material _blitMaterial using the "Hidden/Blit_Alignment" shader. It also sets _textureToAlign to one of the maps from the mainGui. +CleanupTexture() method is used to clean up the textures and reset some variables when the object is closed +Close() method is used to deactivate the gameObject and call the CleanupTextures() method +SelectClosestPoint() method is used to select the point on the texture that's closest to the mouse cursor. +DragPoint() method is used to handle the logic for dragging points on the texture. +Update() Commented line by line. It calls the SelectClosestPoint() and DragPoint() methods, process the map, set the properties in the material and blitMaterial, and update the GUI elements. +DoMyWindow(int windowId) method is used to define the layout and functionality of the window that is displayed on the GUI. It contains sliders and buttons for selecting different maps and adjusting settings. +OnGUI() is a Unity built-in method that is called to display GUI elements on the screen. +ProcessMap(Texture2D map) method is used to process the maps, it creates and sets the render textures _alignMap, _lensMap and _perspectiveMap. +Texture2D SetMap(string map) method is used to set the map specified by the argument to _textureToAlign. +RenderTexture SetMap(string map) method is used to set the render texture specified by the argument. +SetMaps() method is used to set the maps in the material and blitMaterial. + */ +#region using System.Collections; using JetBrains.Annotations; @@ -8,35 +32,74 @@ public class AlignmentGui : MonoBehaviour { + /// + /// The Shader property ID for the target point. + /// private static readonly int TargetPoint = Shader.PropertyToID("_TargetPoint"); + + /// + /// The Shader property ID for the main texture. + /// private static readonly int MainTex = Shader.PropertyToID("_MainTex"); + + /// + /// The Shader property ID for the corrected texture. + /// private static readonly int CorrectTex = Shader.PropertyToID("_CorrectTex"); + + /// + /// The Shader property ID for the point scale. + /// private static readonly int PointScale = Shader.PropertyToID("_PointScale"); + /// + /// The Property ID of the top-left point of the quadrilateral used for the alignment. + /// private static readonly int PointTl = Shader.PropertyToID("_PointTL"); + /// + /// The Property ID of the top-right point of the quadrilateral used for the alignment. + /// private static readonly int PointTr = Shader.PropertyToID("_PointTR"); + /// + /// The Property ID of the bottom-left point of the quadrilateral used for the alignment. + /// private static readonly int PointBl = Shader.PropertyToID("_PointBL"); + /// + /// The Property ID of the bottom-right point of the quadrilateral used for the alignment. + /// private static readonly int PointBr = Shader.PropertyToID("_PointBR"); + /// + /// The width of the texture + /// private static readonly int Width = Shader.PropertyToID("_Width"); + /// + /// The height of the texture + /// private static readonly int Height = Shader.PropertyToID("_Height"); + /// + /// The lens distort value + /// private static readonly int Lens = Shader.PropertyToID("_Lens"); + /// + /// The perspective x value + /// private static readonly int PerspectiveX = Shader.PropertyToID("_PerspectiveX"); + /// + /// The perspective y value + /// private static readonly int PerspectiveY = Shader.PropertyToID("_PerspectiveY"); + /// + /// The slider value + /// private static readonly int Slider = Shader.PropertyToID("_Slider"); - private RenderTexture _alignMap; + private RenderTexture _alignMap; private Material _blitMaterial; private Camera _camera; - private bool _doStuff; - - private int _grabbedPoint; - private float _lensDistort; private string _lensDistortText = "0.0"; - private RenderTexture _lensMap; - private MainGui _mainGui; private RenderTexture _perspectiveMap; @@ -199,51 +262,72 @@ private void DragPoint() _doStuff = true; } - // Update is called once per frame private void Update() { + // calls the SelectClosestPoint method SelectClosestPoint(); + // calls the DragPoint method DragPoint(); - + // calls the ProcessMap method, passing in the _textureToAlign variable ProcessMap(_textureToAlign); - var aspect = _textureToAlign.width / (float) _textureToAlign.height; + // calculate the aspect ratio of the texture, width divided by height + var aspect = _textureToAlign.width / (float)_textureToAlign.height; + // constant area of 1.0 const float area = 1.0f; + // initializes a Vector2 with a value of 1 in x and y var pointScale = Vector2.one; + // sets the x value of pointScale to the aspect ratio pointScale.x = aspect; + // calculates the new area using the pointScale x and y values var newArea = pointScale.x * pointScale.y; + // calculates the areaScale using the square root of the ratio of area to newArea var areaScale = Mathf.Sqrt(area / newArea); + // multiplies the x value of pointScale by areaScale pointScale.x *= areaScale; + // multiplies the y value of pointScale by areaScale pointScale.y *= areaScale; + // sets the MainTex texture property of the ThisMaterial material to the _lensMap texture ThisMaterial.SetTexture(MainTex, _lensMap); + // Setting the _perspectiveMap RenderTexture to the CorrectTex property of ThisMaterial material ThisMaterial.SetTexture(CorrectTex, _perspectiveMap); - + // Setting pointScale vector to the PointScale property of ThisMaterial material ThisMaterial.SetVector(PointScale, pointScale); + // Setting _pointTl vector to the PointTl property of ThisMaterial material ThisMaterial.SetVector(PointTl, _pointTl); + // Setting _pointTr vector to the PointTr property of ThisMaterial material ThisMaterial.SetVector(PointTr, _pointTr); + // Setting _pointBl vector to the PointBl property of ThisMaterial material ThisMaterial.SetVector(PointBl, _pointBl); + // Setting _pointBr vector to the PointBr property of ThisMaterial material ThisMaterial.SetVector(PointBr, _pointBr); - + // Setting _pointTl vector to the PointTl property of _blitMaterial material _blitMaterial.SetVector(PointTl, _pointTl); + // Setting _pointTr vector to the PointTr property of _blitMaterial material _blitMaterial.SetVector(PointTr, _pointTr); + // Setting _pointBl vector to the PointBl property of _blitMaterial material _blitMaterial.SetVector(PointBl, _pointBl); + // Setting _pointBr vector to the PointBr property of _blitMaterial material _blitMaterial.SetVector(PointBr, _pointBr); - + // Setting the width of _textureToAlign to the Width property of _blitMaterial material _blitMaterial.SetFloat(Width, _textureToAlign.width); + // Setting the height of _textureToAlign to the Height property of _blitMaterial material _blitMaterial.SetFloat(Height, _textureToAlign.height); - + // Setting the _lensDistort variable to the Lens property of _blitMaterial material _blitMaterial.SetFloat(Lens, _lensDistort); + // Setting the _perspectiveX variable to the PerspectiveX property of _blitMaterial material _blitMaterial.SetFloat(PerspectiveX, _perspectiveX); + // Setting the _perspectiveY variable to the PerspectiveY property of _blitMaterial material _blitMaterial.SetFloat(PerspectiveY, _perspectiveY); - + // if _doStuff is true, set _doStuff to false if (_doStuff) { _doStuff = false; } - + // Setting the _slider variable to the Slider property of ThisMaterial material ThisMaterial.SetFloat(Slider, _slider); } diff --git a/Assets/Scripts/AoFromNormalGui.cs b/Assets/Scripts/AoFromNormalGui.cs index 12f7f854..8e3480b5 100644 --- a/Assets/Scripts/AoFromNormalGui.cs +++ b/Assets/Scripts/AoFromNormalGui.cs @@ -1,4 +1,35 @@ -#region +/* Description: + Creates an ambient occlusion (AO) map from a normal map. + +GetValues and SetValues are used to get and set the settings for the AO map creation process. +InitializeSettings is used to initialize the settings with default values. +Start is called when the script is first initialized, it sets up materials and calls InitializeSettings +DoStuff sets a flag to indicate that the AO map creation process should start. +NewTexture sets a flag to indicate that new textures should be initialized. +Update is called every frame, it processes the normal map to create the AO map, the AO map is then blended with the height map, and the final AO map is rendered on the test object. +DoMyWindow is a GUI function that creates a window for the user to adjust settings for the AO map creation process. +InitializeTextures creates the textures and render textures required for the AO map creation process. +Close is called when the window is closed, it releases the textures and render textures created. +CleanupTexture releases a single texture. +CleanupTextures releases all the textures created by the script. +ProcessAo is a coroutine that creates the AO map. +ProcessNormalDepth is a coroutine that processes the normal map to create the AO map and blends it with the height map. +*/ +/* TODO: + How this script could be separated: + +GUI management: Move the code responsible for creating and managing the GUI elements, such as the DoMyWindow method and the variables related to the GUI window's position, into a separate script. + +Texture processing: Move the code responsible for processing textures, such as the ProcessAo, ProcessNormalDepth, and InitializeTextures methods, into a separate script. This script would handle all of the logic related to creating and manipulating textures, such as creating new textures, initializing textures, and processing normal and depth maps. + +Settings management: Move the code responsible for managing the settings of the script, such as the GetValues, SetValues, and InitializeSettings methods, into a separate script. This script would handle all of the logic related to storing, retrieving, and initializing settings. + +Material management: Move the code responsible for managing the materials of the script, such as the ThisMaterial variable, into a separate script. This script would handle all of the logic related to setting the properties of the material, such as the blending amount, image size, and final contrast. + +Coroutine management: Move the code responsible for managing the coroutines, such as the StartCoroutine(ProcessNormalDepth()) method, into a separate script. This script would handle all of the logic related to starting and stoping the coroutines +*/ + +#region using System.Collections; using UnityEngine; diff --git a/Assets/Scripts/AoSettings.cs b/Assets/Scripts/AoSettings.cs index 642a53f1..0bddae56 100644 --- a/Assets/Scripts/AoSettings.cs +++ b/Assets/Scripts/AoSettings.cs @@ -1,31 +1,72 @@ -#region - using System.ComponentModel; - -#endregion - +//TODO: Convert to ScriptableObject +/// +/// AoSettings is a data container class that stores the settings for the ambient occlusion (AO) map generation process. +/// public class AoSettings { - [DefaultValue(1.0f)] public float Blend; - - [DefaultValue("1")] public string BlendText; - - [DefaultValue(100.0f)] public float Depth; - - [DefaultValue("100")] public string DepthText; - - [DefaultValue(0.0f)] public float FinalBias; - - [DefaultValue("0")] public string FinalBiasText; - - [DefaultValue(1.0f)] public float FinalContrast; - - [DefaultValue("1")] public string FinalContrastText; - - [DefaultValue(5.0f)] public float Spread; - - [DefaultValue("50")] public string SpreadText; - + /// + /// Blend is a float value representing the amount of AO map to be blended with the original height map. + /// + [DefaultValue(1.0f)]public float Blend; + + /// + /// BlendText is a string representation of the value of Blend. + /// + [DefaultValue("1")] + public string BlendText; + + /// + /// Depth is a float value representing the depth of the AO map. + /// + [DefaultValue(100.0f)] + public float Depth; + + /// + /// DepthText is a string representation of the value of Depth. + /// + [DefaultValue("100")] + public string DepthText; + + /// + /// FinalBias is a float value representing the bias of the final AO map. + /// + [DefaultValue(0.0f)] + public float FinalBias; + + /// + /// FinalBiasText is a string representation of the value of FinalBias. + /// + [DefaultValue("0")] + public string FinalBiasText; + + /// + /// FinalContrast is a float value representing the contrast of the final AO map. + /// + [DefaultValue(1.0f)] + public float FinalContrast; + + /// + /// FinalContrastText is a string representation of the value of FinalContrast. + /// + [DefaultValue("1")] + public string FinalContrastText; + + /// + /// Spread is a float value representing the spread of the AO map. + /// + [DefaultValue(5.0f)] + public float Spread; + + /// + /// SpreadText is a string representation of the value of Spread. + /// + [DefaultValue("50")] + public string SpreadText; + + /// + /// AoSettings is a constructor that initializes the default values for the class properties. + /// public AoSettings() { Spread = 50.0f; @@ -43,4 +84,4 @@ public AoSettings() Blend = 1.0f; BlendText = "1"; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/BashRunner.cs b/Assets/Scripts/BashRunner.cs index 8ba4ba6c..64c932b9 100644 --- a/Assets/Scripts/BashRunner.cs +++ b/Assets/Scripts/BashRunner.cs @@ -1,3 +1,10 @@ +/* Description: +This class is a static utility class which provides a single method Run(string commandLine) that runs a command using the bash shell. +It creates a process with the specified command line and redirects the standard output and error to be read by the process. +It also starts listening for the output and error data. If the process doesn't exit within 500ms, it throws a timeout exception. +If the process exits with a non-zero code it throws an exception with the output and error data of the process. +*/ +//TODO: Find where is this called and why #region using System; @@ -8,12 +15,20 @@ internal static class BashRunner { + /// + /// Runs a command using the bash shell + /// + /// command to be executed + /// output of the command // ReSharper disable once UnusedMethodReturnValue.Global public static string Run(string commandLine) { + // Initialize string builders to store output and error messages var errorBuilder = new StringBuilder(); var outputBuilder = new StringBuilder(); + // Creates the argument string for the bash process var arguments = $"-c \"{commandLine}\""; + // Initialize the process with the required settings using (var process = new Process { StartInfo = new ProcessStartInfo @@ -27,11 +42,14 @@ public static string Run(string commandLine) } }) { + // Start the process process.Start(); + // register event handlers to handle the output and error data process.OutputDataReceived += (sender, args) => { outputBuilder.AppendLine(args.Data); }; process.BeginOutputReadLine(); process.ErrorDataReceived += (sender, args) => { errorBuilder.AppendLine(args.Data); }; process.BeginErrorReadLine(); + // Wait for the process to exit with a timeout of 500ms if (!process.WaitForExit(500)) { var timeoutError = $@"Process timed out. Command line: bash {arguments}. @@ -39,7 +57,7 @@ public static string Run(string commandLine) Error: {errorBuilder}"; throw new Exception(timeoutError); } - + // If the process exits with a non-zero code, throw an exception if (process.ExitCode == 0) { return outputBuilder.ToString(); diff --git a/Assets/Scripts/BatchUI.cs b/Assets/Scripts/BatchUI.cs index b02aec6e..d1c906f2 100644 --- a/Assets/Scripts/BatchUI.cs +++ b/Assets/Scripts/BatchUI.cs @@ -25,13 +25,26 @@ void Update() { } + + /// + /// use inital location toggle + /// + /// what the value is public void UseInitalLocationToggle(bool value) { UseInitalLocation = value; } + /// + /// Loads all the textures for batching. + /// public void BatchLoadTextures() { StartCoroutine(BatchProcessTextures()); } - public IEnumerator BatchProcessTextures() + + /// + /// Processes all the textures and saves them out. + /// + /// IEnum + private IEnumerator BatchProcessTextures() { var path = StandaloneFileBrowser.OpenFolderPanel("Texture Files Location", "", false); //var path = StandaloneFileBrowser.SaveFilePanel("Texture Directory", "", "",""); @@ -52,6 +65,13 @@ public IEnumerator BatchProcessTextures() } //return null; } + + /// + /// Batch runs all the textures to output them to a file location + /// + /// Texture to output + /// Name of texture + /// IEnum IEnumerator BatchTextures(Texture2D T, string name) { MainGui.DiffuseMapOriginal = T; diff --git a/Assets/Scripts/CameraPanZoom.cs b/Assets/Scripts/CameraPanZoom.cs index 684c3cb1..de4006c2 100644 --- a/Assets/Scripts/CameraPanZoom.cs +++ b/Assets/Scripts/CameraPanZoom.cs @@ -3,35 +3,33 @@ using UnityEngine; #endregion - +/*Description: This script is used to allow the user to pan and zoom the camera in the scene by moving the mouse while holding down certain keys and/or pressing certain mouse buttons. + * The script is attached to a camera object in the scene and it uses the UnityEngine.Input class to detect mouse and keyboard input. + * The script uses the mouse position, mouse offset, mouse button state, and mouse scroll wheel input to update the target + * position of the camera, and then gradually moves the camera towards the target position in the Update() method.*/ public class CameraPanZoom : MonoBehaviour { - private Vector2 _lastMousePos; - - private Vector2 _mousePos; - private float _targetFov; - - private Vector3 _targetPos; - public KeyCode[] KeyToHold; - - public int MouseButtonPan; - + private Vector2 _lastMousePos; // A variable to store the previous mouse position to calculate the offset of the mouse movement + private Vector2 _mousePos; // A variable to store the current mouse position + private float _targetFov; // A variable to store the target field of view for the camera + private Vector3 _targetPos; // A variable to store the target position for the camera + public KeyCode[] KeyToHold; // An array of key codes representing keys that need to be held down to enable panning + public int MouseButtonPan; // An integer representing the mouse button that needs to be pressed to enable panning + // Use this for initialization private void Start() { - _targetPos = transform.position; + _targetPos = transform.position; // Set the target position to the current position of the camera } // Update is called once per frame private void Update() { - if (!MainGui.Instance) return; - _mousePos = Input.mousePosition; - - var mouseOffset = _mousePos - _lastMousePos; - - var keyHeld = false; + if (!MainGui.Instance) return; // Check if the MainGui instance is null and return if it is + _mousePos = Input.mousePosition; // Get the current mouse position + var mouseOffset = _mousePos - _lastMousePos; // Calculate the offset of the mouse movement based on the current and last mouse position + var keyHeld = false; // A flag to check if any of the required keys are held down foreach (var t in KeyToHold) { if (Input.GetKey(t)) @@ -45,21 +43,21 @@ private void Update() { MainGui.Instance.SaveHideStateAndHideAndLock(this); - _targetPos -= new Vector3(1, 0, 0) * mouseOffset.x * 0.025f; - _targetPos -= new Vector3(0, 1, 0) * mouseOffset.y * 0.025f; + _targetPos -= new Vector3(1, 0, 0) * mouseOffset.x * 0.025f; // Update the target position based on the horizontal mouse offset + _targetPos -= new Vector3(0, 1, 0) * mouseOffset.y * 0.025f; // Update the target position based on the vertical mouse offset } else { MainGui.Instance.HideGuiLocker.Unlock(this); } - _targetPos += new Vector3(0, 0, 1) * Input.GetAxis("Mouse ScrollWheel") * 3.0f; + _targetPos += new Vector3(0, 0, 1) * Input.GetAxis("Mouse ScrollWheel") * 3.0f; // Update the target position based on the mouse scroll wheel input var trf = transform; var position = trf.position; - position += (_targetPos - position) * 0.05f; + position += (_targetPos - position) * 0.05f; // Update the camera position based on the target position trf.position = position; - _lastMousePos = _mousePos; + _lastMousePos = _mousePos; // Update the last mouse position } -} \ No newline at end of file +} diff --git a/Assets/Scripts/ClipboardHelper.cs b/Assets/Scripts/ClipboardHelper.cs index a15cc064..b6a666b4 100644 --- a/Assets/Scripts/ClipboardHelper.cs +++ b/Assets/Scripts/ClipboardHelper.cs @@ -4,8 +4,14 @@ #endregion +/// +/// ClipboardHelper is a static class that provides a simple way to interact with the clipboard. +/// public static class ClipboardHelper { + /// + /// Get or set the current value of the clipboard. + /// public static string ClipBoard { get => GUIUtility.systemCopyBuffer; diff --git a/Assets/Scripts/ControlsGui.cs b/Assets/Scripts/ControlsGui.cs index 859fe31b..2cd06936 100644 --- a/Assets/Scripts/ControlsGui.cs +++ b/Assets/Scripts/ControlsGui.cs @@ -1,4 +1,8 @@ -#region +/* This class is a simple GUI class that displays a window with control information on it. + * It is using Unity's GUI system to draw the window and its contents. + * The window will display the controls of the application, such as how to rotate the model, move the model, zoom in/out, rotate the light, and rotate the background. + * The window will be closed when the user clicks the "Close" button.*/ +#region using UnityEngine; @@ -6,10 +10,19 @@ public class ControlsGui : MonoBehaviour { - private bool _windowOpen; - + /// + /// A flag indicating whether the window is currently open or not + /// + //private bool _windowOpen; + /// + /// A rectangle representing the position and size of the window + /// private Rect _windowRect = new Rect(Screen.width - 520, Screen.height - 320, 300, 600); + /// + /// Draws the window in OnGUI method + /// + /// private void DoMyWindow(int windowId) { const int offsetX = 10; @@ -40,16 +53,16 @@ private void DoMyWindow(int windowId) GUI.Label(new Rect(offsetX, offsetY, 250, 30), "Middle Mouse Button + B"); offsetY += 30; - if (GUI.Button(new Rect(offsetX + 160, offsetY, 120, 30), "Close")) _windowOpen = false; + // if (GUI.Button(new Rect(offsetX + 160, offsetY, 120, 30), "Close")) _windowOpen = false; } private void OnGUI() { - _windowRect = new Rect(Screen.width - 480, Screen.height - 370, 170, 280); + //_windowRect = new Rect(Screen.width - 480, Screen.height - 370, 170, 280); - if (_windowOpen) _windowRect = GUI.Window(22, _windowRect, DoMyWindow, "Controls"); + GUI.Window(22, _windowRect, DoMyWindow, "Controls"); - if (!GUI.Button(new Rect(Screen.width - 370, Screen.height - 40, 80, 30), "Controls")) return; - _windowOpen = !_windowOpen; + //if (!GUI.Button(new Rect(Screen.width - 370, Screen.height - 40, 80, 30), "Controls")) return; + //_windowOpen = !_windowOpen; } } \ No newline at end of file diff --git a/Assets/Scripts/CopyScale.cs b/Assets/Scripts/CopyScale.cs index ecd0df97..37232896 100644 --- a/Assets/Scripts/CopyScale.cs +++ b/Assets/Scripts/CopyScale.cs @@ -1,4 +1,8 @@ -#region +/*Description: The CopyScale class is a Unity MonoBehaviour that updates the local scale of the object it is attached to, to match that of another GameObject, + * by adding a value that depends on the value of the property _Parallax of the material of that other object, and the x component of the property _Tiling. + * The class also retrieves the Renderer component of the TargetObject in the Start method.*/ + +#region using UnityEngine; @@ -11,24 +15,30 @@ public class CopyScale : MonoBehaviour private Renderer _renderer; public GameObject TargetObject; + /// + /// On start, gets the renderer component of the TargetObject + /// private void Start() { _renderer = TargetObject.GetComponent(); } + /// + /// On update, updates the scale of the current object based on the scale of the TargetObject and properties of its material + /// private void Update() { - var tempScale = TargetObject.transform.localScale; - var targetMaterial = _renderer.sharedMaterial; + var tempScale = TargetObject.transform.localScale; // get the local scale of the TargetObject + var targetMaterial = _renderer.sharedMaterial; // get the shared material of the TargetObject - if (targetMaterial.HasProperty("_Parallax")) + if (targetMaterial.HasProperty("_Parallax")) // check if the material has the _Parallax property { - var height = targetMaterial.GetFloat(Parallax); - var tiling = targetMaterial.GetVector(Tiling1); + var height = targetMaterial.GetFloat(Parallax); // get the value of _Parallax + var tiling = targetMaterial.GetVector(Tiling1); // get the value of _Tiling - tempScale.z += height * (1.0f / tiling.x); + tempScale.z += height * (1.0f / tiling.x); // update the scale of the current object } - transform.localScale = tempScale; + transform.localScale = tempScale; // set the local scale of the current object } -} \ No newline at end of file +} diff --git a/Assets/Scripts/CountLocker.cs b/Assets/Scripts/CountLocker.cs index b4990df4..9b5db97a 100644 --- a/Assets/Scripts/CountLocker.cs +++ b/Assets/Scripts/CountLocker.cs @@ -4,7 +4,17 @@ using System.Collections.Generic; #endregion +/* Description: CountLocker is a simple class that provides a way to lock and unlock a resource using an object as the key. +It uses a List to keep track of the objects that have locked the resource, and a boolean variable "IsLocked" to track the status of the resource. +The class has two main methods: "Lock" and "Unlock", these methods are used to lock and unlock the resource respectively. +The Lock method takes an object as a parameter, which will be used as the key to lock the resource. +If the object is already in the list of lock callers, the resource will not be locked again. +If the resource is already locked, the method will do nothing.When a resource is locked, the "OnLock" method is called which raises the "Locked" event. +The Unlock method also takes an object as a parameter, which will be used as the key to unlock the resource. +If the object is not in the list of lock callers, the resource will not be unlocked. +Once all objects have been unlocked and the list of lock callers is empty, the "IsLocked" variable is set to false and the "OnLockEmpty" method is called which raises the "LockEmpty" event.*/ + //TODO: Figure out what is this public class CountLocker { private readonly List _lockCallers = new List(); @@ -12,37 +22,50 @@ public class CountLocker public void Lock(object sender) { + //Check if the sender is already present in the lockCallers list, if yes, return if (_lockCallers.Contains(sender)) return; + //If not, add the sender to the list _lockCallers.Add(sender); + //Check if the lock is already in use, if yes, return if (IsLocked) return; + //If not, set the IsLocked flag to true IsLocked = true; + //Call the OnLock method OnLock(); } public void Unlock(object sender) { + //Check if the sender is present in the lockCallers list, if not, return if (!_lockCallers.Contains(sender)) return; + //If yes, remove the sender from the list _lockCallers.Remove(sender); + //Check if the lockCallers list is empty, if not, return if (_lockCallers.Count != 0) return; + //Set the IsLocked flag to false IsLocked = false; + //Call the OnLockEmpty method OnLockEmpty(); } + //Event to be invoked when the lock is empty public event EventHandler LockEmpty; - // ReSharper disable once EventNeverSubscribedTo.Global + //Event to be invoked when the lock is in use public event EventHandler Locked; private void OnLockEmpty() { + //Invoke the LockEmpty event LockEmpty?.Invoke(this, EventArgs.Empty); } private void OnLock() { + //Invoke the Locked event Locked?.Invoke(this, EventArgs.Empty); } -} \ No newline at end of file +} diff --git a/Assets/Scripts/CubemapPicker.cs b/Assets/Scripts/CubemapPicker.cs index f26ceba0..74b32898 100644 --- a/Assets/Scripts/CubemapPicker.cs +++ b/Assets/Scripts/CubemapPicker.cs @@ -3,14 +3,26 @@ using UnityEngine; #endregion +/*Description: + The CubemapPicker class is a simple script that allows the user to cycle through a set of cubemaps using a specified key (default is "C"). + When the key is pressed, the script increments a counter and uses it to select the next cubemap from an array of cubemaps. + The selected cubemap is then set as the global cubemap for the project, which means it will be applied to any object that uses a shader that references the "_GlobalCubemap" property. + */ +/// +/// Class to Pick and change Cubemap on a scene +/// public class CubemapPicker : MonoBehaviour { private static readonly int GlobalCubemap = Shader.PropertyToID("_GlobalCubemap"); private int _selectedCubemap; public Cubemap[] CubeMaps; public KeyCode Key; - + /// + /// Update function is called once per frame + /// it checks if the selected key is pressed, if so the selected cubemap will be incremented + /// and if the incremented index is out of the range of the array it will be set to 0 + /// private void Update() { if (Input.GetKeyDown(Key)) @@ -21,4 +33,4 @@ private void Update() Shader.SetGlobalTexture(GlobalCubemap, CubeMaps[_selectedCubemap]); } -} \ No newline at end of file +} diff --git a/Assets/Scripts/EdgeFromNormalGui.cs b/Assets/Scripts/EdgeFromNormalGui.cs index d71e15c8..574652b7 100644 --- a/Assets/Scripts/EdgeFromNormalGui.cs +++ b/Assets/Scripts/EdgeFromNormalGui.cs @@ -1,4 +1,56 @@ -#region +/* +Description: + The class EdgeFromNormalGui is a custom inspector for Unity that allows the user to adjust various settings related to edge detection on a given material or object. It uses Unity's built-in GUI system to create sliders and other UI elements for adjusting the various settings. + +The GetValues method takes a ProjectObject as input and copies the current values of the various settings from the inspector's UI into the ProjectObject. + +The SetValues method takes a ProjectObject as input and sets the values of the various settings in the inspector's UI to match the values stored in the ProjectObject. + +The InitializeSettings method is responsible for initializing the EdgeSettings object that is used to store the current values of the various settings. + +The Start method is called by Unity when the script is first initialized. It sets the default values of the settings, and initializes the various textures and materials used by the script. + +The DoStuff method is responsible for performing the edge detection process on the current texture and updating the material with the new edge map. + +The NewTexture method is called when the user wants to generate a new edge map for the current texture. It sets the _newTexture variable to true, which will trigger the DoStuff method to update the edge map. + +The Update method is called by Unity every frame. It checks if _newTexture is true, if it is, it will call the DoStuff method to update the edge map. + +The SetDefaultSliderValues method sets the default values for the various sliders in the inspector's UI. + +The SetWeightEqDefault, SetWeightEqDisplace, SetWeightEqSoft, and SetWeightEqTight methods are used to set the weight values for the blur filter used in the edge detection process. + The DoMyWindow function is responsible for creating the user interface for the EdgeFromNormalGui script using Unity's GUI system. It uses the GuiHelper.Slider method to create sliders for various settings, such as "Pre Contrast" and "Edge Amount", and assigns the new values to the corresponding variables in the _settings object. The function also creates labels and buttons for presets, such as "Default" and "Displace", that call methods such as SetWeightEqDefault and SetWeightEqDisplace to set the values of the settings to predefined values. + +The OnGUI function is a Unity event function that is called every frame. It calls DoMyWindow to create the UI and handle user input. + +The InitializeTextures function creates and initializes the various RenderTextures that are used to process the edge and normal maps. + +The Close function is called when the window is closed and it simply sets the _doStuff variable to false. + +The CleanupTexture function is called to clean up a single render texture. + +The CleanupTextures function is called to clean up all the render textures created by the script. + +The ProcessEdge function is responsible for processing the edge map using the settings specified by the user. It uses the _blitMaterial to perform the operations. + +The ProcessNormal function is responsible for processing the normal map using the settings specified by the user. It uses the _blitMaterial to perform the operations. + */ + +/*TODO: +The EdgeFromNormalGui script appears to have several responsibilities that could be separated into different scripts. Here are a few suggestions: + +GUI management: The OnGUI method and the DoMyWindow method are both responsible for creating and managing the GUI elements of the script. This logic could be moved to a separate script that is specifically responsible for handling the GUI. + +Shader properties management: The script sets various properties on the Shader and uses various Shader.PropertyToID constants. This logic could be moved to a separate script that is specifically responsible for managing the properties of the Shader. + +Render texture management: The script creates and manages multiple RenderTextures. This logic could be moved to a separate script that is specifically responsible for creating and managing RenderTextures. + +Edge and Normal processing: The script has methods like ProcessEdge and ProcessNormal which are responsible for processing the edge and normal maps respectively. These could be moved to a separate script that is specifically responsible for processing these maps. + +Settings management: The script has logic for managing the settings such as InitializeSettings, GetValues and SetValues methods. These could be moved to a separate script that is specifically responsible for managing the settings. +*/ + +#region using System.Collections; using UnityEngine; diff --git a/Assets/Scripts/EdgeSettings.cs b/Assets/Scripts/EdgeSettings.cs index cb142bd0..39e37715 100644 --- a/Assets/Scripts/EdgeSettings.cs +++ b/Assets/Scripts/EdgeSettings.cs @@ -1,53 +1,145 @@ +// TODO: Convert to Scriptable Object + #region using System.ComponentModel; #endregion +/// +/// EdgeSettings class to hold the settings used for Edge Detection +/// public class EdgeSettings { - [DefaultValue(1.0)] public float Blur0Contrast; - - [DefaultValue("1")] public string Blur0ContrastText; - - [DefaultValue(1.0f)] public float Blur0Weight; - - [DefaultValue(0.5f)] public float Blur1Weight; - - [DefaultValue(0.3f)] public float Blur2Weight; - - [DefaultValue(0.5f)] public float Blur3Weight; - - [DefaultValue(0.7f)] public float Blur4Weight; - - [DefaultValue(0.7f)] public float Blur5Weight; - - [DefaultValue(0.3f)] public float Blur6Weight; - - [DefaultValue(1.0f)] public float CreviceAmount; - - [DefaultValue("1")] public string CreviceAmountText; - - [DefaultValue(1.0f)] public float EdgeAmount; - - [DefaultValue("1")] public string EdgeAmountText; - - [DefaultValue(0.0f)] public float FinalBias; - - [DefaultValue("0")] public string FinalBiasText; - - [DefaultValue(1.0f)] public float FinalContrast; - - [DefaultValue("1")] public string FinalContrastText; - - [DefaultValue(1.0f)] public float Pillow; - - [DefaultValue("1")] public string PillowText; - - [DefaultValue(1.0f)] public float Pinch; - - [DefaultValue("1")] public string PinchText; - + /// + /// The contrast for the first blur step + /// + [DefaultValue(1.0f)] + public float Blur0Contrast; + + /// + /// The string representation of the Blur0Contrast value + /// + [DefaultValue("1")] + public string Blur0ContrastText; + + /// + /// The weight of the first blur step + /// + [DefaultValue(1.0f)] + public float Blur0Weight; + + /// + /// The weight of the second blur step + /// + [DefaultValue(0.5f)] + public float Blur1Weight; + + /// + /// The weight of the third blur step + /// + [DefaultValue(0.3f)] + public float Blur2Weight; + + /// + /// The weight of the fourth blur step + /// + [DefaultValue(0.5f)] + public float Blur3Weight; + + /// + /// The weight of the fifth blur step + /// + [DefaultValue(0.7f)] + public float Blur4Weight; + + /// + /// The weight of the sixth blur step + /// + [DefaultValue(0.7f)] + public float Blur5Weight; + + /// + /// The weight of the seventh blur step + /// + [DefaultValue(0.3f)] + public float Blur6Weight; + + /// + /// The amount of crevice details to be added + /// + [DefaultValue(1.0f)] + public float CreviceAmount; + + /// + /// The string representation of the CreviceAmount value + /// + [DefaultValue("1")] + public string CreviceAmountText; + + /// + /// The amount of edge details to be added + /// + [DefaultValue(1.0f)] + public float EdgeAmount; + + /// + /// The string representation of the EdgeAmount value + /// + [DefaultValue("1")] + public string EdgeAmountText; + + /// + /// The final bias of the image after processing + /// + [DefaultValue(0.0f)] + public float FinalBias; + + /// + /// The string representation of the FinalBias value + /// + [DefaultValue("0")] + public string FinalBiasText; + + /// + /// The final contrast of the image after processing + /// + [DefaultValue(1.0f)] + public float FinalContrast; + /// + /// The text value of the final contrast property + /// + [DefaultValue("1")] + public string FinalContrastText; + + /// + /// The pinch property of the edge settings + /// + [DefaultValue(1.0f)] + public float Pinch; + + /// + /// The text value of the pinch property + /// + [DefaultValue("1")] + public string PinchText; + + /// + /// The pillow property of the edge settings + /// + [DefaultValue(1.0f)] + public float Pillow; + + /// + /// The text value of the pillow property + /// + [DefaultValue("1")] + public string PillowText; + + /// + /// Constructor for the EdgeSettings class + /// Initializes all properties with default values + /// public EdgeSettings() { Blur0Contrast = 1.0f; @@ -79,4 +171,4 @@ public EdgeSettings() Pillow = 1.0f; PillowText = "1"; } -} \ No newline at end of file +} diff --git a/Assets/Scripts/EditDiffuseGui.cs b/Assets/Scripts/EditDiffuseGui.cs index 675164d7..b229d6da 100644 --- a/Assets/Scripts/EditDiffuseGui.cs +++ b/Assets/Scripts/EditDiffuseGui.cs @@ -1,3 +1,43 @@ +/* + * Description: +The EditDiffuseGui class is a MonoBehaviour class that has several methods and properties for allowing the user to edit the diffuse settings of a project object in Unity. It has several render textures and materials to blit the rendered image. + +The EditDiffuseGui class has several methods: + +GetValues method is used to get the current values of the EditDiffuseSettings and store them in a ProjectObject class. +SetValues method is used to set the values of the EditDiffuseSettings class from a ProjectObject class. +InitializeSettings method is used to initialize the EditDiffuseSettings class. +Start method is used to initialize the material and other variables. +DoStuff method is used to apply the settings to the material. +NewTexture method is used to create a new texture for the diffuse map. +Update method is used to update the material properties and apply the new texture. +DoMyWindow method is used to draw the GUI window for the user to edit the settings. +OnGUI method is used to handle the GUI events. +Close method is used to close the window and clean up the textures. +CleanupTexture method is used to clean up the texture. +CleanupTextures method is used to clean up the render textures. +InitializeTextures method is used to initialize the render textures. +It has several properties such as Slider, BlurContrast, LightMaskPow, LightPow, DarkMaskPow, DarkPow, HotSpot, DarkSpot, FinalContrast, FinalBias, ColorLerp, Saturation, ImageSize, MainTex, BlurTex,AvgTex, BlurSpread, BlurSamples, BlurDirection. These are used to identify the property of the shader that's being applied. +It also has a reference to MainGuiScript and TestObject, this is a reference to the GameObject and its script that's being used. +It also has a reference to ThisMaterial, which is the material that's being modified by the script. +The ProcessDiffuse() method is a coroutine that takes the original diffuse map and applies a set of image processing techniques on it to generate a new, modified diffuse map. It does this by using a material with a specific shader that can perform these processing techniques. The material is set up with various properties such as the original diffuse map, a blurred version of the map, an average color map, and various parameters for the processing techniques (e.g. blur contrast, light/dark mask power, hot/dark spot, final contrast, color lerp, saturation). The method then uses the Graphics.Blit method to render the modified diffuse map to a RenderTexture, which is then read and applied to a Texture2D object. The method then waits for 0.1 seconds and cleans up the RenderTexture. + +The ProcessBlur() method is a coroutine that processes the blur of the diffuse map. It does this by creating a new RenderTexture, then setting up the material with the appropriate properties for blurring the image. It then uses the Graphics.Blit method to perform blurring on the original diffuse map by repeatedly applying a horizontal and vertical blur pass to the image. The blurred image is then applied to the _blurMap variable, which is then used in the ProcessDiffuse() method. + +The ProcessBlur() method is a coroutine that generates an average color map of the diffuse map by repeatedly applying a blur pass to the image until it reaches a specified number of samples. The average color map is then used in the ProcessDiffuse() method. + + */ +/*TODO: + * One way to separate the responsibilities of this script would be to create separate scripts for each major functionality it currently handles. For example: + +Create a script called "EditDiffuseSettingsHandler" that would handle initializing, getting and setting the "EditDiffuseSettings" object, as well as any other functionality related to that object. + +Create a script called "EditDiffuseRenderer" that would handle all of the rendering functionality, such as the ProcessDiffuse and ProcessBlur methods, as well as any other rendering-related functionality. + +Create a script called "EditDiffuseUI" that would handle all the UI functionality, such as the OnGUI method, as well as any other UI-related functionality. + +Create a script called "EditDiffuse" that would handle the overall functionality of the script, such as initializing the material, textures, and other variables, as well as calling the methods from the other scripts. +*/ #region using System.Collections; @@ -6,61 +46,139 @@ #endregion +/// +/// The EditDiffuseSettings class contains properties for various settings used in the diffuse map editing process. +/// Each property has a default value and a string representation of that value for display in the editor. +/// public class EditDiffuseSettings { + /// + /// The size of the blur used for averaging the color of the diffuse map. + /// [DefaultValue(50)] public int AvgColorBlurSize; + /// + /// The string representation of the property for display in the editor. + /// [DefaultValue("50")] public string AvgColorBlurSizeText; + /// + /// The contrast of the blur applied to the diffuse map. + /// [DefaultValue(0.0f)] public float BlurContrast; + /// + /// The string representation of the property for display in the editor. + /// [DefaultValue("0")] public string BlurContrastText; + /// + /// The size of the blur applied to the diffuse map. + /// [DefaultValue(20)] public int BlurSize; + /// + /// The text representation of the BlurSize property. + /// [DefaultValue("20")] public string BlurSizeText; + /// + /// The amount of color blending between the original and blurred image. + /// [DefaultValue(0.5f)] public float ColorLerp; - + /// + /// The text representation of the ColorLerp property. + /// [DefaultValue("0.5")] public string ColorLerpText; + /// + /// The power of the dark mask effect. + /// [DefaultValue(0.5f)] public float DarkMaskPow; - + /// + /// The text representation of the DarkMaskPow property. + /// [DefaultValue("0.5")] public string DarkMaskPowText; + /// + /// The power of the darkening effect. + /// [DefaultValue(0.0f)] public float DarkPow; - + /// + /// The text representation of the DarkPow property. + /// [DefaultValue("0")] public string DarkPowText; + /// + /// The amount of darkening in the spots of the image. + /// [DefaultValue(0.0f)] public float DarkSpot; - + /// + /// The text representation of the DarkSpot property. + /// [DefaultValue("0")] public string DarkSpotText; + /// + /// The bias of the final image after all adjustments are made. + /// [DefaultValue(0.0f)] public float FinalBias; - + /// + /// The text representation of the FinalBias property. + /// [DefaultValue("0")] public string FinalBiasText; + /// + /// The contrast of the final image after all adjustments are made. + /// [DefaultValue(1.0f)] public float FinalContrast; - + /// + /// The text representation of the FinalContrast property. + /// [DefaultValue("1")] public string FinalContrastText; + /// + /// The amount of brightening in the spots of the image. + /// [DefaultValue(0.0f)] public float HotSpot; - + /// + /// The text representation of the HotSpot property. + /// [DefaultValue("0")] public string HotSpotText; + /// + /// The power of the light mask effect. + /// [DefaultValue(0.5f)] public float LightMaskPow; + /// + /// The text representation of the LightMaskPow property. + /// + /// The power of light in the image + /// [DefaultValue(0f)] public float LightPow; + /// + /// The string representation of the LightPow property + /// [DefaultValue("0")] public string LightPowText; + /// + /// The saturation of the final image + /// [DefaultValue(1.0f)] public float Saturation; + /// + /// The string representation of the Saturation property + /// [DefaultValue("1")] public string SaturationText; + /// + /// Initializes a new instance of the class with default values + /// public EditDiffuseSettings() { AvgColorBlurSize = 50; @@ -73,7 +191,7 @@ public EditDiffuseSettings() BlurContrastText = "0"; LightMaskPow = 0.5f; - LightMaskPowText = "0"; + LightMaskPowText = "0.5"; LightPow = 0.0f; LightPowText = "0"; @@ -104,6 +222,7 @@ public EditDiffuseSettings() } } + public class EditDiffuseGui : MonoBehaviour { private static readonly int Slider = Shader.PropertyToID("_Slider"); diff --git a/Assets/Scripts/Editor/TextureImportTest.cs b/Assets/Scripts/Editor/TextureImportTest.cs deleted file mode 100644 index 62ca5508..00000000 --- a/Assets/Scripts/Editor/TextureImportTest.cs +++ /dev/null @@ -1,23 +0,0 @@ -#region - -using UnityEngine; - -#endregion - -public class TextureImportTest : MonoBehaviour -{ -// // Use this for initialization -// void Start () { -// -// string PathToLoad = "test"; -// -// FIBITMAP bitmap = FreeImage.LoadEx (PathToLoad); -// bool importSuccess = FreeImage.SaveEx (bitmap, Application.dataPath + "/tempImage.png", FREE_IMAGE_FORMAT.FIF_PNG); -// -// } -// -// // Update is called once per frame -// void Update () { -// -// } -} \ No newline at end of file diff --git a/Assets/Scripts/Editor/TextureImportTest.cs.meta b/Assets/Scripts/Editor/TextureImportTest.cs.meta deleted file mode 100644 index c55d3f1a..00000000 --- a/Assets/Scripts/Editor/TextureImportTest.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c09d46a8e3e002b4c8d9f03e7dde0c5a -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Scripts/FlipUIElement.cs b/Assets/Scripts/FlipUIElement.cs new file mode 100644 index 00000000..2af9453e --- /dev/null +++ b/Assets/Scripts/FlipUIElement.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +public class FlipUIElement : MonoBehaviour +{ + public void FlipUiElement(GameObject Obj) + { + Obj.SetActive(!Obj.activeSelf); + } +} diff --git a/Assets/Scripts/FlipUIElement.cs.meta b/Assets/Scripts/FlipUIElement.cs.meta new file mode 100644 index 00000000..535a51a3 --- /dev/null +++ b/Assets/Scripts/FlipUIElement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 46ddaf5f7918a4f459deb05a34ab9815 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GetColorFromLight.cs b/Assets/Scripts/GetColorFromLight.cs index 5d3b692b..40965618 100644 --- a/Assets/Scripts/GetColorFromLight.cs +++ b/Assets/Scripts/GetColorFromLight.cs @@ -4,22 +4,45 @@ #endregion +/* TODO: & Description +This script is responsible for updating the color of a material based on the color of a light. It does this by getting the color of the light component in the "Update" method and then sets the "_Color" property of the material's shader to the color of the light. +It could be split into 2 different scripts + +One that has the logic to get the color of the light and store it in a variable +another one that has the logic to apply the color to the material. +*/ + public class GetColorFromLight : MonoBehaviour { + /// + ///This variable will hold the reference to the _Color property of the shader + /// private static readonly int Color = Shader.PropertyToID("_Color"); + /// + /// This variable will hold the reference to the Light component + /// private Light _thisLight; - + /// + /// This variable will hold the reference to the Material component of the object + /// private Material _thisMaterial; + /// + /// This variable will hold the reference to the GameObject that has the Light component + /// public GameObject LightObject; private void Start() { + //Get the Light component from the LightObject variable _thisLight = LightObject.GetComponent(); + //Get the Material component from the object _thisMaterial = GetComponent().material; } private void Update() { + //Set the color of the _Color property of the shader to the color of the light _thisMaterial.SetColor(Color, _thisLight.color); } -} \ No newline at end of file +} + diff --git a/Assets/Scripts/HeightFromDiffuseSettings.cs.meta b/Assets/Scripts/HeightFromDiffuseSettings.cs.meta deleted file mode 100644 index 54546d7e..00000000 --- a/Assets/Scripts/HeightFromDiffuseSettings.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 5597a94af0aa46e0b8a9e60ae791318f -timeCreated: 1549045031 \ No newline at end of file diff --git a/Assets/Scripts/MainGui.cs b/Assets/Scripts/MainGui.cs deleted file mode 100644 index e52ed505..00000000 --- a/Assets/Scripts/MainGui.cs +++ /dev/null @@ -1,1877 +0,0 @@ -#region - -using System; -using System.Collections.Generic; -using System.Linq; -using SFB; -using UnityEngine; - - -#endregion - -public class MainGui : MonoBehaviour -{ - private const float GamaCorrection = 2.2f; - - - public static MainGui Instance; - - public static readonly string[] LoadFormats = - { - "png", "jpg", "jpeg", "tga", "bmp", "exr" - }; - - private static readonly int CorrectionId = Shader.PropertyToID("_GamaCorrection"); - private static readonly int MainTexId = Shader.PropertyToID("_MainTex"); - private static readonly int GlobalCubemapId = Shader.PropertyToID("_GlobalCubemap"); - private static readonly int DisplacementMapId = Shader.PropertyToID("_DisplacementMap"); - private static readonly int DiffuseMapId = Shader.PropertyToID("_DiffuseMap"); - private static readonly int NormalMapId = Shader.PropertyToID("_NormalMap"); - private static readonly int MetallicMapId = Shader.PropertyToID("_MetallicMap"); - private static readonly int SmoothnessMapId = Shader.PropertyToID("_SmoothnessMap"); - private static readonly int AoMapId = Shader.PropertyToID("_AOMap"); - private static readonly int EdgeMapId = Shader.PropertyToID("_EdgeMap"); - private static readonly int TilingId = Shader.PropertyToID("_Tiling"); - - private readonly ExtensionFilter[] _imageLoadFilter = - { - new ExtensionFilter("Image Files", LoadFormats) - }; - - private readonly ExtensionFilter[] _imageSaveFilter = - { - new ExtensionFilter("Image Files", "png", "jpg", "jpeg", "tga", "exr") - }; - - private MapType _activeMapType; - - private bool _busySaving; - - private bool _clearTextures; - private bool _exrSelected; - - - private bool _jpgSelected; - public string _lastDirectory = ""; - - private List _objectsToUnhide; - public char _pathChar = '/'; - private bool _pngSelected = true; - private bool _propBlueChoose; - private Material _propertyCompMaterial; - - private Shader _propertyCompShader; - private bool _propGreenChoose; - private bool _propRedChoose; - private bool _propAlphaChoose; - public SaveLoadProject _saveLoadProjectScript; - private int _selectedCubemap; - private SettingsGui _settingsGuiScript; - - private Texture2D _textureToLoad; - private Texture2D _textureToSave; - private bool _tgaSelected; - - private Material _thisMaterial; - private TilingTextureMakerGui _tilingTextureMakerGuiScript; - - public AlignmentGui AlignmentGuiScript; - - public GameObject AoFromNormalGuiObject; - public AoFromNormalGui AoFromNormalGuiScript; - public Texture2D AoMap; - - public Cubemap[] CubeMaps; - public Texture2D DiffuseMap; - public Texture2D DiffuseMapOriginal; - - public GameObject EdgeFromNormalGuiObject; - public EdgeFromNormalGui EdgeFromNormalGuiScript; - public Texture2D EdgeMap; - - public GameObject EditDiffuseGuiObject; - public EditDiffuseGui EditDiffuseGuiScript; - public Material FullMaterial; - - public Material FullMaterialRef; - - public RenderTexture HdHeightMap; - - public GameObject HeightFromDiffuseGuiObject; - public HeightFromDiffuseGui HeightFromDiffuseGuiScript; - public Texture2D HeightMap; - - public GameObject MaterialGuiObject; - public MaterialGui MaterialGuiScript; - - public GameObject MetallicGuiObject; - public MetallicGui MetallicGuiScript; - public Texture2D MetallicMap; - - public GameObject NormalFromHeightGuiObject; - public NormalFromHeightGui NormalFromHeightGuiScript; - public Texture2D NormalMap; - - public GameObject PostProcessGuiObject; - public PropChannelMap PropBlue = PropChannelMap.None; - public Texture2D TextureBlue = null; - public Texture2D PropertyMap; - public PropChannelMap PropGreen = PropChannelMap.None; - public Texture2D TextureGreen = null; - public PropChannelMap PropRed = PropChannelMap.None; - public Texture2D TextureRed = null; - public PropChannelMap PropAlpha = PropChannelMap.None; - public Texture2D TextureAlpha = null; - - public string QuicksavePathAo = ""; - public string QuicksavePathDiffuse = ""; - public string QuicksavePathEdge = ""; - public string QuicksavePathHeight = ""; - public string QuicksavePathMetallic = ""; - public string QuicksavePathNormal = ""; - public string QuicksavePathProperty = ""; - public string QuicksavePathSmoothness = ""; - - //public Material skyboxMaterial; - public ReflectionProbe ReflectionProbe; - [HideInInspector] public Material SampleMaterial; - public Material SampleMaterialRef; - - public GameObject SaveLoadProjectObject; - public FileFormat SelectedFormat; - - public GameObject SettingsGuiObject; - - public GameObject SmoothnessGuiObject; - public SmoothnessGui SmoothnessGuiScript; - public Texture2D SmoothnessMap; - public GameObject TestObject; - - public Texture2D TextureBlack; - public Texture2D TextureGrey; - public Texture2D TextureNormal; - public Texture2D TextureWhite; - - public GameObject TilingTextureMakerGuiObject; - public BatchUI Batchui; - - public string XSize = "1024"; - public string YSize = "1024"; - public bool ScaleTexture; - private bool ScaleTextureLocked; - - private void Awake() - { - Instance = this; - } - - private void Start() - { - Batchui = gameObject.AddComponent(); - _lastDirectory = Application.dataPath; - - HeightMap = null; - HdHeightMap = null; - DiffuseMap = null; - DiffuseMapOriginal = null; - NormalMap = null; - MetallicMap = null; - SmoothnessMap = null; - EdgeMap = null; - AoMap = null; - - _propertyCompShader = Shader.Find("Hidden/Blit_Property_Comp"); - _propertyCompMaterial = new Material(_propertyCompShader); - - Shader.SetGlobalFloat(CorrectionId, GamaCorrection); - - FullMaterial = new Material(FullMaterialRef.shader); - FullMaterial.CopyPropertiesFromMaterial(FullMaterialRef); - - SampleMaterial = new Material(SampleMaterialRef.shader); - SampleMaterial.CopyPropertiesFromMaterial(SampleMaterialRef); - - HeightFromDiffuseGuiScript = HeightFromDiffuseGuiObject.GetComponent(); - NormalFromHeightGuiScript = NormalFromHeightGuiObject.GetComponent(); - EdgeFromNormalGuiScript = EdgeFromNormalGuiObject.GetComponent(); - AoFromNormalGuiScript = AoFromNormalGuiObject.GetComponent(); - EditDiffuseGuiScript = EditDiffuseGuiObject.GetComponent(); - MetallicGuiScript = MetallicGuiObject.GetComponent(); - SmoothnessGuiScript = SmoothnessGuiObject.GetComponent(); - MaterialGuiScript = MaterialGuiObject.GetComponent(); - _tilingTextureMakerGuiScript = TilingTextureMakerGuiObject.GetComponent(); - _saveLoadProjectScript = SaveLoadProjectObject.GetComponent(); - _settingsGuiScript = SettingsGuiObject.GetComponent(); - - _settingsGuiScript.LoadSettings(); - - if (Application.platform == RuntimePlatform.WindowsEditor || - Application.platform == RuntimePlatform.WindowsPlayer) - _pathChar = '\\'; - - TestObject.GetComponent().material = FullMaterial; - SetMaterialValues(); - - ReflectionProbe.RenderProbe(); - - HideGuiLocker.LockEmpty += LoadHideState; - } - - public void SaveHideState() - { - if (HideGuiLocker.IsLocked) return; - _lastGuiIsHiddenState = IsGuiHidden; - } - - public void SaveHideStateAndHideAndLock(object sender) - { - SaveHideState(); - IsGuiHidden = true; - HideGuiLocker.Lock(sender); - } - - private void LoadHideState(object sender, EventArgs eventArgs) - { - IsGuiHidden = _lastGuiIsHiddenState; - } - - public void SetPreviewMaterial(Texture2D textureToPreview) - { - CloseWindows(); - if (textureToPreview == null) return; - FixSizeMap(textureToPreview); - SampleMaterial.SetTexture(MainTexId, textureToPreview); - TestObject.GetComponent().material = SampleMaterial; - } - - public void SetPreviewMaterial(RenderTexture textureToPreview) - { - CloseWindows(); - if (textureToPreview == null) return; - FixSizeMap(textureToPreview); - SampleMaterial.SetTexture(MainTexId, textureToPreview); - TestObject.GetComponent().material = SampleMaterial; - } - - public void SetMaterialValues() - { - Shader.SetGlobalTexture(GlobalCubemapId, CubeMaps[_selectedCubemap]); - - FullMaterial.SetTexture(DisplacementMapId, HeightMap != null ? HeightMap : TextureGrey); - - if (DiffuseMap != null) - FullMaterial.SetTexture(DiffuseMapId, DiffuseMap); - else if (DiffuseMapOriginal != null) - FullMaterial.SetTexture(DiffuseMapId, DiffuseMapOriginal); - else - FullMaterial.SetTexture(DiffuseMapId, TextureGrey); - - FullMaterial.SetTexture(NormalMapId, NormalMap != null ? NormalMap : TextureNormal); - - FullMaterial.SetTexture(MetallicMapId, MetallicMap != null ? MetallicMap : TextureBlack); - - FullMaterial.SetTexture(SmoothnessMapId, SmoothnessMap != null ? SmoothnessMap : TextureBlack); - - FullMaterial.SetTexture(AoMapId, AoMap != null ? AoMap : TextureWhite); - - FullMaterial.SetTexture(EdgeMapId, EdgeMap != null ? EdgeMap : TextureGrey); - - TestObject.GetComponent().material = FullMaterial; - - FullMaterial.SetVector(TilingId, new Vector4(1, 1, 0, 0)); - } - - public void CloseWindows() - { - HeightFromDiffuseGuiScript.Close(); - NormalFromHeightGuiScript.Close(); - EdgeFromNormalGuiScript.Close(); - AoFromNormalGuiScript.Close(); - EditDiffuseGuiScript.Close(); - MetallicGuiScript.Close(); - SmoothnessGuiScript.Close(); - _tilingTextureMakerGuiScript.Close(); - AlignmentGuiScript.Close(); - MaterialGuiObject.SetActive(false); - PostProcessGuiObject.SetActive(false); - } - - private void HideWindows() - { - _objectsToUnhide = new List(); - - if (HeightFromDiffuseGuiObject.activeSelf) _objectsToUnhide.Add(HeightFromDiffuseGuiObject); - - if (NormalFromHeightGuiObject.activeSelf) _objectsToUnhide.Add(NormalFromHeightGuiObject); - - if (EdgeFromNormalGuiObject.activeSelf) _objectsToUnhide.Add(EdgeFromNormalGuiObject); - - if (AoFromNormalGuiObject.activeSelf) _objectsToUnhide.Add(AoFromNormalGuiObject); - - if (EditDiffuseGuiObject.activeSelf) _objectsToUnhide.Add(EditDiffuseGuiObject); - - if (MetallicGuiObject.activeSelf) _objectsToUnhide.Add(MetallicGuiObject); - - if (SmoothnessGuiObject.activeSelf) _objectsToUnhide.Add(SmoothnessGuiObject); - - if (MaterialGuiObject.activeSelf) _objectsToUnhide.Add(MaterialGuiObject); - - if (PostProcessGuiObject.activeSelf) _objectsToUnhide.Add(PostProcessGuiObject); - - if (TilingTextureMakerGuiObject.activeSelf) _objectsToUnhide.Add(TilingTextureMakerGuiObject); - - HeightFromDiffuseGuiObject.SetActive(false); - NormalFromHeightGuiObject.SetActive(false); - EdgeFromNormalGuiObject.SetActive(false); - AoFromNormalGuiObject.SetActive(false); - EditDiffuseGuiObject.SetActive(false); - MetallicGuiObject.SetActive(false); - SmoothnessGuiObject.SetActive(false); - MaterialGuiObject.SetActive(false); - PostProcessGuiObject.SetActive(false); - TilingTextureMakerGuiObject.SetActive(false); - } - - private static void Fullscreen() - { - Screen.fullScreen = !Screen.fullScreen; - } - - private void OnGUI() - { - #region Unhideable Buttons - - //==================================================// - // Unhidable Buttons // - //==================================================// - - if (GUI.Button(new Rect(Screen.width - 80, Screen.height - 40, 70, 30), "Quit")) Application.Quit(); - - if (GUI.Button(new Rect(Screen.width - 480, Screen.height - 40, 100, 30), "Batch Textures")) - { - - Batchui.BatchLoadTextures(); - } - - Batchui.UseInitalLocation = GUI.Toggle(new Rect(Screen.width - 480, Screen.height - 60, 140, 20), Batchui.UseInitalLocation, "Use Inital Location"); - Batchui.ProcessPropertyMap = GUI.Toggle(new Rect(Screen.width - 480, Screen.height - 80, 140, 20), Batchui.ProcessPropertyMap, "Use Property Map"); - - GUI.enabled = false; - if (Screen.fullScreen) - { - if (GUI.Button(new Rect(Screen.width - 190, Screen.height - 40, 100, 30), "Windowed")) Fullscreen(); - } - else - { - if (GUI.Button(new Rect(Screen.width - 190, Screen.height - 40, 100, 30), "Full Screen")) Fullscreen(); - } - - GUI.enabled = true; - -// if (GUI.Button(new Rect(Screen.width - 260, 10, 140, 30), "Make Suggestion")) -// SuggestionGuiObject.SetActive(true); - - if (IsGuiHidden) - { - if (GUI.Button(new Rect(Screen.width - 110, 10, 100, 30), "Show Gui")) - { - IsGuiHidden = false; - } - else return; - } - else - { - if (GUI.Button(new Rect(Screen.width - 110, 10, 100, 30), "Hide Gui")) - { - IsGuiHidden = true; - } - } - - #endregion - - #region Main Gui - -//==================================================// - // Main Gui // - //==================================================// - - - const int spacingX = 130; - - var offsetX = 20; - var offsetY = 20; - - - //==============================// - // Height Map // - //==============================// - - GUI.Box(new Rect(offsetX, offsetY, 110, 250), "Height Map"); - - if (HeightMap != null) GUI.DrawTexture(new Rect(offsetX + 5, offsetY + 25, 100, 100), HeightMap); - - // Paste - if (GUI.Button(new Rect(offsetX + 5, offsetY + 130, 20, 20), "P")) - { - _activeMapType = MapType.Height; - PasteFile(); - } - - GUI.enabled = HeightMap != null; - - // Copy - if (GUI.Button(new Rect(offsetX + 30, offsetY + 130, 20, 20), "C")) - { - _textureToSave = HeightMap; - CopyFile(); - } - - GUI.enabled = true; - - // Open - if (GUI.Button(new Rect(offsetX + 60, offsetY + 130, 20, 20), "O")) OpenTextureFile(MapType.Height); - - GUI.enabled = HeightMap != null; - - // Save - if (GUI.Button(new Rect(offsetX + 85, offsetY + 130, 20, 20), "S")) SaveTextureFile(MapType.Height); - - - if (HeightMap == null || QuicksavePathHeight == "") - GUI.enabled = false; - else - GUI.enabled = true; - - // Quick Save - if (GUI.Button(new Rect(offsetX + 15, offsetY + 160, 80, 20), "Quick Save")) - { - _textureToSave = HeightMap; - SaveFile(QuicksavePathProperty); - } - - GUI.enabled = HeightMap != null; - - if (GUI.Button(new Rect(offsetX + 15, offsetY + 190, 80, 20), "Preview")) SetPreviewMaterial(HeightMap); - - GUI.enabled = true; - - if (DiffuseMapOriginal == null && DiffuseMap == null && NormalMap == null) - GUI.enabled = false; - else - GUI.enabled = true; - - if (GUI.Button(new Rect(offsetX + 5, offsetY + 220, 50, 20), "Create")) - { - CloseWindows(); - FixSize(); - HeightFromDiffuseGuiObject.SetActive(true); - HeightFromDiffuseGuiScript.NewTexture(); - HeightFromDiffuseGuiScript.DoStuff(); - } - - GUI.enabled = true; - - GUI.enabled = HeightMap != null; - - if (GUI.Button(new Rect(offsetX + 60, offsetY + 220, 45, 20), "Clear")) - { - ClearTexture(MapType.Height); - CloseWindows(); - SetMaterialValues(); - FixSize(); - } - - GUI.enabled = true; - - - //==============================// - // Diffuse Map // - //==============================// - - GUI.Box(new Rect(offsetX + spacingX, offsetY, 110, 250), "Diffuse Map"); - - if (DiffuseMap != null) - GUI.DrawTexture(new Rect(offsetX + spacingX + 5, offsetY + 25, 100, 100), DiffuseMap); - else if (DiffuseMapOriginal != null) - GUI.DrawTexture(new Rect(offsetX + spacingX + 5, offsetY + 25, 100, 100), DiffuseMapOriginal); - - // Paste - if (GUI.Button(new Rect(offsetX + spacingX + 5, offsetY + 130, 20, 20), "P")) - { - _activeMapType = MapType.DiffuseOriginal; - PasteFile(); - } - - if (DiffuseMapOriginal == null && DiffuseMap == null) - GUI.enabled = false; - else - GUI.enabled = true; - - // Copy - if (GUI.Button(new Rect(offsetX + spacingX + 30, offsetY + 130, 20, 20), "C")) - { - _textureToSave = DiffuseMap != null ? DiffuseMap : DiffuseMapOriginal; - - CopyFile(); - } - - GUI.enabled = true; - - // Open - if (GUI.Button(new Rect(offsetX + spacingX + 60, offsetY + 130, 20, 20), "O")) - OpenTextureFile(MapType.DiffuseOriginal); - - if (DiffuseMapOriginal == null && DiffuseMap == null) - GUI.enabled = false; - else - GUI.enabled = true; - - // Save - if (GUI.Button(new Rect(offsetX + spacingX + 85, offsetY + 130, 20, 20), "S")) SaveTextureFile(MapType.Diffuse); - - if (DiffuseMapOriginal == null && DiffuseMap == null || QuicksavePathDiffuse == "") - GUI.enabled = false; - else - GUI.enabled = true; - - // Quick Save - if (GUI.Button(new Rect(offsetX + spacingX + 15, offsetY + 160, 80, 20), "Quick Save")) - { - _textureToSave = DiffuseMap != null ? DiffuseMap : DiffuseMapOriginal; - - SaveFile(QuicksavePathDiffuse); - } - - if (DiffuseMapOriginal == null && DiffuseMap == null) - GUI.enabled = false; - else - GUI.enabled = true; - - if (GUI.Button(new Rect(offsetX + spacingX + 15, offsetY + 190, 80, 20), "Preview")) - { - SetPreviewMaterial(DiffuseMap != null ? DiffuseMap : DiffuseMapOriginal); - } - - GUI.enabled = DiffuseMapOriginal != null; - - if (GUI.Button(new Rect(offsetX + spacingX + 5, offsetY + 220, 50, 20), "Edit")) - { - CloseWindows(); - FixSize(); - EditDiffuseGuiObject.SetActive(true); - EditDiffuseGuiScript.NewTexture(); - EditDiffuseGuiScript.DoStuff(); - } - - if (DiffuseMapOriginal == null && DiffuseMap == null) - GUI.enabled = false; - else - GUI.enabled = true; - - if (GUI.Button(new Rect(offsetX + spacingX + 60, offsetY + 220, 45, 20), "Clear")) - { - ClearTexture(MapType.Diffuse); - CloseWindows(); - SetMaterialValues(); - FixSize(); - } - - GUI.enabled = true; - - - //==============================// - // Normal Map // - //==============================// - - GUI.Box(new Rect(offsetX + spacingX * 2, offsetY, 110, 250), "Normal Map"); - - if (NormalMap != null) - GUI.DrawTexture(new Rect(offsetX + spacingX * 2 + 5, offsetY + 25, 100, 100), NormalMap); - - // Paste - if (GUI.Button(new Rect(offsetX + spacingX * 2 + 5, offsetY + 130, 20, 20), "P")) - { - _activeMapType = MapType.Normal; - PasteFile(); - } - - GUI.enabled = NormalMap != null; - - // Copy - if (GUI.Button(new Rect(offsetX + spacingX * 2 + 30, offsetY + 130, 20, 20), "C")) - { - _textureToSave = NormalMap; - CopyFile(); - } - - GUI.enabled = true; - - //Open - if (GUI.Button(new Rect(offsetX + spacingX * 2 + 60, offsetY + 130, 20, 20), "O")) - OpenTextureFile(MapType.Normal); - - GUI.enabled = NormalMap != null; - - // Save - if (GUI.Button(new Rect(offsetX + spacingX * 2 + 85, offsetY + 130, 20, 20), "S")) - SaveTextureFile(MapType.Normal); - - if (NormalMap == null || QuicksavePathNormal == "") - GUI.enabled = false; - else - GUI.enabled = true; - - // Quick Save - if (GUI.Button(new Rect(offsetX + spacingX * 2 + 15, offsetY + 160, 80, 20), "Quick Save")) - { - _textureToSave = NormalMap; - SaveFile(QuicksavePathNormal); - } - - GUI.enabled = NormalMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 2 + 15, offsetY + 190, 80, 20), "Preview")) - SetPreviewMaterial(NormalMap); - - GUI.enabled = HeightMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 2 + 5, offsetY + 220, 50, 20), "Create")) - { - CloseWindows(); - FixSize(); - NormalFromHeightGuiObject.SetActive(true); - NormalFromHeightGuiScript.NewTexture(); - NormalFromHeightGuiScript.DoStuff(); - } - - GUI.enabled = NormalMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 2 + 60, offsetY + 220, 45, 20), "Clear")) - { - ClearTexture(MapType.Normal); - CloseWindows(); - SetMaterialValues(); - FixSize(); - } - - GUI.enabled = true; - - - //==============================// - // Metallic Map // - //==============================// - - GUI.Box(new Rect(offsetX + spacingX * 3, offsetY, 110, 250), "Metallic Map"); - - if (MetallicMap != null) - GUI.DrawTexture(new Rect(offsetX + spacingX * 3 + 5, offsetY + 25, 100, 100), MetallicMap); - - // Paste - if (GUI.Button(new Rect(offsetX + spacingX * 3 + 5, offsetY + 130, 20, 20), "P")) - { - _activeMapType = MapType.Metallic; - PasteFile(); - } - - GUI.enabled = MetallicMap != null; - - // Copy - if (GUI.Button(new Rect(offsetX + spacingX * 3 + 30, offsetY + 130, 20, 20), "C")) - { - _textureToSave = MetallicMap; - CopyFile(); - } - - GUI.enabled = true; - - //Open - if (GUI.Button(new Rect(offsetX + spacingX * 3 + 60, offsetY + 130, 20, 20), "O")) - OpenTextureFile(MapType.Metallic); - - GUI.enabled = MetallicMap != null; - - // Save - if (GUI.Button(new Rect(offsetX + spacingX * 3 + 85, offsetY + 130, 20, 20), "S")) - SaveTextureFile(MapType.Metallic); - - if (MetallicMap == null || QuicksavePathMetallic == "") - GUI.enabled = false; - else - GUI.enabled = true; - - // Quick Save - if (GUI.Button(new Rect(offsetX + spacingX * 3 + 15, offsetY + 160, 80, 20), "Quick Save")) - { - _textureToSave = MetallicMap; - SaveFile(QuicksavePathMetallic); - } - - GUI.enabled = MetallicMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 3 + 15, offsetY + 190, 80, 20), "Preview")) - SetPreviewMaterial(MetallicMap); - - if (DiffuseMapOriginal == null && DiffuseMap == null) - GUI.enabled = false; - else - GUI.enabled = true; - - if (GUI.Button(new Rect(offsetX + spacingX * 3 + 5, offsetY + 220, 50, 20), "Create")) - { - CloseWindows(); - FixSize(); - - MetallicGuiObject.SetActive(true); - MetallicGuiScript.NewTexture(); - MetallicGuiScript.DoStuff(); - } - - GUI.enabled = MetallicMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 3 + 60, offsetY + 220, 45, 20), "Clear")) - { - ClearTexture(MapType.Metallic); - CloseWindows(); - SetMaterialValues(); - FixSize(); - } - - GUI.enabled = true; - - - //==============================// - // Smoothness Map // - //==============================// - - GUI.Box(new Rect(offsetX + spacingX * 4, offsetY, 110, 250), "Smoothness Map"); - - if (SmoothnessMap != null) - GUI.DrawTexture(new Rect(offsetX + spacingX * 4 + 5, offsetY + 25, 100, 100), SmoothnessMap); - - // Paste - if (GUI.Button(new Rect(offsetX + spacingX * 4 + 5, offsetY + 130, 20, 20), "P")) - { - _activeMapType = MapType.Smoothness; - PasteFile(); - } - - GUI.enabled = SmoothnessMap != null; - - // Copy - if (GUI.Button(new Rect(offsetX + spacingX * 4 + 30, offsetY + 130, 20, 20), "C")) - { - _textureToSave = SmoothnessMap; - CopyFile(); - } - - GUI.enabled = true; - - //Open - if (GUI.Button(new Rect(offsetX + spacingX * 4 + 60, offsetY + 130, 20, 20), "O")) - OpenTextureFile(MapType.Smoothness); - - GUI.enabled = SmoothnessMap != null; - - // Save - if (GUI.Button(new Rect(offsetX + spacingX * 4 + 85, offsetY + 130, 20, 20), "S")) - SaveTextureFile(MapType.Smoothness); - - if (SmoothnessMap == null || QuicksavePathSmoothness == "") - GUI.enabled = false; - else - GUI.enabled = true; - - // Quick Save - if (GUI.Button(new Rect(offsetX + spacingX * 4 + 15, offsetY + 160, 80, 20), "Quick Save")) - { - _textureToSave = SmoothnessMap; - SaveFile(QuicksavePathSmoothness); - } - - GUI.enabled = SmoothnessMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 4 + 15, offsetY + 190, 80, 20), "Preview")) - SetPreviewMaterial(SmoothnessMap); - - if (DiffuseMapOriginal == null && DiffuseMap == null) - GUI.enabled = false; - else - GUI.enabled = true; - - if (GUI.Button(new Rect(offsetX + spacingX * 4 + 5, offsetY + 220, 50, 20), "Create")) - { - CloseWindows(); - FixSize(); - SmoothnessGuiObject.SetActive(true); - SmoothnessGuiScript.NewTexture(); - SmoothnessGuiScript.DoStuff(); - } - - GUI.enabled = SmoothnessMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 4 + 60, offsetY + 220, 45, 20), "Clear")) - { - ClearTexture(MapType.Smoothness); - CloseWindows(); - SetMaterialValues(); - FixSize(); - } - - GUI.enabled = true; - - - //==============================// - // Edge Map // - //==============================// - - GUI.Box(new Rect(offsetX + spacingX * 5, offsetY, 110, 250), "Edge Map"); - - if (EdgeMap != null) GUI.DrawTexture(new Rect(offsetX + spacingX * 5 + 5, offsetY + 25, 100, 100), EdgeMap); - - // Paste - if (GUI.Button(new Rect(offsetX + spacingX * 5 + 5, offsetY + 130, 20, 20), "P")) - { - _activeMapType = MapType.Edge; - PasteFile(); - } - - GUI.enabled = EdgeMap != null; - - // Copy - if (GUI.Button(new Rect(offsetX + spacingX * 5 + 30, offsetY + 130, 20, 20), "C")) - { - _textureToSave = EdgeMap; - CopyFile(); - } - - GUI.enabled = true; - - //Open - if (GUI.Button(new Rect(offsetX + spacingX * 5 + 60, offsetY + 130, 20, 20), "O")) - OpenTextureFile(MapType.Edge); - - GUI.enabled = EdgeMap != null; - - // Save - if (GUI.Button(new Rect(offsetX + spacingX * 5 + 85, offsetY + 130, 20, 20), "S")) - SaveTextureFile(MapType.Edge); - - if (EdgeMap == null || QuicksavePathEdge == "") - GUI.enabled = false; - else - GUI.enabled = true; - - // Quick Save - if (GUI.Button(new Rect(offsetX + spacingX * 5 + 15, offsetY + 160, 80, 20), "Quick Save")) - { - _textureToSave = EdgeMap; - SaveFile(QuicksavePathEdge); - } - - GUI.enabled = EdgeMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 5 + 15, offsetY + 190, 80, 20), "Preview")) - SetPreviewMaterial(EdgeMap); - - GUI.enabled = NormalMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 5 + 5, offsetY + 220, 50, 20), "Create")) - { - CloseWindows(); - FixSize(); - EdgeFromNormalGuiObject.SetActive(true); - EdgeFromNormalGuiScript.NewTexture(); - EdgeFromNormalGuiScript.DoStuff(); - } - - GUI.enabled = EdgeMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 5 + 60, offsetY + 220, 45, 20), "Clear")) - { - ClearTexture(MapType.Edge); - CloseWindows(); - SetMaterialValues(); - FixSize(); - } - - GUI.enabled = true; - - //==============================// - // AO Map // - //==============================// - - GUI.Box(new Rect(offsetX + spacingX * 6, offsetY, 110, 250), "AO Map"); - - if (AoMap != null) GUI.DrawTexture(new Rect(offsetX + spacingX * 6 + 5, offsetY + 25, 100, 100), AoMap); - - - // Paste - if (GUI.Button(new Rect(offsetX + spacingX * 6 + 5, offsetY + 130, 20, 20), "P")) - { - _activeMapType = MapType.Ao; - PasteFile(); - } - - GUI.enabled = AoMap != null; - - // Copy - if (GUI.Button(new Rect(offsetX + spacingX * 6 + 30, offsetY + 130, 20, 20), "C")) - { - _textureToSave = AoMap; - CopyFile(); - } - - GUI.enabled = true; - - //Open - if (GUI.Button(new Rect(offsetX + spacingX * 6 + 60, offsetY + 130, 20, 20), "O")) OpenTextureFile(MapType.Ao); - - GUI.enabled = AoMap != null; - - // Save - if (GUI.Button(new Rect(offsetX + spacingX * 6 + 85, offsetY + 130, 20, 20), "S")) SaveTextureFile(MapType.Ao); - - if (AoMap == null || QuicksavePathAo == "") - GUI.enabled = false; - else - GUI.enabled = true; - - // Quick Save - if (GUI.Button(new Rect(offsetX + spacingX * 6 + 15, offsetY + 160, 80, 20), "Quick Save")) - { - _textureToSave = AoMap; - SaveFile(QuicksavePathAo); - } - - GUI.enabled = AoMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 6 + 15, offsetY + 190, 80, 20), "Preview")) - SetPreviewMaterial(AoMap); - - if (NormalMap == null && HeightMap == null) - GUI.enabled = false; - else - GUI.enabled = true; - - if (GUI.Button(new Rect(offsetX + spacingX * 6 + 5, offsetY + 220, 50, 20), "Create")) - { - CloseWindows(); - FixSize(); - AoFromNormalGuiObject.SetActive(true); - AoFromNormalGuiScript.NewTexture(); - AoFromNormalGuiScript.DoStuff(); - } - - GUI.enabled = AoMap != null; - - if (GUI.Button(new Rect(offsetX + spacingX * 6 + 60, offsetY + 220, 45, 20), "Clear")) - { - ClearTexture(MapType.Ao); - CloseWindows(); - SetMaterialValues(); - FixSize(); - } - - GUI.enabled = true; - - - //==============================// - // Map Saving Options // - //==============================// - - offsetX = offsetX + spacingX * 7; - - GUI.Box(new Rect(offsetX, offsetY, 230, 270), "Saving Options"); - - GUI.Label(new Rect(offsetX + 20, offsetY + 20, 100, 25), "File Format"); - - _pngSelected = GUI.Toggle(new Rect(offsetX + 5, offsetY + 45, 80, 20), _pngSelected, "PNG"); - if (_pngSelected) SetFormat(FileFormat.Png); - - _jpgSelected = GUI.Toggle(new Rect(offsetX + 55, offsetY + 45, 80, 20), _jpgSelected, "JPG"); - if (_jpgSelected) SetFormat(FileFormat.Jpg); - - _tgaSelected = GUI.Toggle(new Rect(offsetX + 5, offsetY + 65, 80, 20), _tgaSelected, "TGA"); - if (_tgaSelected) SetFormat(FileFormat.Tga); - - _exrSelected = GUI.Toggle(new Rect(offsetX + 55, offsetY + 65, 80, 20), _exrSelected, "EXR"); - if (_exrSelected) SetFormat(FileFormat.Exr); - - //File Size - - GUI.Label(new Rect(offsetX + 20, offsetY + 85, 100, 25), "Texture Size"); - - - ScaleTexture = GUI.Toggle(new Rect(offsetX + 5, offsetY + 105, 100, 20), ScaleTexture, "Custom Size"); - //if (_exrSelected) SetFormat(FileFormat.Exr); - - GUI.Label(new Rect(offsetX + 15, offsetY + 125, 100, 25), "X:"); - - - XSize = GUI.TextArea(new Rect(offsetX + 30, offsetY + 125, 50, 20), XSize, 200); - - ScaleTextureLocked = GUI.Toggle(new Rect(offsetX + 80, offsetY + 133, 20, 20), ScaleTextureLocked, "L"); - if (ScaleTextureLocked) - { - if (DiffuseMapOriginal != null) - { - YSize = GUI.TextArea(new Rect(offsetX + 30, offsetY + 150, 50, 20), YSize = LockTextureValue(float.Parse(XSize), DiffuseMapOriginal.width, DiffuseMapOriginal.height).ToString(), 200); - } - else - { - YSize = GUI.TextArea(new Rect(offsetX + 30, offsetY + 150, 50, 20), YSize, 200); - } - } - else - { - YSize = GUI.TextArea(new Rect(offsetX + 30, offsetY + 150, 50, 20), YSize, 200); - } - GUI.Label(new Rect(offsetX + 15, offsetY + 150, 100, 25), "Y:"); - - - - // Flip Normal Map Y - GUI.enabled = NormalMap != null; - - if (GUI.Button(new Rect(offsetX + 10, offsetY + 180, 100, 25), "Flip Normal Y")) FlipNormalMapY(); - - GUI.enabled = true; - - //Save Project - if (GUI.Button(new Rect(offsetX + 10, offsetY + 208, 100, 25), "Save Project")) - { - const string defaultName = "baseName.mtz"; - var path = StandaloneFileBrowser.SaveFilePanel("Save Project", _lastDirectory, defaultName, "mtz"); - if (path.IsNullOrEmpty()) return; - - var lastBar = path.LastIndexOf(_pathChar); - _lastDirectory = path.Substring(0, lastBar + 1); - - _saveLoadProjectScript.SaveProject(path); - } - - //Load Project - if (GUI.Button(new Rect(offsetX + 10, offsetY + 235, 100, 25), "Load Project")) - { - var path = StandaloneFileBrowser.OpenFilePanel("Load Project", _lastDirectory, "mtz", false); - if (path[0].IsNullOrEmpty()) return; - - var lastBar = path[0].LastIndexOf(_pathChar); - _lastDirectory = path[0].Substring(0, lastBar + 1); - - _saveLoadProjectScript.LoadProject(path[0]); - } - - //======================================// - // Property Map Settings // - //======================================// - - GUI.Label(new Rect(offsetX + 130, offsetY + 20, 100, 25), "Property Map"); - - GUI.enabled = !_propRedChoose; - - GUI.Label(new Rect(offsetX + 100, offsetY + 45, 20, 20), "R:"); - if (GUI.Button(new Rect(offsetX + 120, offsetY + 45, 100, 25), PCM2String(PropRed, "Red None"))) - { - _propRedChoose = true; - _propGreenChoose = false; - _propBlueChoose = false; - _propAlphaChoose = false; - } - - GUI.enabled = !_propGreenChoose; - - GUI.Label(new Rect(offsetX + 100, offsetY + 80, 20, 20), "G:"); - if (GUI.Button(new Rect(offsetX + 120, offsetY + 80, 100, 25), PCM2String(PropGreen, "Green None"))) - { - _propRedChoose = false; - _propGreenChoose = true; - _propBlueChoose = false; - _propAlphaChoose = false; - } - - GUI.enabled = !_propBlueChoose; - - GUI.Label(new Rect(offsetX + 100, offsetY + 115, 20, 20), "B:"); - if (GUI.Button(new Rect(offsetX + 120, offsetY + 115, 100, 25), PCM2String(PropBlue, "Blue None"))) - { - _propRedChoose = false; - _propGreenChoose = false; - _propBlueChoose = true; - _propAlphaChoose = false; - } - - GUI.enabled = !_propAlphaChoose; - - GUI.Label(new Rect(offsetX + 100, offsetY + 150, 20, 20), "A:"); - if (GUI.Button(new Rect(offsetX + 120, offsetY + 150, 100, 25), PCM2String(PropAlpha, "Alpha None"))) - { - _propRedChoose = false; - _propGreenChoose = false; - _propBlueChoose = false; - _propAlphaChoose = true; - } - - GUI.enabled = true; - - var propBoxOffsetX = offsetX + 250; - const int propBoxOffsetY = 20; - if (_propRedChoose || _propGreenChoose || _propBlueChoose || _propAlphaChoose) - { - GUI.Box(new Rect(propBoxOffsetX, propBoxOffsetY, 150, 245), "Map for Channel"); - var chosen = false; - var chosenPcm = PropChannelMap.None; - Texture2D ChosenTexture = null; - if (GUI.Button(new Rect(propBoxOffsetX + 10, propBoxOffsetY + 30, 130, 25), "None")) - { - chosen = true; - chosenPcm = PropChannelMap.None; - } - - if (GUI.Button(new Rect(propBoxOffsetX + 10, propBoxOffsetY + 60, 130, 25), "Height")) - { - chosen = true; - chosenPcm = PropChannelMap.Height; - ChosenTexture = HeightMap; - } - - if (GUI.Button(new Rect(propBoxOffsetX + 10, propBoxOffsetY + 90, 130, 25), "Metallic")) - { - chosen = true; - chosenPcm = PropChannelMap.Metallic; - ChosenTexture = MetallicMap; - } - - if (GUI.Button(new Rect(propBoxOffsetX + 10, propBoxOffsetY + 120, 130, 25), "Smoothness")) - { - chosen = true; - chosenPcm = PropChannelMap.Smoothness; - ChosenTexture = SmoothnessMap; - } - - if (GUI.Button(new Rect(propBoxOffsetX + 10, propBoxOffsetY + 150, 130, 25), "Edge")) - { - chosen = true; - chosenPcm = PropChannelMap.Edge; - ChosenTexture = EdgeMap; - } - - if (GUI.Button(new Rect(propBoxOffsetX + 10, propBoxOffsetY + 180, 130, 25), "Ambient Occlusion")) - { - chosen = true; - chosenPcm = PropChannelMap.Ao; - ChosenTexture = AoMap; - } - - if (GUI.Button(new Rect(propBoxOffsetX + 10, propBoxOffsetY + 210, 130, 25), "AO + Edge")) - { - chosen = true; - chosenPcm = PropChannelMap.AoEdge; - ChosenTexture = AoMap; - } - - if (chosen) - { - if (_propRedChoose) { PropRed = chosenPcm; TextureRed = ChosenTexture; } - - if (_propGreenChoose) { PropGreen = chosenPcm; TextureGreen = ChosenTexture; } - - if (_propBlueChoose) { PropBlue = chosenPcm; TextureBlue = ChosenTexture; } - - if (_propAlphaChoose) { PropAlpha = chosenPcm; TextureAlpha = ChosenTexture; } - - _propRedChoose = false; - _propGreenChoose = false; - _propBlueChoose = false; - _propAlphaChoose = false; - } - } - - if (GUI.Button(new Rect(offsetX + 120, offsetY + 180, 100, 40), "Save\r\nProperty Map")) - { - if (PropAlpha == PropChannelMap.None) - { - ProcessPropertyMap(); - } - else - { - ProcessPropertyMapRevised(); - } - SaveTextureFile(MapType.Property); - } - - if (QuicksavePathProperty == "") GUI.enabled = false; - - if (GUI.Button(new Rect(offsetX + 120, offsetY + 220, 100, 40), "Quick Save\r\nProperty Map")) - { - ProcessPropertyMap(); - _textureToSave = PropertyMap; - SaveFile(QuicksavePathProperty); - } - - GUI.enabled = true; - - - //==========================// - // View Buttons // - //==========================// - - offsetX = 430; - offsetY = 300; - - if (GUI.Button(new Rect(offsetX, offsetY, 100, 40), "Post Process")) - { - PostProcessGuiObject.SetActive(!PostProcessGuiObject.activeSelf); - } - - offsetX += 110; - - if (GUI.Button(new Rect(offsetX, offsetY, 80, 40), "Show Full\r\nMaterial")) - { - CloseWindows(); - FixSize(); - MaterialGuiObject.SetActive(true); - MaterialGuiScript.Initialize(); - } - - offsetX += 90; - - if (GUI.Button(new Rect(offsetX, offsetY, 80, 40), "Next\r\nCube Map")) - { - _selectedCubemap += 1; - if (_selectedCubemap >= CubeMaps.Length) _selectedCubemap = 0; - - //skyboxMaterial.SetTexture ("_Tex", CubeMaps[selectedCubemap] ); - Shader.SetGlobalTexture(GlobalCubemapId, CubeMaps[_selectedCubemap]); - ReflectionProbe.RenderProbe(); - } - - offsetX += 90; - - GUI.enabled = HeightMap != null; - - if (GUI.Button(new Rect(offsetX, offsetY, 60, 40), "Tile\r\nMaps")) - { - CloseWindows(); - FixSize(); - TilingTextureMakerGuiObject.SetActive(true); - _tilingTextureMakerGuiScript.Initialize(); - } - - GUI.enabled = true; - - offsetX += 70; - - if (HeightMap == null && DiffuseMapOriginal == null && MetallicMap == null && SmoothnessMap == null && - EdgeMap == null && AoMap == null) - GUI.enabled = false; - else - GUI.enabled = true; - - if (GUI.Button(new Rect(offsetX, offsetY, 90, 40), "Adjust\r\nAlignment")) - { - CloseWindows(); - FixSize(); - AlignmentGuiScript.Initialize(); - } - - GUI.enabled = true; - - offsetX += 100; - - if (GUI.Button(new Rect(offsetX, offsetY, 120, 40), "Clear All\r\nTexture Maps")) _clearTextures = true; - - if (_clearTextures) - { - offsetY += 60; - - GUI.Box(new Rect(offsetX, offsetY, 120, 60), "Are You Sure?"); - - if (GUI.Button(new Rect(offsetX + 10, offsetY + 30, 45, 20), "Yes")) - { - _clearTextures = false; - ClearAllTextures(); - CloseWindows(); - SetMaterialValues(); - FixSizeSize(1024.0f, 1024.0f); - } - - if (GUI.Button(new Rect(offsetX + 65, offsetY + 30, 45, 20), "No")) _clearTextures = false; - } - - GUI.enabled = true; - - #endregion - } - - private void ShowGui() - { - foreach (var objToHide in _objectsToUnhide) - objToHide.SetActive(true); - } - - private void HideGui() - { - HideWindows(); - } - - public void SaveTextureFile(MapType mapType) - { - _textureToSave = HeightMap; - var defaultName = "_" + mapType + ".png"; - var path = StandaloneFileBrowser.SaveFilePanel("Save Height Map", _lastDirectory, defaultName, - _imageSaveFilter); - if (path.IsNullOrEmpty()) return; - - _textureToSave = GetTextureToSave(mapType); - - var lastBar = path.LastIndexOf(_pathChar); - _lastDirectory = path.Substring(0, lastBar + 1); - SaveFile(path); - } - - public void SaveTextureFile(MapType mapType, string path, string name) - { - _textureToSave = HeightMap; - var defaultName = name + "_" + mapType + ".png"; - // var path = StandaloneFileBrowser.SaveFilePanel("Save Height Map", _lastDirectory, defaultName, - // _imageSaveFilter); - List PathSplit = path.Split(new string[] { "/", "\\" }, StringSplitOptions.None).ToList(); - //PathSplit[PathSplit.Length - 1] - PathSplit.RemoveAt(PathSplit.Count - 1); - //Debug.Log(PathSplit); - path = string.Join("/", PathSplit.ToArray()); - path = path + "/" + defaultName; - if (path.IsNullOrEmpty()) return; - - _textureToSave = GetTextureToSave(mapType); - var lastBar = path.LastIndexOf(_pathChar); - _lastDirectory = path.Substring(0, lastBar + 1); - Debug.Log(path); - SaveFile(path); - } - private Texture2D GetTextureToSave(MapType mapType) - { - switch (mapType) - { - case MapType.Height: - return HeightMap; - case MapType.Diffuse: - return DiffuseMap != null ? DiffuseMap : DiffuseMapOriginal; - case MapType.DiffuseOriginal: - return DiffuseMapOriginal; - case MapType.Metallic: - return MetallicMap; - case MapType.Smoothness: - return SmoothnessMap; - case MapType.Normal: - return NormalMap; - case MapType.Edge: - return EdgeMap; - case MapType.Ao: - return AoMap; - case MapType.Property: - return PropertyMap; - default: - throw new ArgumentOutOfRangeException(nameof(mapType), mapType, null); - } - } - - private void OpenTextureFile(MapType mapType) - { - _activeMapType = mapType; - var title = "Open " + mapType + " Map"; - var path = StandaloneFileBrowser.OpenFilePanel(title, _lastDirectory, _imageLoadFilter, false); - if (path[0].IsNullOrEmpty()) return; - var lastBar = path[0].LastIndexOf(_pathChar); - _lastDirectory = path[0].Substring(0, lastBar + 1); - OpenFile(path[0]); - } - - // ReSharper disable once InconsistentNaming - private static string PCM2String(PropChannelMap pcm, string defaultName) - { - var returnString = defaultName; - - switch (pcm) - { - case PropChannelMap.Height: - returnString = "Height"; - break; - case PropChannelMap.Metallic: - returnString = "Metallic"; - break; - case PropChannelMap.Smoothness: - returnString = "Smoothness"; - break; - case PropChannelMap.Edge: - returnString = "Edge"; - break; - case PropChannelMap.Ao: - returnString = "Ambient Occ"; - break; - case PropChannelMap.AoEdge: - returnString = "AO + Edge"; - break; - case PropChannelMap.None: - break; - default: - throw new ArgumentOutOfRangeException(nameof(pcm), pcm, null); - } - - return returnString; - } - - public void FlipNormalMapY() - { - if (NormalMap == null) return; - for (var i = 0; i < NormalMap.width; i++) - for (var j = 0; j < NormalMap.height; j++) - { - var pixelColor = NormalMap.GetPixel(i, j); - pixelColor.g = 1.0f - pixelColor.g; - NormalMap.SetPixel(i, j, pixelColor); - } - - NormalMap.Apply(); - } - - private void ClearTexture(MapType mapType) - { - switch (mapType) - { - case MapType.Height: - if (HeightMap) - { - Destroy(HeightMap); - HeightMap = null; - } - - if (HdHeightMap) - { - Destroy(HdHeightMap); - HdHeightMap = null; - } - - break; - case MapType.Diffuse: - if (DiffuseMap) - { - Destroy(DiffuseMap); - DiffuseMap = null; - } - - if (DiffuseMapOriginal) - { - Destroy(DiffuseMapOriginal); - DiffuseMapOriginal = null; - } - - break; - case MapType.Normal: - if (NormalMap) - { - Destroy(NormalMap); - NormalMap = null; - } - - break; - case MapType.Metallic: - if (MetallicMap) - { - Destroy(MetallicMap); - MetallicMap = null; - } - - break; - case MapType.Smoothness: - if (SmoothnessMap) - { - Destroy(SmoothnessMap); - SmoothnessMap = null; - } - - break; - case MapType.Edge: - if (EdgeMap) - { - Destroy(EdgeMap); - EdgeMap = null; - } - - break; - case MapType.Ao: - if (AoMap) - { - Destroy(AoMap); - AoMap = null; - } - - break; - case MapType.DiffuseOriginal: - if (DiffuseMapOriginal) - { - Destroy(DiffuseMapOriginal); - DiffuseMapOriginal = null; - } - - break; - case MapType.Property: - break; - default: - throw new ArgumentOutOfRangeException(nameof(mapType), mapType, null); - } - - Resources.UnloadUnusedAssets(); - } - - public void ClearAllTextures() - { - ClearTexture(MapType.Height); - ClearTexture(MapType.Diffuse); - ClearTexture(MapType.Normal); - ClearTexture(MapType.Metallic); - ClearTexture(MapType.Smoothness); - ClearTexture(MapType.Edge); - ClearTexture(MapType.Ao); - } - - public void SetFormat(FileFormat newFormat) - { - _jpgSelected = false; - _pngSelected = false; - _tgaSelected = false; - _exrSelected = false; - - switch (newFormat) - { - case FileFormat.Jpg: - _jpgSelected = true; - break; - case FileFormat.Png: - _pngSelected = true; - break; - case FileFormat.Tga: - _tgaSelected = true; - break; - case FileFormat.Exr: - _exrSelected = true; - break; - default: - throw new ArgumentOutOfRangeException(nameof(newFormat), newFormat, null); - } - - SelectedFormat = newFormat; - } - - public void SetFormat(string newFormat) - { - _jpgSelected = false; - _pngSelected = false; - _tgaSelected = false; - _exrSelected = false; - - switch (newFormat) - { - case "jpg": - _jpgSelected = true; - SelectedFormat = FileFormat.Jpg; - break; - case "png": - _pngSelected = true; - SelectedFormat = FileFormat.Png; - break; - case "tga": - _tgaSelected = true; - SelectedFormat = FileFormat.Tga; - break; - case "exr": - _exrSelected = true; - SelectedFormat = FileFormat.Exr; - break; - default: - throw new ArgumentOutOfRangeException(nameof(newFormat), newFormat, null); - } - } - - public void SetLoadedTexture(MapType loadedTexture) - { - switch (loadedTexture) - { - case MapType.Height: - SetPreviewMaterial(HeightMap); - break; - case MapType.Diffuse: - SetPreviewMaterial(DiffuseMap); - break; - case MapType.DiffuseOriginal: - SetPreviewMaterial(DiffuseMapOriginal); - break; - case MapType.Normal: - SetPreviewMaterial(NormalMap); - break; - case MapType.Metallic: - SetPreviewMaterial(MetallicMap); - break; - case MapType.Smoothness: - SetPreviewMaterial(SmoothnessMap); - break; - case MapType.Edge: - SetPreviewMaterial(EdgeMap); - break; - case MapType.Ao: - SetPreviewMaterial(AoMap); - break; - case MapType.Property: - break; - default: - throw new ArgumentOutOfRangeException(nameof(loadedTexture), loadedTexture, null); - } - - FixSize(); - } - - //==================================================// - // Property Map // - //==================================================// - - private void SetPropertyTexture(string texPrefix, Texture2D texture, Texture overlayTexture) - { - _propertyCompMaterial.SetTexture(texPrefix + "Tex", texture != null ? texture : TextureBlack); - - _propertyCompMaterial.SetTexture(texPrefix + "OverlayTex", overlayTexture); - } - - private void SetPropertyMapChannel(string texPrefix, PropChannelMap pcm) - { - switch (pcm) - { - case PropChannelMap.Height: - SetPropertyTexture(texPrefix, HeightMap, TextureGrey); - break; - case PropChannelMap.Metallic: - SetPropertyTexture(texPrefix, MetallicMap, TextureGrey); - break; - case PropChannelMap.Smoothness: - SetPropertyTexture(texPrefix, SmoothnessMap, TextureGrey); - break; - case PropChannelMap.Edge: - SetPropertyTexture(texPrefix, EdgeMap, TextureGrey); - break; - case PropChannelMap.Ao: - SetPropertyTexture(texPrefix, AoMap, TextureGrey); - break; - case PropChannelMap.AoEdge: - SetPropertyTexture(texPrefix, AoMap, EdgeMap); - break; - case PropChannelMap.None: - SetPropertyTexture(texPrefix, TextureBlack, TextureGrey); - break; - default: - throw new ArgumentOutOfRangeException(nameof(pcm), pcm, null); - } - } - public void ProcessPropertyMapRevised() - { - var Size = GetSize(); - Texture2D TempMap = null; - if (PropAlpha == PropChannelMap.None) - { - TempMap = new Texture2D(HeightMap.width, HeightMap.height, TextureFormat.RGB24, false); - } - else - { - TempMap = new Texture2D(HeightMap.width, HeightMap.height, TextureFormat.RGBA32, false); - } - - Color theColour = new Color(); - for (int x = 0; x < TempMap.width; x++) - { - for (int y = 0; y < TempMap.height; y++) - { - theColour.r = TextureRed.GetPixel(x, y).grayscale; - theColour.g = TextureGreen.GetPixel(x, y).grayscale; - theColour.b = TextureBlue.GetPixel(x, y).grayscale; - if (PropAlpha == PropChannelMap.None) - { - theColour.a = 255; - } - else - { - theColour.a = TextureAlpha.GetPixel(x, y).grayscale; - - } - - TempMap.SetPixel(x, y, theColour); - } - } - TempMap.Apply(); - PropertyMap = TempMap; - SaveTextureFile(MapType.Property); - - } - public void ProcessPropertyMap() - { - SetPropertyMapChannel("_Red", PropRed); - SetPropertyMapChannel("_Green", PropGreen); - SetPropertyMapChannel("_Blue", PropBlue); - - var size = GetSize(); - var tempMap = RenderTexture.GetTemporary((int) size.x, (int) size.y, 0, RenderTextureFormat.ARGB32, - RenderTextureReadWrite.Default); - Graphics.Blit(MetallicMap, tempMap, _propertyCompMaterial, 0); - RenderTexture.active = tempMap; - - if (PropertyMap != null) - { - Destroy(PropertyMap); - PropertyMap = null; - } - - PropertyMap = new Texture2D(tempMap.width, tempMap.height, TextureFormat.RGB24, false); - PropertyMap.ReadPixels(new Rect(0, 0, tempMap.width, tempMap.height), 0, 0); - PropertyMap.Apply(); - - RenderTexture.ReleaseTemporary(tempMap); - // ReSharper disable once RedundantAssignment - tempMap = null; - } - - //==================================================// - // Project Saving // - //==================================================// - - private void SaveFile(string pathToFile) - { - _saveLoadProjectScript.SaveFile(pathToFile, _textureToSave); - } - - // ReSharper disable once MemberCanBeMadeStatic.Local - private void CopyFile() - { - _saveLoadProjectScript.CopyFile(_textureToSave); - } - - // ReSharper disable once MemberCanBeMadeStatic.Local - private void PasteFile() - { - ClearTexture(_activeMapType); - _saveLoadProjectScript.PasteFile(_activeMapType); - } - - private void OpenFile(string pathToFile) - { - if (pathToFile == null) return; - - // clear the existing texture we are loading - ClearTexture(_activeMapType); - - StartCoroutine(_saveLoadProjectScript.LoadTexture(_activeMapType, pathToFile)); - } - - //==================================================// - // Fix the size of the test model // - //==================================================// - - - private Vector2 GetSize() - { - Texture2D mapToUse = null; - - var size = new Vector2(1024, 1024); - - if (HeightMap != null) - mapToUse = HeightMap; - else if (DiffuseMap != null) - mapToUse = DiffuseMap; - else if (DiffuseMapOriginal != null) - mapToUse = DiffuseMapOriginal; - else if (NormalMap != null) - mapToUse = NormalMap; - else if (MetallicMap != null) - mapToUse = MetallicMap; - else if (SmoothnessMap != null) - mapToUse = SmoothnessMap; - else if (EdgeMap != null) - mapToUse = EdgeMap; - else if (AoMap != null) mapToUse = AoMap; - - if (mapToUse == null) return size; - size.x = mapToUse.width; - size.y = mapToUse.height; - - return size; - } - - public void FixSize() - { - var size = GetSize(); - FixSizeSize(size.x, size.y); - } - - private void FixSizeMap(Texture mapToUse) - { - FixSizeSize(mapToUse.width, mapToUse.height); - } - - private void FixSizeMap(RenderTexture mapToUse) - { - FixSizeSize(mapToUse.width, mapToUse.height); - } - - private void FixSizeSize(float width, float height) - { - var testObjectScale = new Vector3(1, 1, 1); - const float area = 1.0f; - - testObjectScale.x = width / height; - - var newArea = testObjectScale.x * testObjectScale.y; - var areaScale = Mathf.Sqrt(area / newArea); - - testObjectScale.x *= areaScale; - testObjectScale.y *= areaScale; - - TestObject.transform.localScale = testObjectScale; - } - private float TextureAspectRatio(float Height, float Width) - { - return Width / Height; - } - private float LockTextureValue(float Input,float Height,float Width) - { - return Input * (1 + TextureAspectRatio(Height, Width)); - } - - #region Gui Hide Variables - - [HideInInspector] public CountLocker HideGuiLocker = new CountLocker(); - private bool _lastGuiIsHiddenState; - private bool _isGuiHidden; - - public bool IsGuiHidden - { - get => _isGuiHidden; - set - { - if (HideGuiLocker.IsLocked) - { - Debug.Log("Tentando modificar IsGuiHidden quando travado"); - return; - } - - if (value && !_isGuiHidden) - { - HideGui(); - _isGuiHidden = true; - } - else if (!value && _isGuiHidden) - { - ShowGui(); - _isGuiHidden = false; - } - } - } - - #endregion -} \ No newline at end of file diff --git a/Assets/Scripts/Materialize.asmdef b/Assets/Scripts/Materialize.asmdef new file mode 100644 index 00000000..6db47bcf --- /dev/null +++ b/Assets/Scripts/Materialize.asmdef @@ -0,0 +1,17 @@ +{ + "name": "Materialize", + "references": [ + "GUID:a65ab7e4507a42f4f8bc009183640e34", + "GUID:0caaed79738d51e4d81fadb59d40c71d", + "GUID:4af013e9af55d0242926a03e5c4f9d09" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Scripts/Materialize.asmdef.meta b/Assets/Scripts/Materialize.asmdef.meta new file mode 100644 index 00000000..15678877 --- /dev/null +++ b/Assets/Scripts/Materialize.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: edbbeae575d464240af0034495bad353 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MetallicSettings.cs.meta b/Assets/Scripts/MetallicSettings.cs.meta deleted file mode 100644 index f15f9b4a..00000000 --- a/Assets/Scripts/MetallicSettings.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 2bdb7c40c588407da3094e0f50598bf3 -timeCreated: 1549047402 \ No newline at end of file diff --git a/Assets/Scripts/MouseWatcher.cs b/Assets/Scripts/MouseWatcher.cs new file mode 100644 index 00000000..2245c510 --- /dev/null +++ b/Assets/Scripts/MouseWatcher.cs @@ -0,0 +1,26 @@ +using UnityEngine; +using UnityEngine.EventSystems; + +/// +/// MouseWatcher class is a script that implements the IPointerEnterHandler and IPointerExitHandler interfaces to detect when the mouse pointer enters or exits the object this script is attached to. +/// +public class MouseWatcher : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler +{ + /// + /// This function is called when the mouse pointer enters the object this script is attached to. + /// + /// Data of the pointer event + public void OnPointerEnter(PointerEventData eventData) + { + this.gameObject.SetActive(true); // Enable the gameObject + } + + /// + /// This function is called when the mouse pointer exits the object this script is attached to. + /// + /// Data of the pointer event + public void OnPointerExit(PointerEventData eventData) + { + this.gameObject.SetActive(false); // Disable the gameObject + } +} diff --git a/Assets/Scripts/MouseWatcher.cs.meta b/Assets/Scripts/MouseWatcher.cs.meta new file mode 100644 index 00000000..7077c977 --- /dev/null +++ b/Assets/Scripts/MouseWatcher.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a68fa3ddad16e8c40b6529c069eb192f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NormalFromHeightSettings.cs.meta b/Assets/Scripts/NormalFromHeightSettings.cs.meta deleted file mode 100644 index c77cb380..00000000 --- a/Assets/Scripts/NormalFromHeightSettings.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 26511bdb812049f2bb1fe9e6db6eb6d9 -timeCreated: 1549048017 \ No newline at end of file diff --git a/Assets/Scripts/ObjRotator.cs b/Assets/Scripts/ObjRotator.cs index 7073d6db..2244b1be 100644 --- a/Assets/Scripts/ObjRotator.cs +++ b/Assets/Scripts/ObjRotator.cs @@ -3,39 +3,50 @@ using UnityEngine; #endregion - public class ObjRotator : MonoBehaviour { + // variable to store the last mouse position private Vector2 _lastMousePos; + // variable to store the lerped rotation private Vector3 _lerpRotation; - + // variable to store the number of times the mouse button is pressed private int _mouseDownCount; - + // variable to store the current mouse position private Vector2 _mousePos; + // variable to store the rotation of the object private Vector3 _rotation; - public bool AllowX = true; + // public variable to allow rotation on the x-axis + public bool AllowX = true; + // public variable to allow rotation on the y-axis public bool AllowY = true; - + // public variable to determine if a key needs to be held to rotate the object public bool HoldKey; + // public variable to invert the rotation on the x-axis public bool InvertX; + // public variable to invert the rotation on the y-axis public bool InvertY; + // public variable to determine if the UI should be hidden while rotating public bool AllowHideUI; - + // public variable to store the key that needs to be held to rotate the object public KeyCode KeyToHold = KeyCode.L; - + // public variable to store the mouse button used for rotation public int MouseButton; // Use this for initialization private void Start() { + // initialize the mouse position and last mouse position variables _mousePos = Input.mousePosition; _lastMousePos = _mousePos; + // initialize the rotation variable _rotation = transform.eulerAngles; + // initialize the lerped rotation variable _lerpRotation = _rotation; } + // public method to reset the rotation of the object public void Reset() { _rotation = new Vector3(0, 0, 0); @@ -43,50 +54,58 @@ public void Reset() transform.eulerAngles = _lerpRotation; } + // Update is called once per frame private void FixedUpdate() { + // check if the main GUI instance exists if (!MainGui.Instance) return; + // update the mouse position variable _mousePos = Input.mousePosition; + // calculate the difference between the current and last mouse positions var mouseOffset = _mousePos - _lastMousePos; + // check if the mouse button is pressed if (Input.GetMouseButton(MouseButton)) + // increment the mouse down count _mouseDownCount++; else + // reset the mouse down count _mouseDownCount = 0; - // skip the first frame because we could just be regaining focus - - if ((HoldKey && Input.GetKey(KeyToHold) || HoldKey == false) && _mouseDownCount > 1) + // check if the key needs to be held and if it is held or if it doesn't need to be held and the mouse has been pressed for more than one frame + if ((HoldKey && Input.GetKey(KeyCode.X) || HoldKey == false) && _mouseDownCount > 1) { + // check if rotation on the x-axis is allowed if (AllowX) { + // check if the x-axis rotation needs to be inverted if (InvertX) - _rotation -= new Vector3(0, 1, 0) * mouseOffset.x * 0.3f; + _rotation -= new Vector3(0, 1, 0) * mouseOffset.x * 0.3f; // if invertX is true, subtract mouse offset from the x-axis rotation else - _rotation += new Vector3(0, 1, 0) * mouseOffset.x * 0.3f; + _rotation += new Vector3(0, 1, 0) * mouseOffset.x * 0.3f; // if invertX is false, add mouse offset to the x-axis rotation } if (AllowY) { if (InvertY) - _rotation -= new Vector3(1, 0, 0) * mouseOffset.y * 0.3f; + _rotation -= new Vector3(1, 0, 0) * mouseOffset.y * 0.3f; // if invertY is true, subtract mouse offset from the y-axis rotation else - _rotation += new Vector3(1, 0, 0) * mouseOffset.y * 0.3f; + _rotation += new Vector3(1, 0, 0) * mouseOffset.y * 0.3f; // if invertY is false, add mouse offset to the y-axis rotation } - _rotation.x = Mathf.Clamp(_rotation.x, -80, 80); - if(AllowHideUI) MainGui.Instance.SaveHideStateAndHideAndLock(this); + _rotation.x = Mathf.Clamp(_rotation.x, -80, 80); // keep the x-axis rotation within a certain range + if (AllowHideUI) MainGui.Instance.SaveHideStateAndHideAndLock(this); // if AllowHideUI is true, call the SaveHideStateAndHideAndLock method in the MainGui class } else { - MainGui.Instance.HideGuiLocker.Unlock(this); + MainGui.Instance.HideGuiLocker.Unlock(this); // if mouse button is not being held down, call the Unlock method in the HideGuiLocker class } - _lerpRotation = _lerpRotation * 0.95f + _rotation * 0.05f; - transform.eulerAngles = _lerpRotation; + _lerpRotation = _lerpRotation * 0.95f + _rotation * 0.05f; // calculate the lerp rotation using the current rotation and the target rotation + transform.eulerAngles = _lerpRotation; // set the rotation of the object to the lerp rotation - _lastMousePos = _mousePos; + _lastMousePos = _mousePos; // set the last mouse position to the current mouse position } -} \ No newline at end of file +} diff --git a/Assets/PostProcess.meta b/Assets/Scripts/PostProcess.meta similarity index 100% rename from Assets/PostProcess.meta rename to Assets/Scripts/PostProcess.meta diff --git a/Assets/PostProcess/HaltonSequence.cs b/Assets/Scripts/PostProcess/HaltonSequence.cs similarity index 100% rename from Assets/PostProcess/HaltonSequence.cs rename to Assets/Scripts/PostProcess/HaltonSequence.cs diff --git a/Assets/PostProcess/HaltonSequence.cs.meta b/Assets/Scripts/PostProcess/HaltonSequence.cs.meta similarity index 100% rename from Assets/PostProcess/HaltonSequence.cs.meta rename to Assets/Scripts/PostProcess/HaltonSequence.cs.meta diff --git a/Assets/PostProcess/MotionBlurMatrixHelper.cs b/Assets/Scripts/PostProcess/MotionBlurMatrixHelper.cs similarity index 100% rename from Assets/PostProcess/MotionBlurMatrixHelper.cs rename to Assets/Scripts/PostProcess/MotionBlurMatrixHelper.cs diff --git a/Assets/PostProcess/MotionBlurMatrixHelper.cs.meta b/Assets/Scripts/PostProcess/MotionBlurMatrixHelper.cs.meta similarity index 100% rename from Assets/PostProcess/MotionBlurMatrixHelper.cs.meta rename to Assets/Scripts/PostProcess/MotionBlurMatrixHelper.cs.meta diff --git a/Assets/PostProcess/OpaquePostProcess.cs b/Assets/Scripts/PostProcess/OpaquePostProcess.cs similarity index 100% rename from Assets/PostProcess/OpaquePostProcess.cs rename to Assets/Scripts/PostProcess/OpaquePostProcess.cs diff --git a/Assets/PostProcess/OpaquePostProcess.cs.meta b/Assets/Scripts/PostProcess/OpaquePostProcess.cs.meta similarity index 100% rename from Assets/PostProcess/OpaquePostProcess.cs.meta rename to Assets/Scripts/PostProcess/OpaquePostProcess.cs.meta diff --git a/Assets/PostProcess/PostProcess.cs b/Assets/Scripts/PostProcess/PostProcess.cs similarity index 100% rename from Assets/PostProcess/PostProcess.cs rename to Assets/Scripts/PostProcess/PostProcess.cs diff --git a/Assets/PostProcess/PostProcess.cs.meta b/Assets/Scripts/PostProcess/PostProcess.cs.meta similarity index 100% rename from Assets/PostProcess/PostProcess.cs.meta rename to Assets/Scripts/PostProcess/PostProcess.cs.meta diff --git a/Assets/PostProcess/Resources.meta b/Assets/Scripts/PostProcess/Resources.meta similarity index 100% rename from Assets/PostProcess/Resources.meta rename to Assets/Scripts/PostProcess/Resources.meta diff --git a/Assets/PostProcess/Resources/HiddenPostProcess.shader b/Assets/Scripts/PostProcess/Resources/HiddenPostProcess.shader similarity index 100% rename from Assets/PostProcess/Resources/HiddenPostProcess.shader rename to Assets/Scripts/PostProcess/Resources/HiddenPostProcess.shader diff --git a/Assets/PostProcess/Resources/HiddenPostProcess.shader.meta b/Assets/Scripts/PostProcess/Resources/HiddenPostProcess.shader.meta similarity index 100% rename from Assets/PostProcess/Resources/HiddenPostProcess.shader.meta rename to Assets/Scripts/PostProcess/Resources/HiddenPostProcess.shader.meta diff --git a/Assets/PostProcess/Resources/HiddenTAA.shader b/Assets/Scripts/PostProcess/Resources/HiddenTAA.shader similarity index 100% rename from Assets/PostProcess/Resources/HiddenTAA.shader rename to Assets/Scripts/PostProcess/Resources/HiddenTAA.shader diff --git a/Assets/PostProcess/Resources/HiddenTAA.shader.meta b/Assets/Scripts/PostProcess/Resources/HiddenTAA.shader.meta similarity index 100% rename from Assets/PostProcess/Resources/HiddenTAA.shader.meta rename to Assets/Scripts/PostProcess/Resources/HiddenTAA.shader.meta diff --git a/Assets/PostProcess/Resources/LensDirt_01.tga b/Assets/Scripts/PostProcess/Resources/LensDirt_01.tga similarity index 100% rename from Assets/PostProcess/Resources/LensDirt_01.tga rename to Assets/Scripts/PostProcess/Resources/LensDirt_01.tga diff --git a/Assets/PostProcess/Resources/LensDirt_01.tga.meta b/Assets/Scripts/PostProcess/Resources/LensDirt_01.tga.meta similarity index 100% rename from Assets/PostProcess/Resources/LensDirt_01.tga.meta rename to Assets/Scripts/PostProcess/Resources/LensDirt_01.tga.meta diff --git a/Assets/PostProcess/Resources/LensDirt_02.tga b/Assets/Scripts/PostProcess/Resources/LensDirt_02.tga similarity index 100% rename from Assets/PostProcess/Resources/LensDirt_02.tga rename to Assets/Scripts/PostProcess/Resources/LensDirt_02.tga diff --git a/Assets/PostProcess/Resources/LensDirt_02.tga.meta b/Assets/Scripts/PostProcess/Resources/LensDirt_02.tga.meta similarity index 100% rename from Assets/PostProcess/Resources/LensDirt_02.tga.meta rename to Assets/Scripts/PostProcess/Resources/LensDirt_02.tga.meta diff --git a/Assets/PostProcess/Resources/LensDirt_03.tga b/Assets/Scripts/PostProcess/Resources/LensDirt_03.tga similarity index 100% rename from Assets/PostProcess/Resources/LensDirt_03.tga rename to Assets/Scripts/PostProcess/Resources/LensDirt_03.tga diff --git a/Assets/PostProcess/Resources/LensDirt_03.tga.meta b/Assets/Scripts/PostProcess/Resources/LensDirt_03.tga.meta similarity index 100% rename from Assets/PostProcess/Resources/LensDirt_03.tga.meta rename to Assets/Scripts/PostProcess/Resources/LensDirt_03.tga.meta diff --git a/Assets/PostProcess/Resources/LensDirt_04.tga b/Assets/Scripts/PostProcess/Resources/LensDirt_04.tga similarity index 100% rename from Assets/PostProcess/Resources/LensDirt_04.tga rename to Assets/Scripts/PostProcess/Resources/LensDirt_04.tga diff --git a/Assets/PostProcess/Resources/LensDirt_04.tga.meta b/Assets/Scripts/PostProcess/Resources/LensDirt_04.tga.meta similarity index 100% rename from Assets/PostProcess/Resources/LensDirt_04.tga.meta rename to Assets/Scripts/PostProcess/Resources/LensDirt_04.tga.meta diff --git a/Assets/PostProcess/Resources/flareMask.tga b/Assets/Scripts/PostProcess/Resources/flareMask.tga similarity index 100% rename from Assets/PostProcess/Resources/flareMask.tga rename to Assets/Scripts/PostProcess/Resources/flareMask.tga diff --git a/Assets/PostProcess/Resources/flareMask.tga.meta b/Assets/Scripts/PostProcess/Resources/flareMask.tga.meta similarity index 100% rename from Assets/PostProcess/Resources/flareMask.tga.meta rename to Assets/Scripts/PostProcess/Resources/flareMask.tga.meta diff --git a/Assets/PostProcess/Resources/noise.tga b/Assets/Scripts/PostProcess/Resources/noise.tga similarity index 100% rename from Assets/PostProcess/Resources/noise.tga rename to Assets/Scripts/PostProcess/Resources/noise.tga diff --git a/Assets/PostProcess/Resources/noise.tga.meta b/Assets/Scripts/PostProcess/Resources/noise.tga.meta similarity index 100% rename from Assets/PostProcess/Resources/noise.tga.meta rename to Assets/Scripts/PostProcess/Resources/noise.tga.meta diff --git a/Assets/PostProcess/Resources/vignette.tga b/Assets/Scripts/PostProcess/Resources/vignette.tga similarity index 100% rename from Assets/PostProcess/Resources/vignette.tga rename to Assets/Scripts/PostProcess/Resources/vignette.tga diff --git a/Assets/PostProcess/Resources/vignette.tga.meta b/Assets/Scripts/PostProcess/Resources/vignette.tga.meta similarity index 100% rename from Assets/PostProcess/Resources/vignette.tga.meta rename to Assets/Scripts/PostProcess/Resources/vignette.tga.meta diff --git a/Assets/Scripts/PostProcess/StandardAssets.PostProcessing.asmdef b/Assets/Scripts/PostProcess/StandardAssets.PostProcessing.asmdef new file mode 100644 index 00000000..1869150e --- /dev/null +++ b/Assets/Scripts/PostProcess/StandardAssets.PostProcessing.asmdef @@ -0,0 +1,3 @@ +{ + "name": "StandardAssets.PostProcessing" +} diff --git a/Assets/Scripts/PostProcess/StandardAssets.PostProcessing.asmdef.meta b/Assets/Scripts/PostProcess/StandardAssets.PostProcessing.asmdef.meta new file mode 100644 index 00000000..bfc8ead2 --- /dev/null +++ b/Assets/Scripts/PostProcess/StandardAssets.PostProcessing.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0caaed79738d51e4d81fadb59d40c71d +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PropChannelMap.cs.meta b/Assets/Scripts/PropChannelMap.cs.meta deleted file mode 100644 index a7406307..00000000 --- a/Assets/Scripts/PropChannelMap.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 1a308fa666f8458cb6a15acd4a4ebd94 -timeCreated: 1549040698 \ No newline at end of file diff --git a/Assets/Scripts/Resources/GuiHelper.cs b/Assets/Scripts/Resources/GuiHelper.cs index a703841b..d1e291d6 100644 --- a/Assets/Scripts/Resources/GuiHelper.cs +++ b/Assets/Scripts/Resources/GuiHelper.cs @@ -19,6 +19,7 @@ private static string FloatToString(float num, int length) public static bool Slider(Rect rect, string title, float value, string textValue, out float outValue, out string outTextValue, float minValue, float maxValue) { + if (textValue == null) textValue = value.ToString(); var offsetX = (int) rect.x; @@ -55,6 +56,12 @@ public static bool Slider(Rect rect, string title, float value, string textValue if (Math.Abs(value - tempValue) > 0.0001f) isChanged = true; } + float floatValue = 0.0f; + float.TryParse(textValue, out floatValue); + if(floatValue != value) + { + value = floatValue; + } outValue = value; outTextValue = textValue; diff --git a/Assets/Scripts/SampleProbeTex.cs b/Assets/Scripts/SampleProbeTex.cs index 4d371e83..1b3f3e59 100644 --- a/Assets/Scripts/SampleProbeTex.cs +++ b/Assets/Scripts/SampleProbeTex.cs @@ -1,33 +1,62 @@ -#region +/*So this script is updating the texture of the sample probe and setting it as the texture for the "Tex" property of the skybox material and the "ProbeCubemap" property of the shader. + * This allows the skybox material to use the texture from the sample probe, which is a reflection probe in the scene that captures the environment's reflections and lighting, making the skybox appear more realistic. + * The script also makes sure that when the script is disabled, the "UseProbeTexture" property of the shader is set to 0, and the "_USE_BAKED_CUBEMAP_ON" keyword is enabled + * and "_USE_BAKED_CUBEMAP_OFF" is disabled, which likely controls whether or not to use the sample probe texture in the skybox material.*/ +/* TODO: One way to separate this script into single responsibility scripts would be to create two separate scripts: one for handling the reflection probe and one for handling the skybox material. + +The script for handling the reflection probe could have the following responsibilities: + +Updating the texture of the sample probe +Setting the texture as the "ProbeCubemap" property of the shader +Enabling and disabling the "UseProbeTexture" keyword in the shader +The script for handling the skybox material could have the following responsibilities: + +Setting the texture of the sample probe as the "Tex" property of the skybox material +Managing the skybox material's properties and settings +*/ + +#region using UnityEngine; #endregion - [ExecuteInEditMode] public class SampleProbeTex : MonoBehaviour { - private static readonly int UseProbeTexture = Shader.PropertyToID("_UseProbeTexture"); - private static readonly int Tex = Shader.PropertyToID("_Tex"); - private static readonly int ProbeCubemap = Shader.PropertyToID("_ProbeCubemap"); - public ReflectionProbe SampleProbe; - public Material SkyboxMaterial; - - private void Start() - { - SampleProbe.RenderProbe(); - } - - private void OnDisable() - { - Shader.SetGlobalFloat(UseProbeTexture, 0); - Shader.EnableKeyword("_USE_BAKED_CUBEMAP_ON"); - Shader.DisableKeyword("_USE_BAKED_CUBEMAP_OFF"); - } - - private void Update() - { - SkyboxMaterial.SetTexture(Tex, SampleProbe.texture); - Shader.SetGlobalTexture(ProbeCubemap, SampleProbe.texture); - } -} \ No newline at end of file + //A unique identifier for the "UseProbeTexture" property in the shader. + private static readonly int UseProbeTexture = Shader.PropertyToID("_UseProbeTexture"); + //A unique identifier for the "Tex" property in the shader. + private static readonly int Tex = Shader.PropertyToID("_Tex"); + //A unique identifier for the "ProbeCubemap" property in the shader. + private static readonly int ProbeCubemap = Shader.PropertyToID("_ProbeCubemap"); + //A reflection probe component that is used to sample the environment's lighting. + public ReflectionProbe SampleProbe; + //Skybox material that use to display the environment + public Material SkyboxMaterial; + + private void Start() + { + //Start the render of the reflection probe + SampleProbe.RenderProbe(); + } + + //This function is called when the script component is disabled. + private void OnDisable() + { + //set the global useProbeTexture value to 0 + Shader.SetGlobalFloat(UseProbeTexture, 0); + //enable the _USE_BAKED_CUBEMAP_ON keyword + Shader.EnableKeyword("_USE_BAKED_CUBEMAP_ON"); + //disable the _USE_BAKED_CUBEMAP_OFF keyword + Shader.DisableKeyword("_USE_BAKED_CUBEMAP_OFF"); + } + + private void Update() + { + // sets the texture of the "Tex" property of the skybox material to the texture of the sample probe + SkyboxMaterial.SetTexture(Tex, SampleProbe.texture); + + //set the "ProbeCubemap" property of the shader to the texture of the sample probe + Shader.SetGlobalTexture(ProbeCubemap, SampleProbe.texture); + } +} diff --git a/Assets/Scripts/SetPropertyMap.cs b/Assets/Scripts/SetPropertyMap.cs new file mode 100644 index 00000000..ddb0ac82 --- /dev/null +++ b/Assets/Scripts/SetPropertyMap.cs @@ -0,0 +1,75 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +/// +/// This script is responsible for setting the values for the different maps (Red, Blue, Green and Alpha) based on the selection of the user from the dropdown menus. +/// It also allows the user to set preset values for these maps by calling the SetPreset method +/// +public class SetPropertyMap : MonoBehaviour +{ + /// + /// The type of the map that is being set by the script + /// + public string DropDownType; + /// + /// Reference to the dropdown menu for the Red map + /// + public Dropdown RedMap; + /// + /// Reference to the dropdown menu for the Blue map + /// + public Dropdown BlueMap; + /// + /// Reference to the dropdown menu for the Green map + /// + public Dropdown GreenMap; + /// + /// Reference to the dropdown menu for the Alpha map + /// + public Dropdown AlphaMap; + + /// + /// Sets the selection of the given map type to the selection provided. + /// It calls the MapSelection method of the MainGui script + /// + public void SetPropertyMapSelection(int selection) + { + MainGui.Instance.MapSelection(selection, DropDownType); + } + + /// + /// Sets the preset values for the different maps based on the selection provided + /// + public void SetPreset(int selection) + { + switch (selection) + { + case 0: + break; + case 1: + setChannels(1, 0, 4, 2); + break; + case 2: + setChannels(2, 4, 1, 0); + break; + default: + break; + } + } + + /// + /// Helper method to set the values for the different maps + /// + private void setChannels(int red, int blue, int green, int alpha) + { + RedMap.value = red; + BlueMap.value = blue; + GreenMap.value = green; + AlphaMap.value = alpha; + //RedMap.SetPropertyMapSelection(red); + //BlueMap.SetPropertyMapSelection(blue); + //GreenMap.SetPropertyMapSelection(green); + //AlphaMap.SetPropertyMapSelection(alpha); + } +} \ No newline at end of file diff --git a/Assets/Scripts/SetPropertyMap.cs.meta b/Assets/Scripts/SetPropertyMap.cs.meta new file mode 100644 index 00000000..f8733441 --- /dev/null +++ b/Assets/Scripts/SetPropertyMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8747724993b9b3841a1bcc33853a384f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SettingsGui.cs b/Assets/Scripts/SettingsGui.cs index e73faec6..57d442f4 100644 --- a/Assets/Scripts/SettingsGui.cs +++ b/Assets/Scripts/SettingsGui.cs @@ -1,4 +1,54 @@ -#region +/*TODO: + separate this script into single responsibility scripts, you could consider breaking it down into the following parts: + +A settings manager script that handles loading, saving, and updating the settings. +A GUI script that handles displaying and updating the settings in the Unity editor. +A script that handles communication with other objects in the scene, such as the MainGui and OBJRotator objects. +Each of these scripts would have a specific responsibility and would be easier to maintain and understand. + +For the Settings Manager script, it could have methods like LoadSettings(), SaveSettings() and SetSettings(). +For the GUI script, it could have methods like DoMyWindow(), and it would be responsible for displaying the settings in the Unity editor and updating them. +For the communication script, it could have methods like SetNormalMode(), SetFormat() that would handle the communication between the SettingsGui and other objects. + +You could also consider refactoring other scripts that are dependent on the SettingsGui class to remove their dependency on it, so that they only need to know about the settings they require and not the whole SettingsGui class. +*/ + +/*Description: +Settings: A class that contains several fields such as FileFormat, NormalMapMaxStyle and NormalMapMayaStyle. + +SettingsGui: A MonoBehaviour that stores an instance of itself, Settings object, several GUI elements and some properties for the application. + +Start(): Loads the settings from PlayerPrefs when the script is started. + +LoadSettings(): Loads the settings from PlayerPrefs, if there are any. If not, it sets default values and saves it to PlayerPrefs. + +SaveSettings(): Serializes the current Settings object to a string and saves it to the PlayerPrefs. + +SetNormalMode(): Uses the NormalMapMayaStyle setting to set the global flip normal y variable in the shader. + +SetSettings(): Sets the settings to the elements in the application. + +DoMyWindow(int windowId): A callback function that creates a GUI window, it contains several toggles, labels and buttons to change the values of the settings. + +SetFrameRate(int FrameRate): This function sets the frame rate of the game to the value passed in as an argument. + +SetVsyncOn(): This function enables the vsync setting in the game. + +SaveDefaultFileFormat(): This function saves the default file format used to export textures. + +SaveAndClose(): This function saves the current settings and closes the settings menu. + +setDefaultPropertyMap(): This function sets the default property maps for the red, green, and blue channels. + +NormalMapMaxStyle(bool Bool): This function sets the normal map style to 'Max Style' if the passed in boolean is true, otherwise, it sets it to 'Maya Style'. + +NormalMapMayaStyle(bool Bool): This function sets the normal map style to 'Maya Style' if the passed in boolean is true, otherwise, it sets it to 'Max Style'. + +SetPostProcessing(bool Bool): This function enables or disables post processing effects in the game based on the passed in boolean. + +SetHideUI(bool Bool): This function allows or disallows hiding the UI when the object is rotated based on the passed in boolean. +*/ +#region using System.IO; using System.Xml.Serialization; @@ -12,7 +62,7 @@ public class Settings public bool NormalMapMaxStyle; public bool NormalMapMayaStyle; - public bool PostProcessEnabled; + //public bool PostProcessEnabled; public PropChannelMap PropBlue; public PropChannelMap PropGreen; @@ -25,12 +75,13 @@ public class SettingsGui : MonoBehaviour private const string SettingsKey = "Settings"; public static SettingsGui Instance; private static readonly int FlipNormalY = Shader.PropertyToID("_FlipNormalY"); - private bool _windowOpen; + //private bool _windowOpen; private Rect _windowRect = new Rect(Screen.width - 300, Screen.height - 320, 280, 600); - public PostProcessGui PostProcessGui; + //public PostProcessGui PostProcessGui; [HideInInspector] public Settings Settings = new Settings(); public ObjRotator OBJRotator; + public GameObject SettingsMenu; private void Start() { @@ -54,7 +105,7 @@ public void LoadSettings() { Settings.NormalMapMaxStyle = true; Settings.NormalMapMayaStyle = false; - Settings.PostProcessEnabled = true; + //Settings.PostProcessEnabled = true; Settings.PropRed = PropChannelMap.None; Settings.PropGreen = PropChannelMap.None; Settings.PropBlue = PropChannelMap.None; @@ -65,7 +116,7 @@ public void LoadSettings() SetSettings(); } - private void SaveSettings() + public void SaveSettings() { var serializer = new XmlSerializer(typeof(Settings)); using (TextWriter sw = new StringWriter()) @@ -75,7 +126,7 @@ private void SaveSettings() } } - private void SetNormalMode() + public void SetNormalMode() { var flipNormalY = 0; if (Settings.NormalMapMayaStyle) flipNormalY = 1; @@ -87,10 +138,10 @@ public void SetSettings() { SetNormalMode(); - if (Settings.PostProcessEnabled) - PostProcessGui.PostProcessOn(); - else - PostProcessGui.PostProcessOff(); + //if (Settings.PostProcessEnabled) + //PostProcessGui.PostProcessOn(); + //else + //PostProcessGui.PostProcessOff(); var mainGui = MainGui.Instance; mainGui.PropRed = Settings.PropRed; @@ -125,8 +176,8 @@ private void DoMyWindow(int windowId) offsetY += 30; - Settings.PostProcessEnabled = GUI.Toggle(new Rect(offsetX, offsetY, 280, 30), Settings.PostProcessEnabled, - " Enable Post Process By Default"); + //Settings.PostProcessEnabled = GUI.Toggle(new Rect(offsetX, offsetY, 280, 30), Settings.PostProcessEnabled, + //" Enable Post Process By Default"); offsetY += 20; GUI.Label(new Rect(offsetX, offsetY, 250, 30), "Limit Frame Rate"); @@ -184,12 +235,64 @@ private void DoMyWindow(int windowId) { SaveSettings(); SetNormalMode(); - _windowOpen = false; + //_windowOpen = false; } GUI.DragWindow(); } + public void SetFrameRate(int FrameRate) + { + Application.targetFrameRate = FrameRate; + QualitySettings.vSyncCount = 0; + PlayerPrefs.SetInt("targetFrameRate", FrameRate); + PlayerPrefs.SetInt("Vsync", 0); + } + public void SetVsyncOn() + { + //Application.targetFrameRate = 120; + QualitySettings.vSyncCount = 1; + // PlayerPrefs.SetInt("targetFrameRate", 30); + PlayerPrefs.SetInt("Vsync", 1); + } + public void SaveDefaultFileFormat() + { + Settings.FileFormat = FileFormat.Png; + } + + public void SaveAndClose() + { + SaveSettings(); + SetNormalMode(); + } + + public void setDefaultPropertyMap() + { + Settings.PropRed = MainGui.Instance.PropRed; + Settings.PropGreen = MainGui.Instance.PropGreen; + Settings.PropBlue = MainGui.Instance.PropBlue; + + } + + public void NormalMapMaxStyle(bool Bool) + { + Settings.NormalMapMaxStyle = Bool; + Settings.NormalMapMayaStyle = !Bool; + } + public void NormalMapMayaStyle(bool Bool) + { + Settings.NormalMapMayaStyle = Bool; + Settings.NormalMapMaxStyle = !Bool; + } + + public void SetPostProcessing(bool Bool) + { + //Settings.PostProcessEnabled = Bool; + } + public void SetHideUI(bool Bool) { + OBJRotator.AllowHideUI = Bool; + } + /* private void OnGUI() { _windowRect = new Rect(Screen.width - 300, Screen.height - 360, 280, 300); @@ -200,11 +303,11 @@ private void OnGUI() if (_windowOpen) { SaveSettings(); - _windowOpen = false; + SettingsMenu.SetActive(false); } else { - _windowOpen = true; + SettingsMenu.SetActive(true); } - } + }*/ } \ No newline at end of file diff --git a/Assets/Scripts/SmoothnessSettings.cs.meta b/Assets/Scripts/SmoothnessSettings.cs.meta deleted file mode 100644 index 8a87de46..00000000 --- a/Assets/Scripts/SmoothnessSettings.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 3ba8d34d0d66490aa1b76236ad229ec2 -timeCreated: 1549049713 \ No newline at end of file diff --git a/Assets/Scripts/SuggestionGui.cs b/Assets/Scripts/SuggestionGui.cs index 59e78c9c..82773d17 100644 --- a/Assets/Scripts/SuggestionGui.cs +++ b/Assets/Scripts/SuggestionGui.cs @@ -5,7 +5,7 @@ using UnityEngine; #endregion - +// TODO: Scrap this and make it open a PR in Github public class SuggestionGui : MonoBehaviour { private const string StringEmail = ""; diff --git a/Assets/Scripts/TextureScale.cs b/Assets/Scripts/TextureScale.cs index 71ef9d88..fb1cb36f 100644 --- a/Assets/Scripts/TextureScale.cs +++ b/Assets/Scripts/TextureScale.cs @@ -1,5 +1,28 @@ // Only works on ARGB32, RGB24 and Alpha8 textures that are marked readable +/*Description: The TextureScale script is a class that provides methods for scaling a texture using either point sampling or bilinear interpolation. + +The main two methods that the user can interact with are the "Point" and "Bilinear" methods, which take a Texture2D, width and height as arguments, and returns a scaled Texture2D. + +The Point method uses point sampling to scale the texture, this means it takes the color of the closest pixel to the corresponding point in the new image. This method is fast but can result in a noticeable loss of quality. + +The Bilinear method uses bilinear interpolation to scale the texture. This method takes the color values of the four closest pixels to a point in the new image and interpolates them to get the final color value. This method is slower than point sampling but generally results in a higher-quality image. + +The ThreadData class is used to store information about the start and end positions of a thread, it is used to divide the task of scaling the texture across multiple threads. + +The PointScale and BilinearScale methods are both used to perform the scaling operation. The PointScale method uses point sampling while the BilinearScale method uses bilinear interpolation. + +The ColorLerpUnclamped method is used to interpolate between two colors. It takes two color values and a float value between 0 and 1 as arguments, and returns a color that is interpolated between the two input colors based on the float value. + +The script makes use of threading to perform the scaling operation in parallel across multiple threads, this can greatly improve performance for large texture. */ + +/* TODO: Mayba* +One way to separate the script into single responsibility scripts is to create separate classes for each distinct functionality. +For example, you could create a class called "TextureScaler" that contains the Point and Bilinear methods, and the ThreadData, texColors, newColors, w, ratioX, ratioY, w2, finishCount and mutex fields. +Then, you could create another class called "ThreadHelper" that contains the PointScale and BilinearScale methods, and the ThreadedScale method could be refactored to utilize this new class. +Additionally, you could extract the logic for setting the properties of the texture object into its own class. +*/ + using System.Threading; using UnityEngine; diff --git a/Assets/Scripts/TextureScale.cs.meta b/Assets/Scripts/TextureScale.cs.meta index e7939bc1..51ee2afb 100644 --- a/Assets/Scripts/TextureScale.cs.meta +++ b/Assets/Scripts/TextureScale.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 352c93c5e55830464bd22e5bde88609d +guid: 78f595cdd7ecd344b9df7022e4ba662f MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/Editor.meta b/Assets/Scripts/Undocumented.meta similarity index 100% rename from Assets/Scripts/Editor.meta rename to Assets/Scripts/Undocumented.meta diff --git a/Assets/Scripts/CommandListExecutor.cs b/Assets/Scripts/Undocumented/CommandListExecutor.cs similarity index 92% rename from Assets/Scripts/CommandListExecutor.cs rename to Assets/Scripts/Undocumented/CommandListExecutor.cs index 8eba45e7..8c805f74 100644 --- a/Assets/Scripts/CommandListExecutor.cs +++ b/Assets/Scripts/Undocumented/CommandListExecutor.cs @@ -170,33 +170,32 @@ private IEnumerator ProcessCommandsCoroutine(string commandString) switch (thisCommand.MapType) { case MapType.Height: - StartCoroutine(_saveLoad.SaveTexture(thisCommand.Extension, _mainGui.HeightMap, - thisCommand.FilePath)); + _saveLoad.SaveTexture(thisCommand.Extension, _mainGui.HeightMap, + thisCommand.FilePath); break; case MapType.Diffuse: - StartCoroutine(_saveLoad.SaveTexture(thisCommand.Extension, _mainGui.DiffuseMapOriginal, - thisCommand.FilePath)); + _saveLoad.SaveTexture(thisCommand.Extension, _mainGui.DiffuseMapOriginal, + thisCommand.FilePath); break; case MapType.Metallic: - StartCoroutine(_saveLoad.SaveTexture(thisCommand.Extension, _mainGui.MetallicMap, - thisCommand.FilePath)); + _saveLoad.SaveTexture(thisCommand.Extension, _mainGui.MetallicMap, + thisCommand.FilePath); break; case MapType.Smoothness: - StartCoroutine(_saveLoad.SaveTexture(thisCommand.Extension, _mainGui.SmoothnessMap, - thisCommand.FilePath)); + _saveLoad.SaveTexture(thisCommand.Extension, _mainGui.SmoothnessMap, + thisCommand.FilePath); break; case MapType.Edge: - StartCoroutine(_saveLoad.SaveTexture(thisCommand.Extension, _mainGui.EdgeMap, - thisCommand.FilePath)); + _saveLoad.SaveTexture(thisCommand.Extension, _mainGui.EdgeMap, + thisCommand.FilePath); break; case MapType.Ao: - StartCoroutine( - _saveLoad.SaveTexture(thisCommand.Extension, _mainGui.AoMap, thisCommand.FilePath)); + _saveLoad.SaveTexture(thisCommand.Extension, _mainGui.AoMap, thisCommand.FilePath); break; case MapType.Property: _mainGui.ProcessPropertyMap(); - StartCoroutine(_saveLoad.SaveTexture(thisCommand.Extension, _mainGui.PropertyMap, - thisCommand.FilePath)); + _saveLoad.SaveTexture(thisCommand.Extension, _mainGui.PropertyMap, + thisCommand.FilePath); break; case MapType.DiffuseOriginal: break; diff --git a/Assets/Scripts/CommandListExecutor.cs.meta b/Assets/Scripts/Undocumented/CommandListExecutor.cs.meta similarity index 100% rename from Assets/Scripts/CommandListExecutor.cs.meta rename to Assets/Scripts/Undocumented/CommandListExecutor.cs.meta diff --git a/Assets/Scripts/HeightFromDiffuseGui.cs b/Assets/Scripts/Undocumented/HeightFromDiffuseGui.cs similarity index 100% rename from Assets/Scripts/HeightFromDiffuseGui.cs rename to Assets/Scripts/Undocumented/HeightFromDiffuseGui.cs diff --git a/Assets/Scripts/HeightFromDiffuseGui.cs.meta b/Assets/Scripts/Undocumented/HeightFromDiffuseGui.cs.meta similarity index 73% rename from Assets/Scripts/HeightFromDiffuseGui.cs.meta rename to Assets/Scripts/Undocumented/HeightFromDiffuseGui.cs.meta index a0a7a004..a367a7b5 100644 --- a/Assets/Scripts/HeightFromDiffuseGui.cs.meta +++ b/Assets/Scripts/Undocumented/HeightFromDiffuseGui.cs.meta @@ -1,8 +1,11 @@ fileFormatVersion: 2 guid: 42bfcfcf9f072604a93d2b19d0d9fb46 MonoImporter: + externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/HeightFromDiffuseSettings.cs b/Assets/Scripts/Undocumented/HeightFromDiffuseSettings.cs similarity index 100% rename from Assets/Scripts/HeightFromDiffuseSettings.cs rename to Assets/Scripts/Undocumented/HeightFromDiffuseSettings.cs diff --git a/Assets/Scripts/Undocumented/HeightFromDiffuseSettings.cs.meta b/Assets/Scripts/Undocumented/HeightFromDiffuseSettings.cs.meta new file mode 100644 index 00000000..5d8c0791 --- /dev/null +++ b/Assets/Scripts/Undocumented/HeightFromDiffuseSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5597a94af0aa46e0b8a9e60ae791318f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Undocumented/MainGui.cs b/Assets/Scripts/Undocumented/MainGui.cs new file mode 100644 index 00000000..bbb49982 --- /dev/null +++ b/Assets/Scripts/Undocumented/MainGui.cs @@ -0,0 +1,1345 @@ +#region + +using System; +using System.Collections.Generic; +using System.Linq; +using SFB; +using UnityEngine; +using UnityEngine.UI; + + +#endregion + +public class MainGui : MonoBehaviour +{ + #region "Vars" + private const float GamaCorrection = 2.2f; + + public RawImage DiffuseTexture; + public RawImage HeightTexture; + public RawImage SmoothnessTexture; + public RawImage NormalTexture; + public RawImage MetallicTexture; + public RawImage EdgeTexture; + public RawImage AOTexture; + + public static MainGui Instance; + public GameObject Modle; + public static readonly string[] LoadFormats = + { + "png", "jpg", "jpeg", "tga", "bmp", "exr" + }; + private bool _doOnce; + private static readonly int CorrectionId = Shader.PropertyToID("_GamaCorrection"); + private static readonly int MainTexId = Shader.PropertyToID("_MainTex"); + private static readonly int GlobalCubemapId = Shader.PropertyToID("_GlobalCubemap"); + private static readonly int DisplacementMapId = Shader.PropertyToID("_DisplacementMap"); + private static readonly int DiffuseMapId = Shader.PropertyToID("_DiffuseMap"); + private static readonly int NormalMapId = Shader.PropertyToID("_NormalMap"); + private static readonly int MetallicMapId = Shader.PropertyToID("_MetallicMap"); + private static readonly int SmoothnessMapId = Shader.PropertyToID("_SmoothnessMap"); + private static readonly int AoMapId = Shader.PropertyToID("_AOMap"); + private static readonly int EdgeMapId = Shader.PropertyToID("_EdgeMap"); + private static readonly int TilingId = Shader.PropertyToID("_Tiling"); + + private readonly ExtensionFilter[] _imageLoadFilter = + { + new ExtensionFilter("Image Files", LoadFormats) + }; + + private readonly ExtensionFilter[] _imageSaveFilter = + { + new ExtensionFilter("Image Files", "png", "jpg", "jpeg", "tga", "exr") + }; + + private MapType _activeMapType; + + private bool _busySaving; + + private bool _clearTextures; + public bool _exrSelected { get; set; } + public bool _pngSelected { get; set; } + public bool _tgaSelected { get; set; } + public bool _jpgSelected { get; set; } + + + public string _lastDirectory = ""; + + private List _objectsToUnhide; + public char _pathChar = '/'; + + private bool _propBlueChoose; + private Material _propertyCompMaterial; + + private Shader _propertyCompShader; + private bool _propGreenChoose; + private bool _propRedChoose; + private bool _propAlphaChoose; + public SaveLoadProject _saveLoadProjectScript; + private int _selectedCubemap; + private SettingsGui _settingsGuiScript; + + private Texture2D _textureToLoad; + private Texture2D _textureToSave; + + + private Material _thisMaterial; + private TilingTextureMakerGui _tilingTextureMakerGuiScript; + + public AlignmentGui AlignmentGuiScript; + + public GameObject AoFromNormalGuiObject; + public AoFromNormalGui AoFromNormalGuiScript; + public Texture2D AoMap; + + public Cubemap[] CubeMaps; + public Texture2D DiffuseMap; + public Texture2D DiffuseMapOriginal; + + public GameObject EdgeFromNormalGuiObject; + public EdgeFromNormalGui EdgeFromNormalGuiScript; + public Texture2D EdgeMap; + + public GameObject EditDiffuseGuiObject; + public EditDiffuseGui EditDiffuseGuiScript; + public Material FullMaterial; + + public Material FullMaterialRef; + + public RenderTexture HdHeightMap; + + public GameObject HeightFromDiffuseGuiObject; + public HeightFromDiffuseGui HeightFromDiffuseGuiScript; + public Texture2D HeightMap; + + public GameObject MaterialGuiObject; + public MaterialGui MaterialGuiScript; + + public GameObject MetallicGuiObject; + public MetallicGui MetallicGuiScript; + public Texture2D MetallicMap; + + public GameObject NormalFromHeightGuiObject; + public NormalFromHeightGui NormalFromHeightGuiScript; + public Texture2D NormalMap; + + public GameObject PostProcessGuiObject; + public PropChannelMap PropBlue = PropChannelMap.None; + public Texture2D TextureBlue = null; + public Texture2D PropertyMap; + public PropChannelMap PropGreen = PropChannelMap.None; + public Texture2D TextureGreen = null; + public PropChannelMap PropRed = PropChannelMap.None; + public Texture2D TextureRed = null; + public PropChannelMap PropAlpha = PropChannelMap.None; + public Texture2D TextureAlpha = null; + + public string QuicksavePathAo = ""; + public string QuicksavePathDiffuse = ""; + public string QuicksavePathEdge = ""; + public string QuicksavePathHeight = ""; + public string QuicksavePathMetallic = ""; + public string QuicksavePathNormal = ""; + public string QuicksavePathProperty = ""; + public string QuicksavePathSmoothness = ""; + + //public Material skyboxMaterial; + public ReflectionProbe ReflectionProbe; + [HideInInspector] public Material SampleMaterial; + public Material SampleMaterialRef; + public Material SkyboxMaterial; + + public GameObject SaveLoadProjectObject; + public FileFormat SelectedFormat; + + public GameObject SettingsGuiObject; + + public GameObject SmoothnessGuiObject; + public SmoothnessGui SmoothnessGuiScript; + public Texture2D SmoothnessMap; + public GameObject TestObject; + + public Texture2D TextureBlack; + public Texture2D TextureGrey; + public Texture2D TextureNormal; + public Texture2D TextureWhite; + + public GameObject TilingTextureMakerGuiObject; + public BatchUI Batchui; + + //public string XSize = "1024"; + public string XSize { get; set; } + public string YSize { get; set; } + public bool ScaleTexture; + private bool ScaleTextureLocked; + public Toggle[] FileFormatToggles; + + #endregion + + private void Awake() + { + Instance = this; + } + + private void Start() + { + Windowed(); + Batchui = gameObject.AddComponent(); + _lastDirectory = Application.dataPath; + + HeightMap = null; + HdHeightMap = null; + DiffuseMap = null; + DiffuseMapOriginal = null; + NormalMap = null; + MetallicMap = null; + SmoothnessMap = null; + EdgeMap = null; + AoMap = null; + + _propertyCompShader = Shader.Find("Hidden/Blit_Property_Comp"); + _propertyCompMaterial = new Material(_propertyCompShader); + + Shader.SetGlobalFloat(CorrectionId, GamaCorrection); + + FullMaterial = new Material(FullMaterialRef.shader); + FullMaterial.CopyPropertiesFromMaterial(FullMaterialRef); + + SampleMaterial = new Material(SampleMaterialRef.shader); + SampleMaterial.CopyPropertiesFromMaterial(SampleMaterialRef); + + HeightFromDiffuseGuiScript = HeightFromDiffuseGuiObject.GetComponent(); + NormalFromHeightGuiScript = NormalFromHeightGuiObject.GetComponent(); + EdgeFromNormalGuiScript = EdgeFromNormalGuiObject.GetComponent(); + AoFromNormalGuiScript = AoFromNormalGuiObject.GetComponent(); + EditDiffuseGuiScript = EditDiffuseGuiObject.GetComponent(); + MetallicGuiScript = MetallicGuiObject.GetComponent(); + SmoothnessGuiScript = SmoothnessGuiObject.GetComponent(); + MaterialGuiScript = MaterialGuiObject.GetComponent(); + _tilingTextureMakerGuiScript = TilingTextureMakerGuiObject.GetComponent(); + _saveLoadProjectScript = SaveLoadProjectObject.GetComponent(); + _settingsGuiScript = SettingsGuiObject.GetComponent(); + + _settingsGuiScript.LoadSettings(); + + if (Application.platform == RuntimePlatform.WindowsEditor || + Application.platform == RuntimePlatform.WindowsPlayer) + _pathChar = '\\'; + + TestObject.GetComponent().material = FullMaterial; + SetMaterialValues(); + + ReflectionProbe.RenderProbe(); + + HideGuiLocker.LockEmpty += LoadHideState; + } + + private void LateUpdate() + { + if (DiffuseMap != null) + { + DiffuseTexture.texture = DiffuseMap; + DiffuseTexture.color = new Color(1, 1, 1, 1); + } + if (HeightMap != null) + { + HeightTexture.texture = HeightMap; + HeightTexture.color = new Color(1, 1, 1, 1); + } + if (SmoothnessMap != null) + { + SmoothnessTexture.texture = SmoothnessMap; + SmoothnessTexture.color = new Color(1, 1, 1, 1); + } + if (NormalMap != null) + { + NormalTexture.texture = NormalMap; + NormalTexture.color = new Color(1, 1, 1, 1); + } + if (MetallicMap != null) + { + MetallicTexture.texture = MetallicMap; + MetallicTexture.color = new Color(1, 1, 1, 1); + } + if (EdgeMap != null) + { + EdgeTexture.texture = EdgeMap; + EdgeTexture.color = new Color(1, 1, 1, 1); + } + if (AoMap != null) + { + AOTexture.texture = AoMap; + AOTexture.color = new Color(1, 1, 1, 1); + } + } + + public void SaveHideState() + { + if (HideGuiLocker.IsLocked) return; + _lastGuiIsHiddenState = IsGuiHidden; + } + + public void SaveHideStateAndHideAndLock(object sender) + { + SaveHideState(); + IsGuiHidden = true; + HideGuiLocker.Lock(sender); + } + + private void LoadHideState(object sender, EventArgs eventArgs) + { + IsGuiHidden = _lastGuiIsHiddenState; + } + + public void SetPreviewMaterial(Texture2D textureToPreview) + { + CloseWindows(); + if (textureToPreview == null) return; + FixSizeMap(textureToPreview); + SampleMaterial.SetTexture(MainTexId, textureToPreview); + TestObject.GetComponent().material = SampleMaterial; + } + + public void SetPreviewMaterial(RenderTexture textureToPreview) + { + CloseWindows(); + if (textureToPreview == null) return; + FixSizeMap(textureToPreview); + SampleMaterial.SetTexture(MainTexId, textureToPreview); + TestObject.GetComponent().material = SampleMaterial; + } + + public void SetMaterialValues() + { + Shader.SetGlobalTexture(GlobalCubemapId, CubeMaps[_selectedCubemap]); + + FullMaterial.SetTexture(DisplacementMapId, HeightMap != null ? HeightMap : TextureGrey); + + if (DiffuseMap != null) + FullMaterial.SetTexture(DiffuseMapId, DiffuseMap); + else if (DiffuseMapOriginal != null) + FullMaterial.SetTexture(DiffuseMapId, DiffuseMapOriginal); + else + FullMaterial.SetTexture(DiffuseMapId, TextureGrey); + + FullMaterial.SetTexture(NormalMapId, NormalMap != null ? NormalMap : TextureNormal); + + FullMaterial.SetTexture(MetallicMapId, MetallicMap != null ? MetallicMap : TextureBlack); + + FullMaterial.SetTexture(SmoothnessMapId, SmoothnessMap != null ? SmoothnessMap : TextureBlack); + + FullMaterial.SetTexture(AoMapId, AoMap != null ? AoMap : TextureWhite); + + FullMaterial.SetTexture(EdgeMapId, EdgeMap != null ? EdgeMap : TextureGrey); + + TestObject.GetComponent().material = FullMaterial; + + FullMaterial.SetVector(TilingId, new Vector4(1, 1, 0, 0)); + } + + public void SetFileFormat(int selection) + { + switch (selection) + { + + case 0: + SelectedFormat = FileFormat.Png; + break; + case 1: + SelectedFormat = FileFormat.Jpg; + break; + case 2: + SelectedFormat = FileFormat.Exr; + break; + case 3: + SelectedFormat = FileFormat.Tga; + break; + default: + break; + } + } + + public void CloseWindows() + { + HeightFromDiffuseGuiScript.Close(); + NormalFromHeightGuiScript.Close(); + EdgeFromNormalGuiScript.Close(); + AoFromNormalGuiScript.Close(); + EditDiffuseGuiScript.Close(); + MetallicGuiScript.Close(); + SmoothnessGuiScript.Close(); + _tilingTextureMakerGuiScript.Close(); + AlignmentGuiScript.Close(); + MaterialGuiObject.SetActive(false); + PostProcessGuiObject.SetActive(false); + } + + private void HideWindows() + { + _objectsToUnhide = new List(); + + if (HeightFromDiffuseGuiObject.activeSelf) _objectsToUnhide.Add(HeightFromDiffuseGuiObject); + + if (NormalFromHeightGuiObject.activeSelf) _objectsToUnhide.Add(NormalFromHeightGuiObject); + + if (EdgeFromNormalGuiObject.activeSelf) _objectsToUnhide.Add(EdgeFromNormalGuiObject); + + if (AoFromNormalGuiObject.activeSelf) _objectsToUnhide.Add(AoFromNormalGuiObject); + + if (EditDiffuseGuiObject.activeSelf) _objectsToUnhide.Add(EditDiffuseGuiObject); + + if (MetallicGuiObject.activeSelf) _objectsToUnhide.Add(MetallicGuiObject); + + if (SmoothnessGuiObject.activeSelf) _objectsToUnhide.Add(SmoothnessGuiObject); + + if (MaterialGuiObject.activeSelf) _objectsToUnhide.Add(MaterialGuiObject); + + if (PostProcessGuiObject.activeSelf) _objectsToUnhide.Add(PostProcessGuiObject); + + if (TilingTextureMakerGuiObject.activeSelf) _objectsToUnhide.Add(TilingTextureMakerGuiObject); + + HeightFromDiffuseGuiObject.SetActive(false); + NormalFromHeightGuiObject.SetActive(false); + EdgeFromNormalGuiObject.SetActive(false); + AoFromNormalGuiObject.SetActive(false); + EditDiffuseGuiObject.SetActive(false); + MetallicGuiObject.SetActive(false); + SmoothnessGuiObject.SetActive(false); + MaterialGuiObject.SetActive(false); + PostProcessGuiObject.SetActive(false); + TilingTextureMakerGuiObject.SetActive(false); + } + + private static void Fullscreen() + { + Screen.fullScreen = false; + } + + public void Quit() + { + Application.Quit(); + } + public void BatchLoadTextures() + { + Batchui.BatchLoadTextures(); + } + public void Windowed() + { + Fullscreen(); + } + public void UseInitalLocation(bool Bool) + { + Batchui.UseInitalLocation = Bool; + } + public void ProcessPropertyMap(bool Bool) + { + Batchui.ProcessPropertyMap = Bool; + } + + public void ShowPostWindow() + { + PostProcessGuiObject.SetActive(!PostProcessGuiObject.activeSelf); + } + public void TileTextures() + { + CloseWindows(); + FixSize(); + TilingTextureMakerGuiObject.SetActive(true); + _tilingTextureMakerGuiScript.Initialize(); + } + public void NextCubemap() + { + _selectedCubemap += 1; + if (_selectedCubemap >= CubeMaps.Length) _selectedCubemap = 0; + + SkyboxMaterial.SetTexture("_Tex", CubeMaps[_selectedCubemap]); + Shader.SetGlobalTexture(GlobalCubemapId, CubeMaps[_selectedCubemap]); + ReflectionProbe.RenderProbe(); + } + public void AdjustAlignment() + { + CloseWindows(); + FixSize(); + AlignmentGuiScript.Initialize(); + } + public void ClearAllTexturesGUI() + { + _clearTextures = false; + ClearAllTextures(); + CloseWindows(); + SetMaterialValues(); + FixSizeSize(1024.0f, 1024.0f); + } + public void ShowFullMat() + { + CloseWindows(); + FixSize(); + MaterialGuiObject.SetActive(true); + MaterialGuiScript.Initialize(); + } + private void ShowGui() + { + foreach (var objToHide in _objectsToUnhide) + objToHide.SetActive(true); + } + + private void HideGui() + { + HideWindows(); + } + + public void SaveTextureFile(MapType mapType) + { + _textureToSave = HeightMap; + var defaultName = "_" + mapType + ".png"; + var path = StandaloneFileBrowser.SaveFilePanel("Save Height Map", _lastDirectory, defaultName, + _imageSaveFilter); + if (path.IsNullOrEmpty()) return; + + _textureToSave = GetTextureToSave(mapType); + + var lastBar = path.LastIndexOf(_pathChar); + _lastDirectory = path.Substring(0, lastBar + 1); + SaveFile(path); + } + + public void SaveTextureFile(MapType mapType, string path, string name) + { + _textureToSave = HeightMap; + var defaultName = name + "_" + mapType + ".png"; + // var path = StandaloneFileBrowser.SaveFilePanel("Save Height Map", _lastDirectory, defaultName, + // _imageSaveFilter); + List PathSplit = path.Split(new string[] { "/", "\\" }, StringSplitOptions.None).ToList(); + //PathSplit[PathSplit.Length - 1] + PathSplit.RemoveAt(PathSplit.Count - 1); + //Debug.Log(PathSplit); + path = string.Join("/", PathSplit.ToArray()); + path = path + "/" + defaultName; + if (path.IsNullOrEmpty()) return; + + _textureToSave = GetTextureToSave(mapType); + var lastBar = path.LastIndexOf(_pathChar); + _lastDirectory = path.Substring(0, lastBar + 1); + Debug.Log(path); + SaveFile(path); + } + private Texture2D GetTextureToSave(MapType mapType) + { + switch (mapType) + { + case MapType.Height: + return HeightMap; + case MapType.Diffuse: + return DiffuseMap != null ? DiffuseMap : DiffuseMapOriginal; + case MapType.DiffuseOriginal: + return DiffuseMapOriginal; + case MapType.Metallic: + return MetallicMap; + case MapType.Smoothness: + return SmoothnessMap; + case MapType.Normal: + return NormalMap; + case MapType.Edge: + return EdgeMap; + case MapType.Ao: + return AoMap; + case MapType.Property: + return PropertyMap; + default: + throw new ArgumentOutOfRangeException(nameof(mapType), mapType, null); + } + } + + private void OpenTextureFile(MapType mapType) + { + _activeMapType = mapType; + var title = "Open " + mapType + " Map"; + var path = StandaloneFileBrowser.OpenFilePanel(title, _lastDirectory, _imageLoadFilter, false); + if (path[0].IsNullOrEmpty()) return; + var lastBar = path[0].LastIndexOf(_pathChar); + _lastDirectory = path[0].Substring(0, lastBar + 1); + OpenFile(path[0]); + } + + // ReSharper disable once InconsistentNaming + private static string PCM2String(PropChannelMap pcm, string defaultName) + { + var returnString = defaultName; + + switch (pcm) + { + case PropChannelMap.Height: + returnString = "Height"; + break; + case PropChannelMap.Metallic: + returnString = "Metallic"; + break; + case PropChannelMap.Smoothness: + returnString = "Smoothness"; + break; + case PropChannelMap.Edge: + returnString = "Edge"; + break; + case PropChannelMap.Ao: + returnString = "Ambient Occ"; + break; + case PropChannelMap.AoEdge: + returnString = "AO + Edge"; + break; + case PropChannelMap.None: + break; + default: + throw new ArgumentOutOfRangeException(nameof(pcm), pcm, null); + } + + return returnString; + } + + public void FlipNormalMapY() + { + if (NormalMap == null) return; + for (var i = 0; i < NormalMap.width; i++) + for (var j = 0; j < NormalMap.height; j++) + { + var pixelColor = NormalMap.GetPixel(i, j); + pixelColor.g = 1.0f - pixelColor.g; + NormalMap.SetPixel(i, j, pixelColor); + } + + NormalMap.Apply(); + } + + private void ClearTexture(MapType mapType) + { + switch (mapType) + { + case MapType.Height: + if (HeightMap) + { + Destroy(HeightMap); + HeightMap = null; + } + + if (HdHeightMap) + { + Destroy(HdHeightMap); + HdHeightMap = null; + } + + break; + case MapType.Diffuse: + if (DiffuseMap) + { + Destroy(DiffuseMap); + DiffuseMap = null; + } + + if (DiffuseMapOriginal) + { + Destroy(DiffuseMapOriginal); + DiffuseMapOriginal = null; + } + + break; + case MapType.Normal: + if (NormalMap) + { + Destroy(NormalMap); + NormalMap = null; + } + + break; + case MapType.Metallic: + if (MetallicMap) + { + Destroy(MetallicMap); + MetallicMap = null; + } + + break; + case MapType.Smoothness: + if (SmoothnessMap) + { + Destroy(SmoothnessMap); + SmoothnessMap = null; + } + + break; + case MapType.Edge: + if (EdgeMap) + { + Destroy(EdgeMap); + EdgeMap = null; + } + + break; + case MapType.Ao: + if (AoMap) + { + Destroy(AoMap); + AoMap = null; + } + + break; + case MapType.DiffuseOriginal: + if (DiffuseMapOriginal) + { + Destroy(DiffuseMapOriginal); + DiffuseMapOriginal = null; + } + + break; + case MapType.Property: + break; + default: + throw new ArgumentOutOfRangeException(nameof(mapType), mapType, null); + } + + Resources.UnloadUnusedAssets(); + } + + public void ClearAllTextures() + { + ClearTexture(MapType.Height); + ClearTexture(MapType.Diffuse); + ClearTexture(MapType.Normal); + ClearTexture(MapType.Metallic); + ClearTexture(MapType.Smoothness); + ClearTexture(MapType.Edge); + ClearTexture(MapType.Ao); + } + + public void SaveProject() + { + const string defaultName = "baseName.mtz"; + var path = StandaloneFileBrowser.SaveFilePanel("Save Project", _lastDirectory, defaultName, "mtz"); + if (path.IsNullOrEmpty()) return; + + var lastBar = path.LastIndexOf(_pathChar); + _lastDirectory = path.Substring(0, lastBar + 1); + + _saveLoadProjectScript.SaveProject(path); + } + + public void LoadProject() + { + var path = StandaloneFileBrowser.OpenFilePanel("Load Project", _lastDirectory, "mtz", false); + if (path[0].IsNullOrEmpty()) return; + + var lastBar = path[0].LastIndexOf(_pathChar); + _lastDirectory = path[0].Substring(0, lastBar + 1); + + _saveLoadProjectScript.LoadProject(path[0]); + } + + public void SetFormat(FileFormat newFormat) + { + _jpgSelected = false; + _pngSelected = false; + _tgaSelected = false; + _exrSelected = false; + + switch (newFormat) + { + case FileFormat.Jpg: + _jpgSelected = true; + break; + case FileFormat.Png: + _pngSelected = true; + break; + case FileFormat.Tga: + _tgaSelected = true; + break; + case FileFormat.Exr: + _exrSelected = true; + break; + default: + throw new ArgumentOutOfRangeException(nameof(newFormat), newFormat, null); + } + + SelectedFormat = newFormat; + } + + public void SetFormat(string newFormat) + { + _jpgSelected = false; + _pngSelected = false; + _tgaSelected = false; + _exrSelected = false; + + switch (newFormat) + { + case "jpg": + _jpgSelected = true; + SelectedFormat = FileFormat.Jpg; + break; + case "png": + _pngSelected = true; + SelectedFormat = FileFormat.Png; + break; + case "tga": + _tgaSelected = true; + SelectedFormat = FileFormat.Tga; + break; + case "exr": + _exrSelected = true; + SelectedFormat = FileFormat.Exr; + break; + default: + throw new ArgumentOutOfRangeException(nameof(newFormat), newFormat, null); + } + } + + public void SetLoadedTexture(MapType loadedTexture) + { + switch (loadedTexture) + { + case MapType.Height: + SetPreviewMaterial(HeightMap); + break; + case MapType.Diffuse: + SetPreviewMaterial(DiffuseMap); + break; + case MapType.DiffuseOriginal: + SetPreviewMaterial(DiffuseMapOriginal); + break; + case MapType.Normal: + SetPreviewMaterial(NormalMap); + break; + case MapType.Metallic: + SetPreviewMaterial(MetallicMap); + break; + case MapType.Smoothness: + SetPreviewMaterial(SmoothnessMap); + break; + case MapType.Edge: + SetPreviewMaterial(EdgeMap); + break; + case MapType.Ao: + SetPreviewMaterial(AoMap); + break; + case MapType.Property: + break; + default: + throw new ArgumentOutOfRangeException(nameof(loadedTexture), loadedTexture, null); + } + + FixSize(); + } + + //==================================================// + // Property Map // + //==================================================// + + private void SetPropertyTexture(string texPrefix, Texture2D texture, Texture overlayTexture) + { + _propertyCompMaterial.SetTexture(texPrefix + "Tex", texture != null ? texture : TextureBlack); + + _propertyCompMaterial.SetTexture(texPrefix + "OverlayTex", overlayTexture); + } + + private void SetPropertyMapChannel(string texPrefix, PropChannelMap pcm) + { + switch (pcm) + { + case PropChannelMap.Height: + SetPropertyTexture(texPrefix, HeightMap, TextureGrey); + break; + case PropChannelMap.Metallic: + SetPropertyTexture(texPrefix, MetallicMap, TextureGrey); + break; + case PropChannelMap.Smoothness: + SetPropertyTexture(texPrefix, SmoothnessMap, TextureGrey); + break; + case PropChannelMap.Edge: + SetPropertyTexture(texPrefix, EdgeMap, TextureGrey); + break; + case PropChannelMap.Ao: + SetPropertyTexture(texPrefix, AoMap, TextureGrey); + break; + case PropChannelMap.AoEdge: + SetPropertyTexture(texPrefix, AoMap, EdgeMap); + break; + case PropChannelMap.None: + SetPropertyTexture(texPrefix, TextureBlack, TextureGrey); + break; + default: + throw new ArgumentOutOfRangeException(nameof(pcm), pcm, null); + } + } + public void ProcessPropertyMapRevised() + { + var Size = GetSize(); + Texture2D TempMap = null; + if (PropAlpha == PropChannelMap.None) + { + TempMap = new Texture2D(HeightMap.width, HeightMap.height, TextureFormat.RGB24, false); + } + else + { + TempMap = new Texture2D(HeightMap.width, HeightMap.height, TextureFormat.RGBA32, false); + } + + Color theColour = new Color(); + for (int x = 0; x < TempMap.width; x++) + { + for (int y = 0; y < TempMap.height; y++) + { + theColour.r = TextureRed == null ? TextureRed.GetPixel(x, y).grayscale : new Texture2D(TempMap.width,TempMap.height).GetPixel(x,y).grayscale; + theColour.g = TextureGreen == null ? TextureGreen.GetPixel(x, y).grayscale : new Texture2D(TempMap.width, TempMap.height).GetPixel(x, y).grayscale; + theColour.b = TextureBlue == null ? TextureBlue.GetPixel(x, y).grayscale : new Texture2D(TempMap.width, TempMap.height).GetPixel(x, y).grayscale; + if (PropAlpha == PropChannelMap.None) + { + theColour.a = 255; + } + else + { + theColour.a = TextureAlpha == null ? TextureAlpha.GetPixel(x, y).grayscale : new Texture2D(TempMap.width, TempMap.height).GetPixel(x, y).grayscale; + + } + + TempMap.SetPixel(x, y, theColour); + } + } + TempMap.Apply(); + PropertyMap = TempMap; + SaveTextureFile(MapType.Property); + + } + public void ProcessPropertyMap() + { + SetPropertyMapChannel("_Red", PropRed); + SetPropertyMapChannel("_Green", PropGreen); + SetPropertyMapChannel("_Blue", PropBlue); + + var size = GetSize(); + var tempMap = RenderTexture.GetTemporary((int)size.x, (int)size.y, 0, RenderTextureFormat.ARGB32, + RenderTextureReadWrite.Default); + Graphics.Blit(MetallicMap, tempMap, _propertyCompMaterial, 0); + RenderTexture.active = tempMap; + + if (PropertyMap != null) + { + Destroy(PropertyMap); + PropertyMap = null; + } + + PropertyMap = new Texture2D(tempMap.width, tempMap.height, TextureFormat.RGB24, false); + PropertyMap.ReadPixels(new Rect(0, 0, tempMap.width, tempMap.height), 0, 0); + PropertyMap.Apply(); + + RenderTexture.ReleaseTemporary(tempMap); + // ReSharper disable once RedundantAssignment + tempMap = null; + } + + //==================================================// + // Project Saving // + //==================================================// + + private void SaveFile(string pathToFile) + { + _saveLoadProjectScript.SaveFileAsync(pathToFile, _textureToSave); + } + + // ReSharper disable once MemberCanBeMadeStatic.Local + private void CopyFile() + { + _saveLoadProjectScript.CopyFile(_textureToSave); + } + + // ReSharper disable once MemberCanBeMadeStatic.Local + private void PasteFile() + { + ClearTexture(_activeMapType); + _saveLoadProjectScript.PasteFile(_activeMapType); + } + + private void OpenFile(string pathToFile) + { + if (pathToFile == null) return; + + // clear the existing texture we are loading + ClearTexture(_activeMapType); + + StartCoroutine(_saveLoadProjectScript.LoadTexture(_activeMapType, pathToFile)); + } + + //==================================================// + // Fix the size of the test model // + //==================================================// + + + private Vector2 GetSize() + { + Texture2D mapToUse = null; + + var size = new Vector2(1024, 1024); + + if (HeightMap != null) + mapToUse = HeightMap; + else if (DiffuseMap != null) + mapToUse = DiffuseMap; + else if (DiffuseMapOriginal != null) + mapToUse = DiffuseMapOriginal; + else if (NormalMap != null) + mapToUse = NormalMap; + else if (MetallicMap != null) + mapToUse = MetallicMap; + else if (SmoothnessMap != null) + mapToUse = SmoothnessMap; + else if (EdgeMap != null) + mapToUse = EdgeMap; + else if (AoMap != null) mapToUse = AoMap; + + if (mapToUse == null) return size; + size.x = mapToUse.width; + size.y = mapToUse.height; + + return size; + } + + public void FixSize() + { + var size = GetSize(); + FixSizeSize(size.x, size.y); + } + + private void FixSizeMap(Texture mapToUse) + { + FixSizeSize(mapToUse.width, mapToUse.height); + } + + private void FixSizeMap(RenderTexture mapToUse) + { + FixSizeSize(mapToUse.width, mapToUse.height); + } + + private void FixSizeSize(float width, float height) + { + var testObjectScale = new Vector3(1, 1, 1); + const float area = 1.0f; + + testObjectScale.x = width / height; + + var newArea = testObjectScale.x * testObjectScale.y; + var areaScale = Mathf.Sqrt(area / newArea); + + testObjectScale.x *= areaScale; + testObjectScale.y *= areaScale; + + TestObject.transform.localScale = testObjectScale; + } + private float TextureAspectRatio(float Height, float Width) + { + return Width / Height; + } + private float LockTextureValue(float Input, float Height, float Width) + { + return Input * (1 + TextureAspectRatio(Height, Width)); + } + public void MapSelection(int dropDownValue, string PropertyType) + { + PropChannelMap _channels; + switch (dropDownValue) + { + + case (0): + _channels = PropChannelMap.None; + break; + case (1): + _channels = PropChannelMap.Metallic; + break; + case (2): + _channels = PropChannelMap.Smoothness; + break; + case (3): + _channels = PropChannelMap.Height; + break; + case (4): + _channels = PropChannelMap.Ao; + break; + case (5): + _channels = PropChannelMap.Edge; + break; + case (6): + _channels = PropChannelMap.AoEdge; + break; + default: + _channels = PropChannelMap.None; + break; + } + switch (PropertyType) + { + case ("Red"): + PropRed = _channels; + TextureRed = returnTexture(_channels); + break; + case ("Blue"): + PropBlue = _channels; + TextureBlue = returnTexture(_channels); + break; + case ("Green"): + PropGreen = _channels; + TextureGreen = returnTexture(_channels); + break; + case ("Alpha"): + PropAlpha = _channels; + TextureAlpha = returnTexture(_channels); + break; + default: + break; + } + + } + public Texture2D returnTexture(PropChannelMap map) + { + switch (map) + { + case (PropChannelMap.Ao): + return AoMap; + case (PropChannelMap.Metallic): + return MetallicMap; + case (PropChannelMap.Height): + return HeightMap; + case (PropChannelMap.Edge): + return EdgeMap; + case (PropChannelMap.Smoothness): + return SmoothnessMap; + default: + return new Texture2D(1, 1); + } + } + + public void SavePropertyMap() + { + if (PropAlpha == PropChannelMap.None) + { + ProcessPropertyMap(); + } + else + { + ProcessPropertyMapRevised(); + } + // SaveTextureFile(MapType.Property); + } + public void QuickSavePropertyMap() + { + ProcessPropertyMap(); + _textureToSave = PropertyMap; + SaveFile(QuicksavePathProperty); + } + + public void Paste(int mapType) + { + switch (mapType) + { + case 0: + _activeMapType = global::MapType.DiffuseOriginal; + break; + case 1: + _activeMapType = global::MapType.Height; + break; + case 2: + _activeMapType = global::MapType.Normal; + break; + case 4: + _activeMapType = global::MapType.Metallic; + break; + case 3: + _activeMapType = global::MapType.Smoothness; + break; + case 5: + _activeMapType = global::MapType.Edge; + break; + case 6: + _activeMapType = global::MapType.Ao; + break; + + } + PasteFile(); + } + public void Copy(int mapType) + { + switch (mapType) + { + case 0: + _activeMapType = global::MapType.DiffuseOriginal; + break; + } + CopyFile(); + } + public void Open(int mapType) + { + MapType type = SetMapType(mapType); + OpenTextureFile(type); + if (type == MapType.Diffuse) + { + DiffuseMapOriginal = DiffuseMap; + } + } + + public void Save(int mapType) + { + MapType type = SetMapType(mapType); + SaveTextureFile(type); + } + private MapType SetMapType(int mapType) + { + var type = new MapType(); + switch (mapType) + { + case 0: + type = MapType.Diffuse; + break; + case 1: + type = MapType.Height; + break; + case 2: + type = MapType.Normal; + break; + case 3: + type = MapType.Smoothness; + break; + case 4: + type = MapType.Metallic; + break; + case 5: + type = MapType.Edge; + break; + case 6: + type = MapType.Ao; + break; + } + + + return type; + } + public void QuickSave(int mapType) + { + MapType type = SetMapType(mapType); + SaveTextureFile(type); + } + public void Preview(int mapType) + { + SetPreviewMaterial(DiffuseMap != null ? DiffuseMap : DiffuseMapOriginal); + } + + public void Edit(int mapType) + { + CloseWindows(); + FixSize(); + switch (mapType) + { + case 0: + EditDiffuseGuiObject.SetActive(true); + EditDiffuseGuiScript.NewTexture(); + EditDiffuseGuiScript.DoStuff(); + break; + case 1: + HeightFromDiffuseGuiObject.SetActive(true); + HeightFromDiffuseGuiScript.NewTexture(); + HeightFromDiffuseGuiScript.DoStuff(); + break; + case 2: + NormalFromHeightGuiObject.SetActive(true); + NormalFromHeightGuiScript.NewTexture(); + NormalFromHeightGuiScript.DoStuff(); + break; + case 3: + MetallicGuiObject.SetActive(true); + MetallicGuiScript.NewTexture(); + MetallicGuiScript.DoStuff(); + break; + case 4: + SmoothnessGuiObject.SetActive(true); + SmoothnessGuiScript.NewTexture(); + SmoothnessGuiScript.DoStuff(); + break; + case 5: + EdgeFromNormalGuiObject.SetActive(true); + EdgeFromNormalGuiScript.NewTexture(); + EdgeFromNormalGuiScript.DoStuff(); + break; + case 6: + AoFromNormalGuiObject.SetActive(true); + AoFromNormalGuiScript.NewTexture(); + AoFromNormalGuiScript.DoStuff(); + break; + + } + + } + + + public void Clear(int mapType) + { + ClearTexture(SetMapType(mapType)); + CloseWindows(); + SetMaterialValues(); + FixSize(); + } + + public void InvertMap() + { + Texture2D map = SmoothnessMap; + var whitePixels = 0; + var blackPixels = 0; + for (int i = 0; i < map.width; i++) { + + for (int j = 0; j < map.height; j++) + { + Color pixel = map.GetPixel(i, j); + + // if it's a white color then just debug... + pixel.r = 1 - pixel.r ; + pixel.g = 1 - pixel.g ; + pixel.b = 1 - pixel.b ; + map.SetPixel(i, j, pixel); + + } + } + map.Apply(); + SmoothnessMap = map; + SmoothnessTexture.texture = map; + SmoothnessTexture.color = new Color(1, 1, 1, 1); + + } + + + #region Gui Hide Variables + + [HideInInspector] public CountLocker HideGuiLocker = new CountLocker(); + private bool _lastGuiIsHiddenState; + private bool _isGuiHidden; + + public bool IsGuiHidden + { + get => _isGuiHidden; + set + { + if (HideGuiLocker.IsLocked) + { + Debug.Log("Tentando modificar IsGuiHidden quando travado"); + return; + } + + if (value && !_isGuiHidden) + { + HideGui(); + _isGuiHidden = true; + } + else if (!value && _isGuiHidden) + { + ShowGui(); + _isGuiHidden = false; + } + } + } + + + //public void SetPropertyMap() + + #endregion + +} \ No newline at end of file diff --git a/Assets/Scripts/MainGui.cs.meta b/Assets/Scripts/Undocumented/MainGui.cs.meta similarity index 100% rename from Assets/Scripts/MainGui.cs.meta rename to Assets/Scripts/Undocumented/MainGui.cs.meta diff --git a/Assets/Scripts/MaterialGui.cs b/Assets/Scripts/Undocumented/MaterialGui.cs similarity index 100% rename from Assets/Scripts/MaterialGui.cs rename to Assets/Scripts/Undocumented/MaterialGui.cs diff --git a/Assets/Scripts/MaterialGui.cs.meta b/Assets/Scripts/Undocumented/MaterialGui.cs.meta similarity index 73% rename from Assets/Scripts/MaterialGui.cs.meta rename to Assets/Scripts/Undocumented/MaterialGui.cs.meta index 2d04d9aa..3e1b1379 100644 --- a/Assets/Scripts/MaterialGui.cs.meta +++ b/Assets/Scripts/Undocumented/MaterialGui.cs.meta @@ -1,8 +1,11 @@ fileFormatVersion: 2 guid: 8498ef4e9144f7f47a8d1a5e20d5440d MonoImporter: + externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/MetallicGui.cs b/Assets/Scripts/Undocumented/MetallicGui.cs similarity index 100% rename from Assets/Scripts/MetallicGui.cs rename to Assets/Scripts/Undocumented/MetallicGui.cs diff --git a/Assets/Scripts/MetallicGui.cs.meta b/Assets/Scripts/Undocumented/MetallicGui.cs.meta similarity index 84% rename from Assets/Scripts/MetallicGui.cs.meta rename to Assets/Scripts/Undocumented/MetallicGui.cs.meta index 03f8d3fe..5bf0913c 100644 --- a/Assets/Scripts/MetallicGui.cs.meta +++ b/Assets/Scripts/Undocumented/MetallicGui.cs.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 guid: 79b6b4b30e58933469d807ecc340a2d6 -timeCreated: 1429495718 -licenseType: Pro MonoImporter: + externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 diff --git a/Assets/Scripts/MetallicSettings.cs b/Assets/Scripts/Undocumented/MetallicSettings.cs similarity index 100% rename from Assets/Scripts/MetallicSettings.cs rename to Assets/Scripts/Undocumented/MetallicSettings.cs diff --git a/Assets/Scripts/Undocumented/MetallicSettings.cs.meta b/Assets/Scripts/Undocumented/MetallicSettings.cs.meta new file mode 100644 index 00000000..9e7cc822 --- /dev/null +++ b/Assets/Scripts/Undocumented/MetallicSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2bdb7c40c588407da3094e0f50598bf3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NormalFromHeightGui.cs b/Assets/Scripts/Undocumented/NormalFromHeightGui.cs similarity index 100% rename from Assets/Scripts/NormalFromHeightGui.cs rename to Assets/Scripts/Undocumented/NormalFromHeightGui.cs diff --git a/Assets/Scripts/NormalFromHeightGui.cs.meta b/Assets/Scripts/Undocumented/NormalFromHeightGui.cs.meta similarity index 73% rename from Assets/Scripts/NormalFromHeightGui.cs.meta rename to Assets/Scripts/Undocumented/NormalFromHeightGui.cs.meta index f8fe3cf0..db9d420f 100644 --- a/Assets/Scripts/NormalFromHeightGui.cs.meta +++ b/Assets/Scripts/Undocumented/NormalFromHeightGui.cs.meta @@ -1,8 +1,11 @@ fileFormatVersion: 2 guid: 2779cf5cd160cd14d91000f76919d956 MonoImporter: + externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NormalFromHeightSettings.cs b/Assets/Scripts/Undocumented/NormalFromHeightSettings.cs similarity index 100% rename from Assets/Scripts/NormalFromHeightSettings.cs rename to Assets/Scripts/Undocumented/NormalFromHeightSettings.cs diff --git a/Assets/Scripts/Undocumented/NormalFromHeightSettings.cs.meta b/Assets/Scripts/Undocumented/NormalFromHeightSettings.cs.meta new file mode 100644 index 00000000..8546a01a --- /dev/null +++ b/Assets/Scripts/Undocumented/NormalFromHeightSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 26511bdb812049f2bb1fe9e6db6eb6d9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PostProcessGui.cs b/Assets/Scripts/Undocumented/PostProcessGui.cs similarity index 96% rename from Assets/Scripts/PostProcessGui.cs rename to Assets/Scripts/Undocumented/PostProcessGui.cs index 8fbfb053..67851901 100644 --- a/Assets/Scripts/PostProcessGui.cs +++ b/Assets/Scripts/Undocumented/PostProcessGui.cs @@ -168,4 +168,10 @@ private void OnGUI() _windowRect = GUI.Window(19, _windowRect, DoMyWindow, "Post Process"); } + public void ShowPost() + { + _windowRect.width = 300; + _windowRect.height = 510; + _windowRect = GUI.Window(19, _windowRect, DoMyWindow, "Post Process"); + } } \ No newline at end of file diff --git a/Assets/Scripts/PostProcessGui.cs.meta b/Assets/Scripts/Undocumented/PostProcessGui.cs.meta similarity index 84% rename from Assets/Scripts/PostProcessGui.cs.meta rename to Assets/Scripts/Undocumented/PostProcessGui.cs.meta index 88e2d67d..70494140 100644 --- a/Assets/Scripts/PostProcessGui.cs.meta +++ b/Assets/Scripts/Undocumented/PostProcessGui.cs.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 guid: 160ce17b3a5127e48a2b65fa77a7876a -timeCreated: 1433819650 -licenseType: Pro MonoImporter: + externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 diff --git a/Assets/Scripts/PropChannelMap.cs b/Assets/Scripts/Undocumented/PropChannelMap.cs similarity index 100% rename from Assets/Scripts/PropChannelMap.cs rename to Assets/Scripts/Undocumented/PropChannelMap.cs diff --git a/Assets/Scripts/Undocumented/PropChannelMap.cs.meta b/Assets/Scripts/Undocumented/PropChannelMap.cs.meta new file mode 100644 index 00000000..03248fc5 --- /dev/null +++ b/Assets/Scripts/Undocumented/PropChannelMap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1a308fa666f8458cb6a15acd4a4ebd94 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SaveLoadProject.cs b/Assets/Scripts/Undocumented/SaveLoadProject.cs similarity index 61% rename from Assets/Scripts/SaveLoadProject.cs rename to Assets/Scripts/Undocumented/SaveLoadProject.cs index 4eff4e46..72e505e8 100644 --- a/Assets/Scripts/SaveLoadProject.cs +++ b/Assets/Scripts/Undocumented/SaveLoadProject.cs @@ -2,11 +2,16 @@ using System; using System.Collections; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Xml.Serialization; using UnityEngine; +using System.Threading; +using System.Threading.Tasks; +using System.Diagnostics; +using Debug = UnityEngine.Debug; #endregion @@ -62,14 +67,13 @@ public class SaveLoadProject : MonoBehaviour { private char _pathChar; private ProjectObject _thisProject; - private MainGui MainGUI; [HideInInspector] public bool Busy; // Use this for initialization private void Start() { - MainGUI = FindObjectOfType(); + if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer) _pathChar = '\\'; @@ -106,12 +110,14 @@ public void SaveProject(string pathToFile) if (pathToFile.Contains(".")) pathToFile = pathToFile.Substring(0, pathToFile.LastIndexOf(".", StringComparison.Ordinal)); + List extensions = new List(); Debug.Log("Saving Project: " + pathToFile); var extension = MainGui.Instance.SelectedFormat.ToString().ToLower(); var projectName = pathToFile.Substring(pathToFile.LastIndexOf(_pathChar) + 1); Debug.Log("Project Name " + projectName); + Debug.Log("test"); MainGui.Instance.HeightFromDiffuseGuiScript.GetValues(_thisProject); if (MainGui.Instance.HeightMap != null) _thisProject.HeightMapPath = projectName + "_height." + extension; @@ -167,6 +173,7 @@ public void SaveProject(string pathToFile) stream.Close(); SaveAllFiles(pathToFile); + } public void SaveAllFiles(string pathToFile) @@ -174,54 +181,101 @@ public void SaveAllFiles(string pathToFile) StartCoroutine(SaveAllTextures(pathToFile)); } - public void SaveFile(string pathToFile, Texture2D textureToSave) + public async void SaveFileAsync(string pathToFile, Texture2D textureToSave) { - StartCoroutine(SaveTexture(textureToSave, pathToFile)); + await SaveTexture(textureToSave, pathToFile); } public void PasteFile(MapType mapTypeToLoad) { - if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return; - const string filePrefix = "file:///"; - string pathToFile; - - var pathToTextFile = Path.GetTempFileName(); - BashRunner.Run($"xclip -selection clipboard -t TARGETS -o > {pathToTextFile}"); - var bashOut = File.ReadAllText(pathToTextFile); - - Debug.Log($"Out : {bashOut}"); - File.Delete(pathToTextFile); - - if (bashOut.Contains("image/png")) + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - pathToFile = Path.GetTempFileName() + ".png"; - BashRunner.Run($"xclip -selection clipboard -t image/png -o > {pathToFile}"); + string tempImagePath = Application.dataPath + "/temp.png"; + //string tempImagePath = Application.persistentDataPath + "/temp.png"; + UnityEngine.Debug.Log(tempImagePath); + + try + { + Process myProcess = new Process(); + myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + myProcess.StartInfo.CreateNoWindow = true; + myProcess.StartInfo.UseShellExecute = false; + myProcess.StartInfo.FileName = Application.streamingAssetsPath.Replace("/", "\\") + "\\c2i.exe"; + myProcess.StartInfo.Arguments = tempImagePath.Replace("/", "\\"); + myProcess.EnableRaisingEvents = true; + myProcess.Start(); + myProcess.WaitForExit(); + + StartCoroutine(LoadTexture(mapTypeToLoad, tempImagePath)); + } + catch (Exception e) + { + UnityEngine.Debug.Log(e); + } } else { - BashRunner.Run($"xclip -selection clipboard -o > {pathToTextFile}"); - bashOut = File.ReadAllText(pathToTextFile); - - if (!bashOut.Contains(filePrefix)) return; - var supported = MainGui.LoadFormats.Any(format => bashOut.Contains(format)); - if (!supported) return; - - var firstIndex = bashOut.IndexOf("file:///", StringComparison.Ordinal); - var lastIndex = bashOut.IndexOf("\n", firstIndex, StringComparison.Ordinal); - var length = lastIndex - firstIndex; - pathToFile = bashOut.Substring(firstIndex, length); - pathToFile = pathToFile.Replace("file:///", "/"); - Debug.Log("Path " + pathToFile); - } + const string filePrefix = "file:///"; + string pathToFile; + + var pathToTextFile = Path.GetTempFileName(); + BashRunner.Run($"xclip -selection clipboard -t TARGETS -o > {pathToTextFile}"); + var bashOut = File.ReadAllText(pathToTextFile); + + Debug.Log($"Out : {bashOut}"); + File.Delete(pathToTextFile); - File.Delete(pathToTextFile); + if (bashOut.Contains("image/png")) + { + pathToFile = Path.GetTempFileName() + ".png"; + BashRunner.Run($"xclip -selection clipboard -t image/png -o > {pathToFile}"); + } + else + { + BashRunner.Run($"xclip -selection clipboard -o > {pathToTextFile}"); + bashOut = File.ReadAllText(pathToTextFile); + + if (!bashOut.Contains(filePrefix)) return; + var supported = MainGui.LoadFormats.Any(format => bashOut.Contains(format)); + if (!supported) return; + + var firstIndex = bashOut.IndexOf("file:///", StringComparison.Ordinal); + var lastIndex = bashOut.IndexOf("\n", firstIndex, StringComparison.Ordinal); + var length = lastIndex - firstIndex; + pathToFile = bashOut.Substring(firstIndex, length); + pathToFile = pathToFile.Replace("file:///", "/"); + Debug.Log("Path " + pathToFile); + } + File.Delete(pathToTextFile); - StartCoroutine(LoadTexture(mapTypeToLoad, pathToFile)); + StartCoroutine(LoadTexture(mapTypeToLoad, pathToFile)); + } + } public void CopyFile(Texture2D textureToSave) { + + SaveFileAsync(Application.dataPath + "/temp.png", textureToSave); + //SaveFile(Application.persistentDataPath + "/temp.png",FileFormat.png,textureToSave, "" ); + + try + { + Process myProcess = new Process(); + myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + myProcess.StartInfo.CreateNoWindow = true; + myProcess.StartInfo.UseShellExecute = false; + myProcess.StartInfo.FileName = Application.streamingAssetsPath.Replace("/", "\\") + "\\i2c.exe"; + myProcess.StartInfo.Arguments = Application.dataPath.Replace("/", "\\") + "\\temp.png"; + myProcess.EnableRaisingEvents = true; + myProcess.Start(); + myProcess.WaitForExit(); + } + catch (Exception e) + { + UnityEngine.Debug.Log(e); + } } //==============================================// @@ -232,39 +286,59 @@ public void CopyFile(Texture2D textureToSave) private IEnumerator SaveAllTextures(string pathToFile) { var path = pathToFile.Substring(0, pathToFile.LastIndexOf(_pathChar) + 1); - yield return StartCoroutine(SaveTexture(MainGui.Instance.HeightMap, path + _thisProject.HeightMapPath)); + //yield return StartCoroutine(SaveTexture(MainGui.Instance.HeightMap, path + _thisProject.HeightMapPath)); + + //yield return StartCoroutine(SaveTexture(MainGui.Instance.DiffuseMap, path + _thisProject.DiffuseMapPath)); - yield return StartCoroutine(SaveTexture(MainGui.Instance.DiffuseMap, path + _thisProject.DiffuseMapPath)); + //yield return StartCoroutine(SaveTexture(MainGui.Instance.DiffuseMapOriginal, + // path + _thisProject.DiffuseMapOriginalPath)); - yield return StartCoroutine(SaveTexture(MainGui.Instance.DiffuseMapOriginal, - path + _thisProject.DiffuseMapOriginalPath)); + //yield return StartCoroutine(SaveTexture(MainGui.Instance.NormalMap, path + _thisProject.NormalMapPath)); - yield return StartCoroutine(SaveTexture(MainGui.Instance.NormalMap, path + _thisProject.NormalMapPath)); + //yield return StartCoroutine(SaveTexture(MainGui.Instance.MetallicMap, path + _thisProject.MetallicMapPath)); - yield return StartCoroutine(SaveTexture(MainGui.Instance.MetallicMap, path + _thisProject.MetallicMapPath)); + //yield return StartCoroutine(SaveTexture(MainGui.Instance.SmoothnessMap, path + _thisProject.SmoothnessMapPath)); - yield return StartCoroutine(SaveTexture(MainGui.Instance.SmoothnessMap, path + _thisProject.SmoothnessMapPath)); + //yield return StartCoroutine(SaveTexture(MainGui.Instance.EdgeMap, path + _thisProject.EdgeMapPath)); - yield return StartCoroutine(SaveTexture(MainGui.Instance.EdgeMap, path + _thisProject.EdgeMapPath)); + //yield return StartCoroutine(SaveTexture(MainGui.Instance.AoMap, path + _thisProject.AoMapPath)); - yield return StartCoroutine(SaveTexture(MainGui.Instance.AoMap, path + _thisProject.AoMapPath)); + yield return SaveTexture(MainGui.Instance.HeightMap, path + _thisProject.HeightMapPath); + + yield return SaveTexture(MainGui.Instance.DiffuseMap, path + _thisProject.DiffuseMapPath); + + yield return SaveTexture(MainGui.Instance.DiffuseMapOriginal, + path + _thisProject.DiffuseMapOriginalPath); + + yield return SaveTexture(MainGui.Instance.NormalMap, path + _thisProject.NormalMapPath); + + yield return SaveTexture(MainGui.Instance.MetallicMap, path + _thisProject.MetallicMapPath); + + yield return SaveTexture(MainGui.Instance.SmoothnessMap, path + _thisProject.SmoothnessMapPath); + + yield return SaveTexture(MainGui.Instance.EdgeMap, path + _thisProject.EdgeMapPath); + + yield return SaveTexture(MainGui.Instance.AoMap, path + _thisProject.AoMapPath); + + MainGui.Instance.Modle.SetActive(true); } - public IEnumerator SaveTexture(string extension, Texture2D textureToSave, string pathToFile) + public async Task SaveTexture(string extension, Texture2D textureToSave, string pathToFile) { - yield return StartCoroutine(SaveTexture(textureToSave, pathToFile + "." + extension)); + await (SaveTexture(textureToSave, pathToFile + "." + extension)); } - - private IEnumerator SaveTexture(Texture2D textureToSave, string pathToFile) + #pragma warning disable CS1998 + private async Task SaveTexture(Texture2D textureToSave, string pathToFile) + #pragma warning restore CS1998 { - if (!textureToSave || pathToFile.IsNullOrEmpty()) yield break; - if (MainGUI.ScaleTexture) + if (!textureToSave || pathToFile.IsNullOrEmpty()) return; + if (MainGui.Instance.ScaleTexture) { //TextureScale.BilinearScale(_textureToSave); - textureToSave = TextureScale.Bilinear(textureToSave, int.Parse(MainGUI.XSize), int.Parse(MainGUI.YSize)); + textureToSave = TextureScale.Bilinear(textureToSave, int.Parse(MainGui.Instance.XSize), int.Parse(MainGui.Instance.YSize)); } - Debug.Log($"Salvando {textureToSave} como {pathToFile}"); + Debug.Log($"Saved {textureToSave} To {pathToFile}"); if (!pathToFile.Contains(".")) pathToFile = $"{pathToFile}.{MainGui.Instance.SelectedFormat}"; var fileIndex = pathToFile.LastIndexOf('.'); @@ -273,29 +347,29 @@ private IEnumerator SaveTexture(Texture2D textureToSave, string pathToFile) switch (extension) { case "png": - { - var pngBytes = textureToSave.EncodeToPNG(); - File.WriteAllBytes(pathToFile, pngBytes); - break; - } + { + var pngBytes = textureToSave.EncodeToPNG(); + File.WriteAllBytes(pathToFile, pngBytes); + break; + } case "jpg": - { - var jpgBytes = textureToSave.EncodeToJPG(); - File.WriteAllBytes(pathToFile, jpgBytes); - break; - } + { + var jpgBytes = textureToSave.EncodeToJPG(); + File.WriteAllBytes(pathToFile, jpgBytes); + break; + } case "tga": - { - var tgaBytes = textureToSave.EncodeToTGA(); - File.WriteAllBytes(pathToFile, tgaBytes); - break; - } + { + var tgaBytes = textureToSave.EncodeToTGA(); + File.WriteAllBytes(pathToFile, tgaBytes); + break; + } case "exr": - { - var exrBytes = textureToSave.EncodeToEXR(); - File.WriteAllBytes(pathToFile, exrBytes); - break; - } + { + var exrBytes = textureToSave.EncodeToEXR(); + File.WriteAllBytes(pathToFile, exrBytes); + break; + } default: throw new ArgumentOutOfRangeException(nameof(extension), extension, null); } @@ -303,7 +377,7 @@ private IEnumerator SaveTexture(Texture2D textureToSave, string pathToFile) Resources.UnloadUnusedAssets(); - yield return new WaitForSeconds(0.1f); + //yield return new WaitForSeconds(0.1f); } //==============================================// @@ -357,6 +431,8 @@ private IEnumerator LoadAllTextures(string pathToFile) yield return new WaitForSeconds(0.01f); } + + public IEnumerator LoadTexture(MapType textureToLoad, string pathToFile) { Busy = true; @@ -384,6 +460,7 @@ public IEnumerator LoadTexture(MapType textureToLoad, string pathToFile) MainGui.Instance.DiffuseMap = newTexture; break; case MapType.DiffuseOriginal: + MainGui.Instance.DiffuseMap = newTexture; MainGui.Instance.DiffuseMapOriginal = newTexture; break; case MapType.Normal: diff --git a/Assets/Scripts/SaveLoadProject.cs.meta b/Assets/Scripts/Undocumented/SaveLoadProject.cs.meta similarity index 69% rename from Assets/Scripts/SaveLoadProject.cs.meta rename to Assets/Scripts/Undocumented/SaveLoadProject.cs.meta index 197b10ca..294ee431 100644 --- a/Assets/Scripts/SaveLoadProject.cs.meta +++ b/Assets/Scripts/Undocumented/SaveLoadProject.cs.meta @@ -1,8 +1,7 @@ fileFormatVersion: 2 -guid: e9293ea1b483ec146a6a99c2cdaf5dbd -timeCreated: 1434235257 -licenseType: Pro +guid: e8126f4a303b91649a1a3f2025be7f30 MonoImporter: + externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 diff --git a/Assets/Scripts/SmoothnessGui.cs b/Assets/Scripts/Undocumented/SmoothnessGui.cs similarity index 95% rename from Assets/Scripts/SmoothnessGui.cs rename to Assets/Scripts/Undocumented/SmoothnessGui.cs index 148f0b08..ba2c64f8 100644 --- a/Assets/Scripts/SmoothnessGui.cs +++ b/Assets/Scripts/Undocumented/SmoothnessGui.cs @@ -48,6 +48,7 @@ public class SmoothnessGui : MonoBehaviour private static readonly int FinalBias = Shader.PropertyToID("_FinalBias"); private static readonly int MainTex = Shader.PropertyToID("_MainTex"); private static readonly int MetallicTex = Shader.PropertyToID("_MetallicTex"); + private static readonly int Invert = Shader.PropertyToID("_Invert"); private Material _blitMaterial; private RenderTexture _blurMap; private Camera _camera; @@ -72,6 +73,7 @@ public class SmoothnessGui : MonoBehaviour private Texture2D _sampleColorMap3; private bool _selectingColor; + private bool _invert; private SmoothnessSettings _settings; @@ -96,6 +98,7 @@ public class SmoothnessGui : MonoBehaviour private void Awake() { _camera = Camera.main; + } public void GetValues(ProjectObject projectObject) @@ -169,6 +172,7 @@ public void NewTexture() _newTexture = true; } + // Update is called once per frame private void Update() { @@ -228,7 +232,12 @@ private void Update() ThisMaterial.SetFloat(MaskLow3, _settings.MaskLow3); ThisMaterial.SetFloat(MaskHigh3, _settings.MaskHigh3); ThisMaterial.SetFloat(Sample3Smoothness, _settings.Sample3Smoothness); - + int invert = 0; + if (_settings.Invert) + { + invert = 1; + } + ThisMaterial.SetInt(Invert, invert); ThisMaterial.SetFloat(BaseSmoothness, _settings.BaseSmoothness); ThisMaterial.SetFloat(Slider, _slider); @@ -457,6 +466,10 @@ private void DoMyWindow(int windowId) GuiHelper.Slider(new Rect(offsetX, offsetY, 280, 50), "Final Bias", _settings.FinalBias, _settings.FinalBiasText, out _settings.FinalBias, out _settings.FinalBiasText, -0.5f, 0.5f); + offsetY += 40; + + _settings.Invert = GUI.Toggle(new Rect(offsetX, offsetY, 150, 20), _settings.Invert, "Invert Smoothness"); + offsetY += 50; if (GUI.Button(new Rect(offsetX + 10, offsetY, 130, 30), "Reset to Defaults")) @@ -477,7 +490,7 @@ private void OnGUI() if (!_settingsInitialized) return; _windowRect.width = 300; - _windowRect.height = 490; + _windowRect.height = 550; if (_settings.UseSample1) _windowRect.height += 110; @@ -527,7 +540,7 @@ public void InitializeTextures() _imageSizeX = _diffuseMap.width; _imageSizeY = _diffuseMap.height; } - else + else if (_diffuseMapOriginal) { ThisMaterial.SetTexture(MainTex, _diffuseMapOriginal); _imageSizeX = _diffuseMapOriginal.width; @@ -535,6 +548,18 @@ public void InitializeTextures() _settings.UseAdjustedDiffuse = false; _settings.UseOriginalDiffuse = true; + _settings.UsePastedSmoothness = false; + + } + else + { + _smoothnessMap = MainGuiScript.SmoothnessMap; + ThisMaterial.SetTexture(MainTex, _smoothnessMap); + _imageSizeX = _smoothnessMap.width; + _imageSizeY = _smoothnessMap.height; + _settings.UseAdjustedDiffuse = false; + _settings.UseOriginalDiffuse = false; + _settings.UsePastedSmoothness = true; } Debug.Log("Initializing Textures of size: " + _imageSizeX + "x" + _imageSizeY); @@ -596,7 +621,12 @@ public IEnumerator ProcessSmoothness() _blitMaterial.SetFloat("_MaskLow3", _settings.MaskLow3); _blitMaterial.SetFloat("_MaskHigh3", _settings.MaskHigh3); _blitMaterial.SetFloat("_Sample3Smoothness", _settings.Sample3Smoothness); - + int invert = 0; + if (_settings.Invert) + { + invert = 1; + } + _blitMaterial.SetInt("_Invert", invert); _blitMaterial.SetFloat("_BaseSmoothness", _settings.BaseSmoothness); _blitMaterial.SetFloat("_BlurOverlay", _settings.BlurOverlay); @@ -606,9 +636,10 @@ public IEnumerator ProcessSmoothness() CleanupTexture(_tempMap); _tempMap = new RenderTexture(_imageSizeX, _imageSizeY, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear) {wrapMode = TextureWrapMode.Repeat}; - + Material m = ThisMaterial; + m.SetFloat("_Slider", 0); Graphics.Blit(_settings.UseAdjustedDiffuse ? _diffuseMap : _diffuseMapOriginal, _tempMap, - _blitMaterial, 0); + m, 0); RenderTexture.active = _tempMap; @@ -644,6 +675,8 @@ public IEnumerator ProcessBlur() Graphics.Blit(_diffuseMap, _tempMap); else Graphics.Blit(_diffuseMap, _tempMap, _blitMaterial, 1); + }else if(_settings.UsePastedSmoothness){ + Graphics.Blit(_smoothnessMap, _tempMap); } else { diff --git a/Assets/Scripts/SmoothnessGui.cs.meta b/Assets/Scripts/Undocumented/SmoothnessGui.cs.meta similarity index 73% rename from Assets/Scripts/SmoothnessGui.cs.meta rename to Assets/Scripts/Undocumented/SmoothnessGui.cs.meta index 0b6ee112..5c4375d4 100644 --- a/Assets/Scripts/SmoothnessGui.cs.meta +++ b/Assets/Scripts/Undocumented/SmoothnessGui.cs.meta @@ -1,8 +1,11 @@ fileFormatVersion: 2 guid: 15c311a2b5638944983c713e2d8d6669 MonoImporter: + externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SmoothnessSettings.cs b/Assets/Scripts/Undocumented/SmoothnessSettings.cs similarity index 97% rename from Assets/Scripts/SmoothnessSettings.cs rename to Assets/Scripts/Undocumented/SmoothnessSettings.cs index 02d4a452..5559950d 100644 --- a/Assets/Scripts/SmoothnessSettings.cs +++ b/Assets/Scripts/Undocumented/SmoothnessSettings.cs @@ -73,6 +73,8 @@ public class SmoothnessSettings [DefaultValue(0.2f)] public float Sample3Smoothness; + [DefaultValue(0)] public bool Invert; + //[DefaultValueAttribute(Color.black)] public Color SampleColor1; @@ -101,6 +103,8 @@ public class SmoothnessSettings [DefaultValue(true)] public bool UseOriginalDiffuse; + [DefaultValue(false)] public bool UsePastedSmoothness; + [DefaultValue(false)] public bool UseSample1; [DefaultValue(false)] public bool UseSample2; @@ -165,7 +169,7 @@ public SmoothnessSettings() FinalBias = 0.0f; FinalBiasText = "0"; - + Invert = false; UseAdjustedDiffuse = false; UseOriginalDiffuse = true; } diff --git a/Assets/Scripts/Undocumented/SmoothnessSettings.cs.meta b/Assets/Scripts/Undocumented/SmoothnessSettings.cs.meta new file mode 100644 index 00000000..1fd50ba5 --- /dev/null +++ b/Assets/Scripts/Undocumented/SmoothnessSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ba8d34d0d66490aa1b76236ad229ec2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/SpecularGui.cs b/Assets/Scripts/Undocumented/SpecularGui.cs similarity index 100% rename from Assets/Scripts/SpecularGui.cs rename to Assets/Scripts/Undocumented/SpecularGui.cs diff --git a/Assets/Scripts/SpecularGui.cs.meta b/Assets/Scripts/Undocumented/SpecularGui.cs.meta similarity index 73% rename from Assets/Scripts/SpecularGui.cs.meta rename to Assets/Scripts/Undocumented/SpecularGui.cs.meta index ccbab0ff..26ba59f2 100644 --- a/Assets/Scripts/SpecularGui.cs.meta +++ b/Assets/Scripts/Undocumented/SpecularGui.cs.meta @@ -1,8 +1,11 @@ fileFormatVersion: 2 guid: 68867325da9e000438c9a0953c1cc7e3 MonoImporter: + externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Undocumented/TextureUpdater.cs b/Assets/Scripts/Undocumented/TextureUpdater.cs new file mode 100644 index 00000000..7e582fd5 --- /dev/null +++ b/Assets/Scripts/Undocumented/TextureUpdater.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class TextureUpdater : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Assets/Scripts/Undocumented/TextureUpdater.cs.meta b/Assets/Scripts/Undocumented/TextureUpdater.cs.meta new file mode 100644 index 00000000..8f215cd2 --- /dev/null +++ b/Assets/Scripts/Undocumented/TextureUpdater.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0237cf0dab422124082638173e5037f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/TilingTextureMakerGui.cs b/Assets/Scripts/Undocumented/TilingTextureMakerGui.cs similarity index 100% rename from Assets/Scripts/TilingTextureMakerGui.cs rename to Assets/Scripts/Undocumented/TilingTextureMakerGui.cs diff --git a/Assets/Scripts/TilingTextureMakerGui.cs.meta b/Assets/Scripts/Undocumented/TilingTextureMakerGui.cs.meta similarity index 73% rename from Assets/Scripts/TilingTextureMakerGui.cs.meta rename to Assets/Scripts/Undocumented/TilingTextureMakerGui.cs.meta index baf1926c..bd06f688 100644 --- a/Assets/Scripts/TilingTextureMakerGui.cs.meta +++ b/Assets/Scripts/Undocumented/TilingTextureMakerGui.cs.meta @@ -1,8 +1,11 @@ fileFormatVersion: 2 guid: 5603489c3f0e4284fa9770f7a8b89a3f MonoImporter: + externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/WelcomeGui.cs b/Assets/Scripts/WelcomeGui.cs index b2946346..34264f51 100644 --- a/Assets/Scripts/WelcomeGui.cs +++ b/Assets/Scripts/WelcomeGui.cs @@ -1,123 +1,191 @@ -#region +/*TODO: +Separate this script into single responsibility scripts -using System.Collections; -using UnityEngine; +WelcomeScreenControl: This script would handle the logic for controlling the welcome screen, such as checking whether to skip the welcome screen, activating the necessary objects, and starting the intro sequence. -#endregion +FadeControl: This script would handle the logic for fading the background and logo, including the FadeBackground(), FadeLogo(), and Intro() methods. -public class WelcomeGui : MonoBehaviour -{ - private static readonly int GlobalCubemap = Shader.PropertyToID("_GlobalCubemap"); +OnGUIControl: This script would handle the logic for drawing the background and logo textures on the GUI, including the OnGUI() method. +StartupControl: This script would handle the logic for setting the target frame rate and vSync settings, as well as setting the global cubemap texture. - private float _backgroundFade = 1.0f; - private float _logoFade = 1.0f; - public Texture2D Background; - public GameObject CommandListExecutorObject; - public GameObject ControlsGuiObject; +WelcomeGui: This script would act as a wrapper for all the other scripts and would be attached to the object in the scene that you want to use as the Welcome Screen. +*/ - public Texture2D Logo; +#region - public GameObject MainGuiObject; - public GameObject SettingsGuiObject; +using System.Collections; +using UnityEngine; - public bool SkipWelcomeScreen; - public Cubemap StartCubeMap; - public GameObject TestObject; +#endregion + +public class WelcomeGui : MonoBehaviour +{ + /// + /// TODO: Use to replace GlobalCubemap + /// Cubemap uniform shader variable index used to set the Skybox from script + /// + private static readonly int globalCubemapUniformInt = Shader.PropertyToID("_Cubemap"); + /// + /// Fade time for the background texture + /// + private float backgroundFade = 1.0f; + /// + /// Fade time for the logo + /// + private float logoFade = 1.0f; + /// + /// Background texture for the splash screen + /// + public Texture2D background; + /// + /// Logo texture to be drawn on the GUI + /// + public Texture2D logo; + /// + /// //TODO: EXPLAIN CommandListExecutorObject to be activated when the welcome screen is skipped + /// + public GameObject commandListExecutorObject; + /// + /// controlsGuiObject to be activated when the welcome screen is skipped + /// + public GameObject controlsGuiObject; + /// + /// mainGuiObject to be activated when the welcome screen is skipped + /// + public GameObject mainGuiObject; + /// + /// settingsGuiObject to be activated when the welcome screen is skipped + /// + public GameObject settingsGuiObject; + + /// + /// Whether or not to skip the welcome screen and activate objects immediately + /// + public bool skipWelcomeScreen; + /// + /// Cubemap to be set as the global cubemap + /// + public Cubemap initialCubeMap; + /// + /// testObject to be activated when the welcome screen is skipped + /// + public GameObject testObject; private void Start() { + // Allow the application to run in the background Application.runInBackground = true; + // Set the target frame rate and vSync count based on player preferences if (PlayerPrefs.HasKey("targetFrameRate")) { Application.targetFrameRate = PlayerPrefs.GetInt("targetFrameRate"); QualitySettings.vSyncCount = PlayerPrefs.GetInt("Vsync"); } - if (SkipWelcomeScreen || Application.isEditor) + // If the welcome screen should be skipped or the application is running in the editor + if (skipWelcomeScreen || Application.isEditor) { + // Activate objects and deactivate this gameobject ActivateObjects(); gameObject.SetActive(false); } + // Otherwise play the intro animation else { + // Start the intro coroutine StartCoroutine(Intro()); } - Shader.SetGlobalTexture(GlobalCubemap, StartCubeMap); + // Set the global cubemap + //Shader.SetGlobalTexture(GlobalCubemap, initialCubeMap); + Shader.SetGlobalTexture(globalCubemapUniformInt, initialCubeMap); } - + /// + /// Activates the necessary objects + /// private void ActivateObjects() { - TestObject.SetActive(true); - MainGuiObject.SetActive(true); - SettingsGuiObject.SetActive(true); - ControlsGuiObject.SetActive(true); - CommandListExecutorObject.SetActive(true); + //Activates all the game objects that are set in the inspector + testObject.SetActive(true); + //mainGuiObject.SetActive(true); + //settingsGuiObject.SetActive(true); + controlsGuiObject.SetActive(true); + commandListExecutorObject.SetActive(true); } private void OnGUI() { - GUI.color = new Color(1, 1, 1, _backgroundFade); - - GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), Background); - + //Sets the color of the GUI elements to have a full alpha channel + GUI.color = new Color(1, 1, 1, backgroundFade); + //Draws the background texture on the whole screen + GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), background); + //Calculates the size and position of the logo texture to be drawn in the center of the screen var logoWidth = Mathf.FloorToInt(Screen.width * 0.75f); var logoHeight = Mathf.FloorToInt(logoWidth * 0.5f); var logoPosX = Mathf.FloorToInt(Screen.width * 0.5f - logoWidth * 0.5f); var logoPosY = Mathf.FloorToInt(Screen.height * 0.5f - logoHeight * 0.5f); - - GUI.color = new Color(1, 1, 1, _logoFade); - - GUI.DrawTexture(new Rect(logoPosX, logoPosY, logoWidth, logoHeight), Logo); + //Sets the color of the logo to have a full alpha channel + GUI.color = new Color(1, 1, 1, logoFade); + //Draws the logo texture on the calculated position and size + GUI.DrawTexture(new Rect(logoPosX, logoPosY, logoWidth, logoHeight), logo); } - private IEnumerator FadeLogo(float target, float overTime) + private IEnumerator Fadelogo(float target, float overTime) { + //Fades the logo texture to the target alpha over the specified time var timer = overTime; - var original = _logoFade; + var original = logoFade; while (timer > 0.0f) { timer -= Time.deltaTime; - _logoFade = Mathf.Lerp(target, original, timer / overTime); + logoFade = Mathf.Lerp(target, original, timer / overTime); yield return new WaitForEndOfFrame(); } - _logoFade = target; + logoFade = target; //yield return new WaitForEndOfFrame(); } private IEnumerator FadeBackground(float target, float overTime) { + //Fades the background texture to the target alpha over the specified time var timer = overTime; - var original = _backgroundFade; + var original = backgroundFade; while (timer > 0.0f) { timer -= Time.deltaTime; - _backgroundFade = Mathf.Lerp(target, original, timer / overTime); + backgroundFade = Mathf.Lerp(target, original, timer / overTime); yield return new WaitForEndOfFrame(); } - _backgroundFade = target; + backgroundFade = target; + //Deactivates the WelcomeGui game object after the background has been faded gameObject.SetActive(false); } private IEnumerator Intro() { - StartCoroutine(FadeLogo(1.0f, 0.5f)); + // Fade in the logo + StartCoroutine(Fadelogo(1.0f, 0.5f)); + // Wait for 3 seconds yield return new WaitForSeconds(3.0f); - StartCoroutine(FadeLogo(0.0f, 1.0f)); + // Fade out the logo + StartCoroutine(Fadelogo(0.0f, 1.0f)); + // Wait for 1 second yield return new WaitForSeconds(1.0f); + // Fades out the background StartCoroutine(FadeBackground(0.0f, 1.0f)); - + + // Activate the objects ActivateObjects(); } } \ No newline at end of file diff --git a/Assets/Shaders/Blur Skybox.shader b/Assets/Shaders/Blur Skybox.shader new file mode 100644 index 00000000..816f5e9e --- /dev/null +++ b/Assets/Shaders/Blur Skybox.shader @@ -0,0 +1,309 @@ +Shader "Custom/Blur Skybox" { + Properties { + _MainTex ("Base (RGB)", 2D) = "white" {} + _Tint("Tint Color", Color) = (.5, .5, .5, .5) + [Gamma] _Exposure("Exposure", Range(0, 8)) = 1.0 + _Rotation("Rotation", Range(0, 360)) = 0 + [NoScaleOffset] _Cubemap("Cubemap (HDR)", Cube) = "grey" {} + } + SubShader{ + Tags { "Queue" = "Background" "RenderType" = "Background" "PreviewType" = "Skybox" } + Cull Off ZWrite Off + + Pass { + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + + #include "UnityCG.cginc" + + samplerCUBE _Cubemap; + half4 _Cubemap_HDR; + half4 _Tint; + half _Exposure; + float _Rotation; + + sampler2D _MainTex; + + float3 RotateAroundYInDegrees(float3 vertex, float degrees) + { + float alpha = degrees * UNITY_PI / 180.0; + float sina, cosa; + sincos(alpha, sina, cosa); + float2x2 m = float2x2(cosa, -sina, sina, cosa); + return float3(mul(m, vertex.xz), vertex.y).xzy; + } + + + static const int BlurKernelSamples = 54; + static const float3 BlurKernel[BlurKernelSamples] = + { + float3(1,1,1), + float3(0,1,1), + float3(-1,1,1), + + float3(1,0,1), + float3(0,0,1), + float3(-1,0,1), + + float3(1,-1,1), + float3(0,-1,1), + float3(-1,-1,1), + + //====================// + + float3(1,1,0), + float3(0,1,0), + float3(-1,1,0), + + float3(1,0,0), + float3(0,0,0), + float3(-1,0,0), + + float3(1,-1,0), + float3(0,-1,0), + float3(-1,-1,0), + + //====================// + + float3(1,1,-1), + float3(0,1,-1), + float3(-1,1,-1), + + float3(1,0,-1), + float3(0,0,-1), + float3(-1,0,-1), + + float3(1,-1,-1), + float3(0,-1,-1), + float3(-1,-1,-1), + //====================// + float3(2,2,2), + float3(0,2,2), + float3(-2,2,2), + + float3(2,0,2), + float3(0,0,2), + float3(-2,0,2), + + float3(2,-2,2), + float3(0,-2,2), + float3(-2,-2,2), + + //====================// + + float3(2,2,0), + float3(0,2,0), + float3(-2,2,0), + + float3(2,0,0), + float3(0,0,0), + float3(-2,0,0), + + float3(2,-2,0), + float3(0,-2,0), + float3(-2,-2,0), + + //====================// + + float3(2,2,-2), + float3(0,2,-2), + float3(-2,2,-2), + + float3(2,0,-2), + float3(0,0,-2), + float3(-2,0,-2), + + float3(2,-2,-2), + float3(0,-2,-2), + float3(-2,-2,-2) + }; + + struct appdata_t { + float4 vertex : POSITION; + float3 normal : NORMAL; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct v2f { + float4 vertex : SV_POSITION; + float3 texcoord : TEXCOORD8; + float3 worldNormal : TEXCOORD7; + UNITY_VERTEX_OUTPUT_STEREO + }; + + v2f vert(appdata_t v) + { + v2f o; + UNITY_SETUP_INSTANCE_ID(v); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); + float3 rotated = RotateAroundYInDegrees(v.vertex, _Rotation); + o.vertex = UnityObjectToClipPos(rotated); + o.texcoord = v.vertex.xyz; + o.worldNormal = UnityObjectToWorldDir(v.normal.xyz); + return o; + } + + + // fragment shader + fixed4 frag(v2f IN) : SV_Target + { + + fixed3 worldNormal = normalize(IN.worldNormal.xyz); + + float3 ambIBL = 0.0; + for (int i = 0; i < BlurKernelSamples; i++) + { + half4 blurUV = half4(IN.texcoord + BlurKernel[i] * 0.025,4); + //fixed4 col = texCUBE(_MainTex, i.worldRefl); + + ambIBL += texCUBElod(_Cubemap,blurUV ).xyz; + } + ambIBL *= 1.0 / BlurKernelSamples; + half4 tex = texCUBE(_Cubemap, IN.texcoord); + half3 c = DecodeHDR(tex, _Cubemap_HDR); + c = c * _Tint.rgb * unity_ColorSpaceDouble.rgb; + c *= _Exposure; + + + + + return float4( ambIBL,1.0 ); + //return float4( ambIBL,1.0 ); + + } + + ENDCG + } + + /* + Pass + { + Name "DEFERRED" + Tags { "LightMode" = "Deferred" } + Fog {Mode Off} + + CGPROGRAM + #pragma vertex vert_surf + #pragma fragment frag_surf + #pragma target 3.0 + + #pragma exclude_renderers nomrt + #pragma multi_compile_prepassfinal + #pragma multi_compile _USE_BAKED_Cubemap_ON _USE_BAKED_Cubemap_OFF + #define UNITY_PASS_DEFERRED + + #include "HLSLSupport.cginc" + #include "UnityShaderVariables.cginc" + + #include "UnityCG.cginc" + #include "Lighting.cginc" + #include "UnityPBSLighting.cginc" + + sampler2D _MainTex; + samplerCUBE _Cubemap; + float _Blur; + float _Factor; + + float _UseProbeTexture; + + uniform samplerCUBE _GlobalCubemap; + uniform samplerCUBE _ProbeCubemap; + + #include "DNMST.cginc" + + static const int BlurKernelSamples = 27; + static const float3 BlurKernel[BlurKernelSamples] = + { + float3(1,1,1), + float3(0,1,1), + float3(-1,1,1), + + float3(1,0,1), + float3(0,0,1), + float3(-1,0,1), + + float3(1,-1,1), + float3(0,-1,1), + float3(-1,-1,1), + + //====================// + + float3(1,1,0), + float3(0,1,0), + float3(-1,1,0), + + float3(1,0,0), + float3(0,0,0), + float3(-1,0,0), + + float3(1,-1,0), + float3(0,-1,0), + float3(-1,-1,0), + + //====================// + + float3(1,1,-1), + float3(0,1,-1), + float3(-1,1,-1), + + float3(1,0,-1), + float3(0,0,-1), + float3(-1,0,-1), + + float3(1,-1,-1), + float3(0,-1,-1), + float3(-1,-1,-1) + }; + + void frag_surf (v2f_surf i, out half4 outDiffuse : SV_Target0, out half4 outMST : SV_Target1, out half4 outNormal : SV_Target2, out half4 outEmission : SV_Target3) { + // Albedo comes from a texture tinted by color + + fixed3 localNormal = float3(0,0,1); + + fixed3 worldNormalBaked = normalize( i.localNormal.xyz ); + fixed3 worldNormal = normalize( float3( i.tSpace0.z, i.tSpace1.z, i.tSpace2.z ) ); + + float3 worldPos = float3(i.tSpace0.w, i.tSpace1.w, i.tSpace2.w); + fixed3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) ); + + + float3 ambIBL = 0.0; + for( int i = 0; i < BlurKernelSamples; i++ ){ + ambIBL += texCUBElod(_ProbeCubemap, half4( worldNormal + BlurKernel[i] * 0.025 , 1.0 ) ).xyz; + } + ambIBL *= 1.0 / BlurKernelSamples; + + #if _USE_BAKED_Cubemap_ON + float3 ambIBLbaked = 0.0; + for( int i = 0; i < BlurKernelSamples; i++ ){ + ambIBLbaked += texCUBElod(_GlobalCubemap, half4( worldNormalBaked + BlurKernel[i] * 0.025 , 3.0 ) ).xyz; + } + ambIBLbaked *= 1.0 / BlurKernelSamples; + + ambIBL = lerp( ambIBLbaked, ambIBL, _UseProbeTexture ); + #endif + + + SurfaceOutputStandard surfOut; + surfOut.Albedo = float3(0,0,0); + surfOut.Normal = worldNormal; + surfOut.Metallic = 0; + surfOut.Smoothness = 0; + surfOut.Transmission = 0; + surfOut.Emission = ambIBL * _Factor; + surfOut.Motion = float2(1,1);//float2(0.5,0.5); + surfOut.Alpha = 1.0; + surfOut.Occlusion = 0; + + ReturnOutput ( surfOut, worldPos, worldViewDir, i, outDiffuse, outMST, outNormal, outEmission ); + + } + ENDCG + } + */ + } + FallBack "Diffuse" +} diff --git a/Assets/Shaders/Blur Skybox.shader.meta b/Assets/Shaders/Blur Skybox.shader.meta new file mode 100644 index 00000000..6f454d39 --- /dev/null +++ b/Assets/Shaders/Blur Skybox.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8367bf92bac7f5040946d66fd665910c +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Shaders/DNMST.cginc b/Assets/Shaders/DNMST.cginc index c87ed757..3cd7314b 100644 --- a/Assets/Shaders/DNMST.cginc +++ b/Assets/Shaders/DNMST.cginc @@ -128,7 +128,8 @@ v2f_surf vert_surf (appdata_full v) { o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; #ifdef DIRLIGHTMAP_OFF o.lmapFadePos.xyz = (mul(unity_ObjectToWorld, v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w; - o.lmapFadePos.w = (-mul(UNITY_MATRIX_MV, v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); + o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); + //o.lmapFadePos.w = (-mul(UNITY_MATRIX_MV, v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); #endif #else o.lmap.xy = 0; diff --git a/Assets/Shaders/DNMST.shader b/Assets/Shaders/DNMST.shader index 3564160b..dbfaac68 100644 --- a/Assets/Shaders/DNMST.shader +++ b/Assets/Shaders/DNMST.shader @@ -40,8 +40,10 @@ #pragma exclude_renderers nomrt #pragma multi_compile_prepassfinal + + #ifndef UNITY_PASS_DEFERRED #define UNITY_PASS_DEFERRED - + #endif #include "HLSLSupport.cginc" #include "UnityShaderVariables.cginc" diff --git a/Assets/Shaders/DNMST_Displace.shader b/Assets/Shaders/DNMST_Displace.shader index b57ea26b..ae6c49ce 100644 --- a/Assets/Shaders/DNMST_Displace.shader +++ b/Assets/Shaders/DNMST_Displace.shader @@ -54,7 +54,9 @@ Shader "Custom/DNMST_Displace" { #include "HLSLSupport.cginc" #include "UnityShaderVariables.cginc" + #ifndef UNITY_PASS_DEFERRED #define UNITY_PASS_DEFERRED + #endif #define TRIPLANAR #include "UnityCG.cginc" #include "Lighting.cginc" @@ -166,7 +168,7 @@ Shader "Custom/DNMST_Displace" { o.lmap.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; #ifdef DIRLIGHTMAP_OFF o.lmapFadePos.xyz = (mul(unity_ObjectToWorld, v.vertex).xyz - unity_ShadowFadeCenterAndType.xyz) * unity_ShadowFadeCenterAndType.w; - o.lmapFadePos.w = (-mul(UNITY_MATRIX_MV, v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); + o.lmapFadePos.w = (-UnityObjectToViewPos(v.vertex).z) * (1.0 - unity_ShadowFadeCenterAndType.w); #endif #else o.lmap.xy = 0; diff --git a/Assets/Shaders/Edit_Diffuse_Preview.shader b/Assets/Shaders/Edit_Diffuse_Preview.shader index b56564f3..f9e28d75 100644 --- a/Assets/Shaders/Edit_Diffuse_Preview.shader +++ b/Assets/Shaders/Edit_Diffuse_Preview.shader @@ -93,11 +93,11 @@ float darkMaskPow = saturate( ( _DarkMaskPow - 0.5 ) * 2.0 ) + 1; darkMaskPow -= 1.0 - ( 1.0 / ( saturate( ( _DarkMaskPow - 0.5 ) * -2.0 ) + 1.0) ); - mainTex = ( mainTex - avgColor); + mainTex = ( mainTex - avgColor);// half mainTexGrey = mainTex.x * 0.3 + mainTex.y * 0.5 + mainTex.z * 0.2; half3 mainTexHighMask = pow( clamp( mainTexGrey * 2.0, 0.001, 0.99 ), lightMaskPow ); half3 mainTexLowMask = pow( clamp( -mainTexGrey * 2.0, 0.001, 0.99 ), darkMaskPow ); - mainTex += 0.5; + mainTex += 0.215; //mainTex = clamp( mainTex, 0.001, 0.99 ); //mainTex = lerp( mainTex, pow( mainTex, _LightPow * 5.0 + 1.0 ), mainTexHighMask ); diff --git a/Assets/Shaders/Smoothness_Preview.shader b/Assets/Shaders/Smoothness_Preview.shader index f6dbd685..bc07417b 100644 --- a/Assets/Shaders/Smoothness_Preview.shader +++ b/Assets/Shaders/Smoothness_Preview.shader @@ -71,6 +71,8 @@ float _GamaCorrection; + int _Invert; + #include "Photoshop.cginc" // vertex-to-fragment interpolation data @@ -124,6 +126,7 @@ sample2Mask *= 1.0 / ( _HueWeight2 + _SatWeight2 + _LumWeight2 ); sample2Mask = smoothstep( _MaskLow2, _MaskHigh2, sample2Mask ); } + float finalSmoothness = _BaseSmoothness; finalSmoothness = lerp( finalSmoothness, _Sample2Smoothness, sample2Mask ); @@ -132,9 +135,13 @@ finalSmoothness *= clamp( overlayGrey * _BlurOverlay + 1.0, 0.0, 10.0 ); - finalSmoothness = saturate( ( finalSmoothness - 0.5 ) * _FinalContrast + 0.5 + _FinalBias ); - - finalSmoothness = saturate( finalSmoothness ); + if (_Invert == 1) { + finalSmoothness = saturate((finalSmoothness - 0.5) * ((_FinalContrast + 0.5) + _FinalBias) *-1); + } + else { + finalSmoothness = saturate((finalSmoothness - 0.5) * _FinalContrast + 0.5 + _FinalBias); + } + finalSmoothness = saturate( finalSmoothness ); if( _IsolateSample1 == 1 ){ finalSmoothness = sample1Mask; @@ -143,10 +150,12 @@ if( _IsolateSample2 == 1 ){ finalSmoothness = sample2Mask; } + float3 finalColor; - float3 finalColor = lerp( mainTex.xyz, finalSmoothness.xxx, smoothstep( _Slider - 0.01, _Slider + 0.01, UV.x ) ); + finalColor = lerp(mainTex.xyz, finalSmoothness.xxx, smoothstep(_Slider - 0.01, _Slider + 0.01, UV.x)); + - return float4( finalColor, 1 ); + return float4( finalColor , 1 ); } ENDCG diff --git a/Assets/Shaders/Spec_Rough_Preview.shader b/Assets/Shaders/Spec_Rough_Preview.shader index b85fa393..3d303f64 100644 --- a/Assets/Shaders/Spec_Rough_Preview.shader +++ b/Assets/Shaders/Spec_Rough_Preview.shader @@ -20,7 +20,10 @@ #pragma exclude_renderers nomrt #pragma multi_compile_prepassfinal + + #ifndef UNITY_PASS_DEFERRED #define UNITY_PASS_DEFERRED + #endif #include "HLSLSupport.cginc" #include "UnityShaderVariables.cginc" diff --git a/Assets/Shaders/SurfacePBS_Tess_Generated.shader b/Assets/Shaders/SurfacePBS_Tess_Generated.shader index 1b8636a3..a9f91d54 100644 --- a/Assets/Shaders/SurfacePBS_Tess_Generated.shader +++ b/Assets/Shaders/SurfacePBS_Tess_Generated.shader @@ -76,7 +76,10 @@ CGPROGRAM // reads from normal: no // 1 texcoords actually used // float2 _DiffuseMap + +#ifndef UNITY_PASS_FORWARDBASE #define UNITY_PASS_FORWARDBASE +#endif #include "UnityCG.cginc" #include "Lighting.cginc" #include "UnityPBSLighting.cginc" diff --git a/Assets/StandaloneFileBrowser/Plugins/Linux/x86_64/libStandaloneFileBrowser.so.meta b/Assets/StandaloneFileBrowser/Plugins/Linux/x86_64/libStandaloneFileBrowser.so.meta index f9256120..eebacda3 100644 --- a/Assets/StandaloneFileBrowser/Plugins/Linux/x86_64/libStandaloneFileBrowser.so.meta +++ b/Assets/StandaloneFileBrowser/Plugins/Linux/x86_64/libStandaloneFileBrowser.so.meta @@ -1,14 +1,15 @@ fileFormatVersion: 2 guid: b8c465928f1784a3fac8dc3766f7201c -timeCreated: 1538230728 -licenseType: Free PluginImporter: externalObjects: {} serializedVersion: 2 iconMap: {} executionOrder: {} + defineConstraints: [] isPreloaded: 0 isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 platformData: - first: '': Any @@ -77,7 +78,7 @@ PluginImporter: second: enabled: 1 settings: - CPU: x86_64 + CPU: AnyCPU - first: Standalone: LinuxUniversal second: diff --git a/Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib.meta b/Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib.meta index 9ba582be..ac86a87c 100644 --- a/Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib.meta +++ b/Assets/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib.meta @@ -5,8 +5,11 @@ PluginImporter: serializedVersion: 2 iconMap: {} executionOrder: {} + defineConstraints: [] isPreloaded: 0 isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 platformData: - first: '': Any @@ -61,7 +64,7 @@ PluginImporter: second: enabled: 0 settings: - CPU: x86_64 + CPU: AnyCPU - first: Standalone: LinuxUniversal second: diff --git a/Assets/StandaloneFileBrowser/SFB.asmdef b/Assets/StandaloneFileBrowser/SFB.asmdef new file mode 100644 index 00000000..1b7df8d7 --- /dev/null +++ b/Assets/StandaloneFileBrowser/SFB.asmdef @@ -0,0 +1,3 @@ +{ + "name": "SFB" +} diff --git a/Assets/StandaloneFileBrowser/SFB.asmdef.meta b/Assets/StandaloneFileBrowser/SFB.asmdef.meta new file mode 100644 index 00000000..96aec31f --- /dev/null +++ b/Assets/StandaloneFileBrowser/SFB.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4af013e9af55d0242926a03e5c4f9d09 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs index f352ad94..f24a3b67 100644 --- a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs +++ b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs @@ -46,9 +46,9 @@ private void OnClick() { #endif private IEnumerator OutputRoutine(string url) { -#pragma warning disable 618 +#pragma warning disable CS0618 // Type or member is obsolete, find how to fetch texture from UnityWebRequest var loader = new WWW(url); -#pragma warning restore 618 +#pragma warning restore CS0618 // Type or member is obsolete, find how to fetch texture from UnityWebRequest yield return loader; output.texture = loader.texture; } diff --git a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs index b5ed57e4..348cb083 100644 --- a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs +++ b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileText.cs @@ -46,9 +46,9 @@ private void OnClick() { #endif private IEnumerator OutputRoutine(string url) { -#pragma warning disable 618 +#pragma warning disable CS0618 // Type or member is obsolete var loader = new WWW(url); -#pragma warning restore 618 +#pragma warning restore CS0618 // Type or member is obsolete yield return loader; output.text = loader.text; } diff --git a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs index 0df2ea6f..b80fb80a 100644 --- a/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs +++ b/Assets/StandaloneFileBrowser/Sample/CanvasSampleOpenFileTextMultiple.cs @@ -6,7 +6,6 @@ using UnityEngine.UI; using UnityEngine.EventSystems; using SFB; -#pragma warning disable 618 [RequireComponent(typeof(Button))] public class CanvasSampleOpenFileTextMultiple : MonoBehaviour, IPointerDownHandler { @@ -54,7 +53,9 @@ private void OnClick() { private IEnumerator OutputRoutine(string[] urlArr) { var outputText = ""; for (int i = 0; i < urlArr.Length; i++) { +#pragma warning disable CS0618 // Type or member is obsolete var loader = new WWW(urlArr[i]); +#pragma warning restore CS0618 // Type or member is obsolete yield return loader; outputText += loader.text; } diff --git a/Assets/TextMesh Pro.meta b/Assets/TextMesh Pro.meta new file mode 100644 index 00000000..f9da8b5e --- /dev/null +++ b/Assets/TextMesh Pro.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f54d1bd14bd3ca042bd867b519fee8cc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Documentation.meta b/Assets/TextMesh Pro/Documentation.meta new file mode 100644 index 00000000..afa527ac --- /dev/null +++ b/Assets/TextMesh Pro/Documentation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8e7e8f5a82a3a134e91c54efd2274ea9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf b/Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf new file mode 100644 index 00000000..c2ea2d27 Binary files /dev/null and b/Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf differ diff --git a/Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf.meta b/Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf.meta new file mode 100644 index 00000000..e4afeef8 --- /dev/null +++ b/Assets/TextMesh Pro/Documentation/TextMesh Pro User Guide 2016.pdf.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1b8d251f9af63b746bf2f7ffe00ebb9b +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Fonts.meta b/Assets/TextMesh Pro/Fonts.meta new file mode 100644 index 00000000..f0c29724 --- /dev/null +++ b/Assets/TextMesh Pro/Fonts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6ab70aee4d56447429c680537fbf93ed +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt b/Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt new file mode 100644 index 00000000..f2473f9c --- /dev/null +++ b/Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt @@ -0,0 +1,46 @@ +Digitized data copyright (c) 2010 Google Corporation + with Reserved Font Arimo, Tinos and Cousine. +Copyright (c) 2012 Red Hat, Inc. + with Reserved Font Name Liberation. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the copyright statement(s). + +"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. + +5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. \ No newline at end of file diff --git a/Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt.meta b/Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt.meta new file mode 100644 index 00000000..fa60cea1 --- /dev/null +++ b/Assets/TextMesh Pro/Fonts/LiberationSans - OFL.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6e59c59b81ab47f9b6ec5781fa725d2c +timeCreated: 1484171296 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Fonts/LiberationSans.ttf b/Assets/TextMesh Pro/Fonts/LiberationSans.ttf new file mode 100644 index 00000000..626dd936 Binary files /dev/null and b/Assets/TextMesh Pro/Fonts/LiberationSans.ttf differ diff --git a/Assets/TextMesh Pro/Fonts/LiberationSans.ttf.meta b/Assets/TextMesh Pro/Fonts/LiberationSans.ttf.meta new file mode 100644 index 00000000..f2fc8140 --- /dev/null +++ b/Assets/TextMesh Pro/Fonts/LiberationSans.ttf.meta @@ -0,0 +1,19 @@ +fileFormatVersion: 2 +guid: e3265ab4bf004d28a9537516768c1c75 +timeCreated: 1484171297 +licenseType: Pro +TrueTypeFontImporter: + serializedVersion: 2 + fontSize: 16 + forceTextureCase: -2 + characterSpacing: 1 + characterPadding: 0 + includeFontData: 1 + use2xBehaviour: 0 + fontNames: [] + fallbackFontReferences: [] + customCharacters: + fontRenderingMode: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources.meta b/Assets/TextMesh Pro/Resources.meta new file mode 100644 index 00000000..cfc142f3 --- /dev/null +++ b/Assets/TextMesh Pro/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 243e06394e614e5d99fab26083b707fa +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials.meta b/Assets/TextMesh Pro/Resources/Fonts & Materials.meta new file mode 100644 index 00000000..8a011124 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Fonts & Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 731f1baa9d144a9897cb1d341c2092b8 +folderAsset: yes +timeCreated: 1442040525 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat new file mode 100644 index 00000000..5bc142c4 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat @@ -0,0 +1,106 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: LiberationSans SDF - Drop Shadow + m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3} + m_ShaderKeywords: OUTLINE_ON UNDERLAY_ON + m_LightmapFlags: 5 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Cube: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FaceTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 28684132378477856, guid: 8f586378b4e144a9851e7b34d9b748ee, + type: 2} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Ambient: 0.5 + - _Bevel: 0.5 + - _BevelClamp: 0 + - _BevelOffset: 0 + - _BevelRoundness: 0 + - _BevelWidth: 0 + - _BumpFace: 0 + - _BumpOutline: 0 + - _ColorMask: 15 + - _Diffuse: 0.5 + - _DiffusePower: 1 + - _FaceDilate: 0.1 + - _FaceUVSpeedX: 0 + - _FaceUVSpeedY: 0 + - _GlowInner: 0.05 + - _GlowOffset: 0 + - _GlowOuter: 0.05 + - _GlowPower: 0.75 + - _GradientScale: 10 + - _LightAngle: 3.1416 + - _MaskSoftnessX: 0 + - _MaskSoftnessY: 0 + - _OutlineSoftness: 0 + - _OutlineUVSpeedX: 0 + - _OutlineUVSpeedY: 0 + - _OutlineWidth: 0.1 + - _PerspectiveFilter: 0.875 + - _Reflectivity: 10 + - _ScaleRatioA: 0.9 + - _ScaleRatioB: 0.73125 + - _ScaleRatioC: 0.64125 + - _ScaleX: 1 + - _ScaleY: 1 + - _ShaderFlags: 0 + - _Sharpness: 0 + - _SpecularPower: 2 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _TextureHeight: 1024 + - _TextureWidth: 1024 + - _UnderlayDilate: 0 + - _UnderlayOffsetX: 0.5 + - _UnderlayOffsetY: -0.5 + - _UnderlaySoftness: 0.05 + - _VertexOffsetX: 0 + - _VertexOffsetY: 0 + - _WeightBold: 0.75 + - _WeightNormal: 0 + m_Colors: + - _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0} + - _FaceColor: {r: 1, g: 1, b: 1, a: 1} + - _GlowColor: {r: 0, g: 1, b: 0, a: 0.5} + - _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767} + - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1} + - _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecularColor: {r: 1, g: 1, b: 1, a: 1} + - _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5} diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat.meta b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat.meta new file mode 100644 index 00000000..fbd2cdb6 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Drop Shadow.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e73a58f6e2794ae7b1b7e50b7fb811b0 +timeCreated: 1484172806 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset new file mode 100644 index 00000000..00e1a36f --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset @@ -0,0 +1,337 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2180264 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: LiberationSans SDF Material + m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 1 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Cube: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FaceTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 28268798066460806} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Ambient: 0.5 + - _Bevel: 0.5 + - _BevelClamp: 0 + - _BevelOffset: 0 + - _BevelRoundness: 0 + - _BevelWidth: 0 + - _BumpFace: 0 + - _BumpOutline: 0 + - _BumpScale: 1 + - _ColorMask: 15 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _Diffuse: 0.5 + - _DstBlend: 0 + - _FaceDilate: 0 + - _FaceUVSpeedX: 0 + - _FaceUVSpeedY: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _GlowInner: 0.05 + - _GlowOffset: 0 + - _GlowOuter: 0.05 + - _GlowPower: 0.75 + - _GradientScale: 10 + - _LightAngle: 3.1416 + - _MaskSoftnessX: 0 + - _MaskSoftnessY: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _OutlineSoftness: 0 + - _OutlineUVSpeedX: 0 + - _OutlineUVSpeedY: 0 + - _OutlineWidth: 0 + - _Parallax: 0.02 + - _PerspectiveFilter: 0.875 + - _Reflectivity: 10 + - _ScaleRatioA: 0.90909094 + - _ScaleRatioB: 0.73125 + - _ScaleRatioC: 0.7386364 + - _ScaleX: 1 + - _ScaleY: 1 + - _ShaderFlags: 0 + - _Sharpness: 0 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SpecularPower: 2 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _TextureHeight: 512 + - _TextureWidth: 512 + - _UVSec: 0 + - _UnderlayDilate: 0 + - _UnderlayOffsetX: 0 + - _UnderlayOffsetY: 0 + - _UnderlaySoftness: 0 + - _VertexOffsetX: 0 + - _VertexOffsetY: 0 + - _WeightBold: 0.75 + - _WeightNormal: 0 + - _ZWrite: 1 + m_Colors: + - _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0} + - _FaceColor: {r: 1, g: 1, b: 1, a: 1} + - _GlowColor: {r: 0, g: 1, b: 0, a: 0.5} + - _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767} + - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1} + - _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecularColor: {r: 1, g: 1, b: 1, a: 1} + - _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5} +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71c1514a6bd24e1e882cebbe1904ce04, type: 3} + m_Name: LiberationSans SDF - Fallback + m_EditorClassIdentifier: + hashCode: -1699145518 + material: {fileID: 2180264} + materialHashCode: -1183942120 + m_Version: 1.1.0 + m_SourceFontFileGUID: e3265ab4bf004d28a9537516768c1c75 + m_SourceFontFile_EditorRef: {fileID: 12800000, guid: e3265ab4bf004d28a9537516768c1c75, + type: 3} + m_SourceFontFile: {fileID: 12800000, guid: e3265ab4bf004d28a9537516768c1c75, type: 3} + m_AtlasPopulationMode: 1 + m_FaceInfo: + m_FamilyName: Liberation Sans + m_StyleName: Regular + m_PointSize: 86 + m_Scale: 1 + m_LineHeight: 98.8916 + m_AscentLine: 77.853516 + m_CapLine: 59 + m_MeanLine: 45 + m_Baseline: 0 + m_DescentLine: -18.22461 + m_SuperscriptOffset: 77.853516 + m_SuperscriptSize: 0.5 + m_SubscriptOffset: -18.22461 + m_SubscriptSize: 0.5 + m_UnderlineOffset: -12.261719 + m_UnderlineThickness: 6.298828 + m_StrikethroughOffset: 18 + m_StrikethroughThickness: 6.298828 + m_TabWidth: 24 + m_GlyphTable: [] + m_CharacterTable: [] + m_AtlasTextures: + - {fileID: 28268798066460806} + m_AtlasTextureIndex: 0 + m_UsedGlyphRects: [] + m_FreeGlyphRects: + - m_X: 0 + m_Y: 0 + m_Width: 511 + m_Height: 511 + m_fontInfo: + Name: Liberation Sans + PointSize: 86 + Scale: 1 + CharacterCount: 250 + LineHeight: 98.90625 + Baseline: 0 + Ascender: 77.84375 + CapHeight: 59.1875 + Descender: -18.21875 + CenterLine: 0 + SuperscriptOffset: 77.84375 + SubscriptOffset: -12.261719 + SubSize: 0.5 + Underline: -12.261719 + UnderlineThickness: 6.298828 + strikethrough: 23.675 + strikethroughThickness: 0 + TabWidth: 239.0625 + Padding: 9 + AtlasWidth: 1024 + AtlasHeight: 1024 + atlas: {fileID: 0} + m_AtlasWidth: 512 + m_AtlasHeight: 512 + m_AtlasPadding: 9 + m_AtlasRenderMode: 4169 + m_glyphInfoList: [] + m_KerningTable: + kerningPairs: [] + m_FallbackFontAssetTable: [] + m_CreationSettings: + sourceFontFileName: + sourceFontFileGUID: e3265ab4bf004d28a9537516768c1c75 + pointSizeSamplingMode: 0 + pointSize: 86 + padding: 9 + packingMode: 4 + atlasWidth: 512 + atlasHeight: 512 + characterSetSelectionMode: 1 + characterSequence: 32 - 126, 160 - 255, 8192 - 8303, 8364, 8482, 9633 + referencedFontAssetGUID: 8f586378b4e144a9851e7b34d9b748ee + referencedTextAssetGUID: + fontStyle: 0 + fontStyleModifier: 0 + renderMode: 4169 + includeFontFeatures: 1 + m_FontWeightTable: + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + fontWeights: + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + - regularTypeface: {fileID: 0} + italicTypeface: {fileID: 0} + normalStyle: 0 + normalSpacingOffset: 0 + boldStyle: 0.75 + boldSpacing: 7 + italicStyle: 35 + tabSize: 10 +--- !u!28 &28268798066460806 +Texture2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: LiberationSans SDF Atlas + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 2 + m_Width: 0 + m_Height: 0 + m_CompleteImageSize: 0 + m_TextureFormat: 1 + m_MipCount: 1 + m_IsReadable: 1 + m_StreamingMipmaps: 0 + m_StreamingMipmapsPriority: 0 + m_AlphaIsTransparency: 0 + m_ImageCount: 1 + m_TextureDimension: 2 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 1 + m_MipBias: 0 + m_WrapU: 0 + m_WrapV: 0 + m_WrapW: 0 + m_LightmapFormat: 0 + m_ColorSpace: 0 + image data: 0 + _typelessdata: + m_StreamData: + offset: 0 + size: 0 + path: diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset.meta b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset.meta new file mode 100644 index 00000000..42dd6acd --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Fallback.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2e498d1c8094910479dc3e1b768306a4 +timeCreated: 1484171803 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat new file mode 100644 index 00000000..cca8ce89 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat @@ -0,0 +1,104 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: LiberationSans SDF - Outline + m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3} + m_ShaderKeywords: OUTLINE_ON + m_LightmapFlags: 5 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _Cube: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _FaceTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 28684132378477856, guid: 8f586378b4e144a9851e7b34d9b748ee, + type: 2} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OutlineTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Ambient: 0.5 + - _Bevel: 0.5 + - _BevelClamp: 0 + - _BevelOffset: 0 + - _BevelRoundness: 0 + - _BevelWidth: 0 + - _BumpFace: 0 + - _BumpOutline: 0 + - _ColorMask: 15 + - _Diffuse: 0.5 + - _FaceDilate: 0.1 + - _FaceUVSpeedX: 0 + - _FaceUVSpeedY: 0 + - _GlowInner: 0.05 + - _GlowOffset: 0 + - _GlowOuter: 0.05 + - _GlowPower: 0.75 + - _GradientScale: 10 + - _LightAngle: 3.1416 + - _MaskSoftnessX: 0 + - _MaskSoftnessY: 0 + - _OutlineSoftness: 0 + - _OutlineUVSpeedX: 0 + - _OutlineUVSpeedY: 0 + - _OutlineWidth: 0.1 + - _PerspectiveFilter: 0.875 + - _Reflectivity: 10 + - _ScaleRatioA: 0.9 + - _ScaleRatioB: 0.73125 + - _ScaleRatioC: 0.64125 + - _ScaleX: 1 + - _ScaleY: 1 + - _ShaderFlags: 0 + - _Sharpness: 0 + - _SpecularPower: 2 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _TextureHeight: 1024 + - _TextureWidth: 1024 + - _UnderlayDilate: 0 + - _UnderlayOffsetX: 0 + - _UnderlayOffsetY: 0 + - _UnderlaySoftness: 0 + - _VertexOffsetX: 0 + - _VertexOffsetY: 0 + - _WeightBold: 0.75 + - _WeightNormal: 0 + m_Colors: + - _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} + - _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0} + - _FaceColor: {r: 1, g: 1, b: 1, a: 1} + - _GlowColor: {r: 0, g: 1, b: 0, a: 0.5} + - _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767} + - _OutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1} + - _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecularColor: {r: 1, g: 1, b: 1, a: 1} + - _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5} diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat.meta b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat.meta new file mode 100644 index 00000000..88d63348 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF - Outline.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 79459efec17a4d00a321bdcc27bbc385 +timeCreated: 1484172856 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset new file mode 100644 index 00000000..f2896fcd Binary files /dev/null and b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset differ diff --git a/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset.meta b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset.meta new file mode 100644 index 00000000..66e69d18 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Fonts & Materials/LiberationSans SDF.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f586378b4e144a9851e7b34d9b748ee +timeCreated: 1484171803 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt b/Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt new file mode 100644 index 00000000..a52cc38f --- /dev/null +++ b/Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt @@ -0,0 +1 @@ +)]}〕〉》」』】〙〗〟’”⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、%,.:;。!?]):;=}¢°"†‡℃〆%,. \ No newline at end of file diff --git a/Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt.meta b/Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt.meta new file mode 100644 index 00000000..73ed6604 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/LineBreaking Following Characters.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fade42e8bc714b018fac513c043d323b +timeCreated: 1425440388 +licenseType: Store +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt b/Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt new file mode 100644 index 00000000..285696e0 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt @@ -0,0 +1 @@ +([{〔〈《「『【〘〖〝‘“⦅«$—…‥〳〴〵\[({£¥"々〇〉》」$⦆¥₩ # \ No newline at end of file diff --git a/Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt.meta b/Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt.meta new file mode 100644 index 00000000..cc684b30 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/LineBreaking Leading Characters.txt.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d82c1b31c7e74239bff1220585707d2b +timeCreated: 1425440388 +licenseType: Store +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders.meta b/Assets/TextMesh Pro/Resources/Shaders.meta new file mode 100644 index 00000000..622b295a --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 99f836c9cb9345dba2e72c4a1f2d0695 +folderAsset: yes +timeCreated: 1436068007 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Custom-Atlas.shader b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Custom-Atlas.shader new file mode 100644 index 00000000..c130a166 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Custom-Atlas.shader @@ -0,0 +1,142 @@ +Shader "TextMeshPro/Bitmap Custom Atlas" { + +Properties { + _MainTex ("Font Atlas", 2D) = "white" {} + _FaceTex ("Font Texture", 2D) = "white" {} + _FaceColor ("Text Color", Color) = (1,1,1,1) + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _ClipRect("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _Padding ("Padding", float) = 0 + + _StencilComp("Stencil Comparison", Float) = 8 + _Stencil("Stencil ID", Float) = 0 + _StencilOp("Stencil Operation", Float) = 0 + _StencilWriteMask("Stencil Write Mask", Float) = 255 + _StencilReadMask("Stencil Read Mask", Float) = 255 + + _ColorMask("Color Mask", Float) = 15 +} + +SubShader{ + + Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } + + Stencil + { + Ref[_Stencil] + Comp[_StencilComp] + Pass[_StencilOp] + ReadMask[_StencilReadMask] + WriteMask[_StencilWriteMask] + } + + + Lighting Off + Cull [_CullMode] + ZTest [unity_GUIZTestMode] + ZWrite Off + Fog { Mode Off } + Blend SrcAlpha OneMinusSrcAlpha + ColorMask[_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + + #include "UnityCG.cginc" + + struct appdata_t { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct v2f { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + float4 mask : TEXCOORD2; + }; + + uniform sampler2D _MainTex; + uniform sampler2D _FaceTex; + uniform float4 _FaceTex_ST; + uniform fixed4 _FaceColor; + + uniform float _VertexOffsetX; + uniform float _VertexOffsetY; + uniform float4 _ClipRect; + uniform float _MaskSoftnessX; + uniform float _MaskSoftnessY; + + float2 UnpackUV(float uv) + { + float2 output; + output.x = floor(uv / 4096); + output.y = uv - 4096 * output.x; + + return output * 0.001953125; + } + + v2f vert (appdata_t v) + { + float4 vert = v.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + + vert.xy += (vert.w * 0.5) / _ScreenParams.xy; + + float4 vPosition = UnityPixelSnap(UnityObjectToClipPos(vert)); + + fixed4 faceColor = v.color; + faceColor *= _FaceColor; + + v2f OUT; + OUT.vertex = vPosition; + OUT.color = faceColor; + OUT.texcoord0 = v.texcoord0; + OUT.texcoord1 = TRANSFORM_TEX(UnpackUV(v.texcoord1), _FaceTex); + float2 pixelSize = vPosition.w; + pixelSize /= abs(float2(_ScreenParams.x * UNITY_MATRIX_P[0][0], _ScreenParams.y * UNITY_MATRIX_P[1][1])); + + // Clamp _ClipRect to 16bit. + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + + return OUT; + } + + fixed4 frag (v2f IN) : SV_Target + { + fixed4 color = tex2D(_MainTex, IN.texcoord0) * tex2D(_FaceTex, IN.texcoord1) * IN.color; + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); + color *= m.x * m.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip(color.a - 0.001); + #endif + + return color; + } + ENDCG + } +} + + CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" +} diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta new file mode 100644 index 00000000..ffea03c2 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Custom-Atlas.shader.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 48bb5f55d8670e349b6e614913f9d910 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Mobile.shader b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Mobile.shader new file mode 100644 index 00000000..1517a122 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Mobile.shader @@ -0,0 +1,144 @@ +Shader "TextMeshPro/Mobile/Bitmap" { + +Properties { + _MainTex ("Font Atlas", 2D) = "white" {} + _Color ("Text Color", Color) = (1,1,1,1) + _DiffusePower ("Diffuse Power", Range(1.0,4.0)) = 1.0 + + _VertexOffsetX("Vertex OffsetX", float) = 0 + _VertexOffsetY("Vertex OffsetY", float) = 0 + _MaskSoftnessX("Mask SoftnessX", float) = 0 + _MaskSoftnessY("Mask SoftnessY", float) = 0 + + _ClipRect("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + + _StencilComp("Stencil Comparison", Float) = 8 + _Stencil("Stencil ID", Float) = 0 + _StencilOp("Stencil Operation", Float) = 0 + _StencilWriteMask("Stencil Write Mask", Float) = 255 + _StencilReadMask("Stencil Read Mask", Float) = 255 + + _ColorMask("Color Mask", Float) = 15 +} + +SubShader { + + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + + Stencil + { + Ref[_Stencil] + Comp[_StencilComp] + Pass[_StencilOp] + ReadMask[_StencilReadMask] + WriteMask[_StencilWriteMask] + } + + + Lighting Off + Cull Off + ZTest [unity_GUIZTestMode] + ZWrite Off + Fog { Mode Off } + Blend SrcAlpha OneMinusSrcAlpha + ColorMask[_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma fragmentoption ARB_precision_hint_fastest + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + + #include "UnityCG.cginc" + + struct appdata_t { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct v2f { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float4 mask : TEXCOORD2; + }; + + sampler2D _MainTex; + fixed4 _Color; + float _DiffusePower; + + uniform float _VertexOffsetX; + uniform float _VertexOffsetY; + uniform float4 _ClipRect; + uniform float _MaskSoftnessX; + uniform float _MaskSoftnessY; + + v2f vert (appdata_t v) + { + v2f OUT; + float4 vert = v.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + + vert.xy += (vert.w * 0.5) / _ScreenParams.xy; + + OUT.vertex = UnityPixelSnap(UnityObjectToClipPos(vert)); + OUT.color = v.color; + OUT.color *= _Color; + OUT.color.rgb *= _DiffusePower; + OUT.texcoord0 = v.texcoord0; + + float2 pixelSize = OUT.vertex.w; + //pixelSize /= abs(float2(_ScreenParams.x * UNITY_MATRIX_P[0][0], _ScreenParams.y * UNITY_MATRIX_P[1][1])); + + // Clamp _ClipRect to 16bit. + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + + return OUT; + } + + fixed4 frag (v2f IN) : COLOR + { + fixed4 color = fixed4(IN.color.rgb, IN.color.a * tex2D(_MainTex, IN.texcoord0).a); + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); + color *= m.x * m.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip(color.a - 0.001); + #endif + + return color; + } + ENDCG + } +} + +SubShader { + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + Lighting Off Cull Off ZTest Always ZWrite Off Fog { Mode Off } + Blend SrcAlpha OneMinusSrcAlpha + BindChannels { + Bind "Color", color + Bind "Vertex", vertex + Bind "TexCoord", texcoord0 + } + Pass { + SetTexture [_MainTex] { + constantColor [_Color] combine constant * primary, constant * texture + } + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" +} diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Mobile.shader.meta b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Mobile.shader.meta new file mode 100644 index 00000000..8d516c0b --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap-Mobile.shader.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1e3b057af24249748ff873be7fafee47 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap.shader b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap.shader new file mode 100644 index 00000000..f4e324ad --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap.shader @@ -0,0 +1,142 @@ +Shader "TextMeshPro/Bitmap" { + +Properties { + _MainTex ("Font Atlas", 2D) = "white" {} + _FaceTex ("Font Texture", 2D) = "white" {} + _FaceColor ("Text Color", Color) = (1,1,1,1) + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _ClipRect("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + + _StencilComp("Stencil Comparison", Float) = 8 + _Stencil("Stencil ID", Float) = 0 + _StencilOp("Stencil Operation", Float) = 0 + _StencilWriteMask("Stencil Write Mask", Float) = 255 + _StencilReadMask("Stencil Read Mask", Float) = 255 + + _ColorMask("Color Mask", Float) = 15 +} + +SubShader{ + + Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } + + Stencil + { + Ref[_Stencil] + Comp[_StencilComp] + Pass[_StencilOp] + ReadMask[_StencilReadMask] + WriteMask[_StencilWriteMask] + } + + + Lighting Off + Cull [_CullMode] + ZTest [unity_GUIZTestMode] + ZWrite Off + Fog { Mode Off } + Blend SrcAlpha OneMinusSrcAlpha + ColorMask[_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + + #include "UnityCG.cginc" + + struct appdata_t { + float4 vertex : POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct v2f { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + float4 mask : TEXCOORD2; + }; + + uniform sampler2D _MainTex; + uniform sampler2D _FaceTex; + uniform float4 _FaceTex_ST; + uniform fixed4 _FaceColor; + + uniform float _VertexOffsetX; + uniform float _VertexOffsetY; + uniform float4 _ClipRect; + uniform float _MaskSoftnessX; + uniform float _MaskSoftnessY; + + float2 UnpackUV(float uv) + { + float2 output; + output.x = floor(uv / 4096); + output.y = uv - 4096 * output.x; + + return output * 0.001953125; + } + + v2f vert (appdata_t v) + { + float4 vert = v.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + + vert.xy += (vert.w * 0.5) / _ScreenParams.xy; + + float4 vPosition = UnityPixelSnap(UnityObjectToClipPos(vert)); + + fixed4 faceColor = v.color; + faceColor *= _FaceColor; + + v2f OUT; + OUT.vertex = vPosition; + OUT.color = faceColor; + OUT.texcoord0 = v.texcoord0; + OUT.texcoord1 = TRANSFORM_TEX(UnpackUV(v.texcoord1), _FaceTex); + float2 pixelSize = vPosition.w; + pixelSize /= abs(float2(_ScreenParams.x * UNITY_MATRIX_P[0][0], _ScreenParams.y * UNITY_MATRIX_P[1][1])); + + // Clamp _ClipRect to 16bit. + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + OUT.mask = float4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + + return OUT; + } + + fixed4 frag (v2f IN) : SV_Target + { + fixed4 color = tex2D(_MainTex, IN.texcoord0); + color = fixed4 (tex2D(_FaceTex, IN.texcoord1).rgb * IN.color.rgb, IN.color.a * color.a); + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(IN.mask.xy)) * IN.mask.zw); + color *= m.x * m.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip(color.a - 0.001); + #endif + + return color; + } + ENDCG + } +} + + CustomEditor "TMPro.EditorUtilities.TMP_BitmapShaderGUI" +} diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap.shader.meta b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap.shader.meta new file mode 100644 index 00000000..2d5438f6 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_Bitmap.shader.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 128e987d567d4e2c824d754223b3f3b0 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF Overlay.shader b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF Overlay.shader new file mode 100644 index 00000000..657da4cf --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF Overlay.shader @@ -0,0 +1,305 @@ +Shader "TextMeshPro/Distance Field Overlay" { + +Properties { + _FaceTex ("Face Texture", 2D) = "white" {} + _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0 + _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0 + _FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + _OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineTex ("Outline Texture", 2D) = "white" {} + _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0 + _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0 + _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + _Bevel ("Bevel", Range(0,1)) = 0.5 + _BevelOffset ("Bevel Offset", Range(-0.5,0.5)) = 0 + _BevelWidth ("Bevel Width", Range(-.5,0.5)) = 0 + _BevelClamp ("Bevel Clamp", Range(0,1)) = 0 + _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0 + + _LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416 + _SpecularColor ("Specular", Color) = (1,1,1,1) + _SpecularPower ("Specular", Range(0,4)) = 2.0 + _Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10 + _Diffuse ("Diffuse", Range(0,1)) = 0.5 + _Ambient ("Ambient", Range(1,0)) = 0.5 + + _BumpMap ("Normal map", 2D) = "bump" {} + _BumpOutline ("Bump Outline", Range(0,1)) = 0 + _BumpFace ("Bump Face", Range(0,1)) = 0 + + _ReflectFaceColor ("Reflection Color", Color) = (0,0,0,1) + _ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1) + _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } + _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) + + + _UnderlayColor ("Border Color", Color) = (0,0,0, 0.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + _GlowColor ("Color", Color) = (0, 1, 0, 0.5) + _GlowOffset ("Offset", Range(-1,1)) = 0 + _GlowInner ("Inner", Range(0,1)) = 0.05 + _GlowOuter ("Outer", Range(0,1)) = 0.05 + _GlowPower ("Falloff", Range(1, 0)) = 0.75 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = 0.5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5.0 + _ScaleX ("Scale X", float) = 1.0 + _ScaleY ("Scale Y", float) = 1.0 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767) + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + + Tags + { + "Queue"="Overlay" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest Always + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass { + CGPROGRAM + #pragma target 3.0 + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ BEVEL_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + #pragma shader_feature __ GLOW_ON + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + #include "TMPro.cginc" + + struct vertex_t { + float4 position : POSITION; + float3 normal : NORMAL; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + + struct pixel_t { + float4 position : SV_POSITION; + fixed4 color : COLOR; + float2 atlas : TEXCOORD0; // Atlas + float4 param : TEXCOORD1; // alphaClip, scale, bias, weight + float4 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw) + float3 viewDir : TEXCOORD3; + + #if (UNDERLAY_ON || UNDERLAY_INNER) + float4 texcoord2 : TEXCOORD4; // u,v, scale, bias + fixed4 underlayColor : COLOR1; + #endif + float4 textures : TEXCOORD5; + }; + + // Used by Unity internally to handle Texture Tiling and Offset. + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + + pixel_t VertShader(vertex_t input) + { + float bold = step(input.texcoord1.y, 0); + + float4 vert = input.position; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + float4 vPosition = UnityObjectToClipPos(vert); + + float2 pixelSize = vPosition.w; + pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + float scale = rsqrt(dot(pixelSize, pixelSize)); + scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); + if (UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); + + float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; + weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; + + float bias =(.5 - weight) + (.5 / scale); + + float alphaClip = (1.0 - _OutlineWidth*_ScaleRatioA - _OutlineSoftness*_ScaleRatioA); + + #if GLOW_ON + alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB); + #endif + + alphaClip = alphaClip / 2.0 - ( .5 / scale) - weight; + + #if (UNDERLAY_ON || UNDERLAY_INNER) + float4 underlayColor = _UnderlayColor; + underlayColor.rgb *= underlayColor.a; + + float bScale = scale; + bScale /= 1 + ((_UnderlaySoftness*_ScaleRatioC) * bScale); + float bBias = (0.5 - weight) * bScale - 0.5 - ((_UnderlayDilate * _ScaleRatioC) * 0.5 * bScale); + + float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; + float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; + float2 bOffset = float2(x, y); + #endif + + // Generate UV for the Masking Texture + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + + // Support for texture tiling and offset + float2 textureUV = UnpackUV(input.texcoord1.x); + float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex); + float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex); + + pixel_t output = { + vPosition, + input.color, + input.texcoord0, + float4(alphaClip, scale, bias, weight), + half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)), + mul((float3x3)_EnvMatrix, _WorldSpaceCameraPos.xyz - mul(unity_ObjectToWorld, vert).xyz), + #if (UNDERLAY_ON || UNDERLAY_INNER) + float4(input.texcoord0 + bOffset, bScale, bBias), + underlayColor, + #endif + float4(faceUV, outlineUV), + }; + + return output; + } + + + fixed4 PixShader(pixel_t input) : SV_Target + { + float c = tex2D(_MainTex, input.atlas).a; + + #ifndef UNDERLAY_ON + clip(c - input.param.x); + #endif + + float scale = input.param.y; + float bias = input.param.z; + float weight = input.param.w; + float sd = (bias - c) * scale; + + float outline = (_OutlineWidth * _ScaleRatioA) * scale; + float softness = (_OutlineSoftness * _ScaleRatioA) * scale; + + half4 faceColor = _FaceColor; + half4 outlineColor = _OutlineColor; + + faceColor.rgb *= input.color.rgb; + + faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y); + outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y); + + faceColor = GetColor(sd, faceColor, outlineColor, outline, softness); + + #if BEVEL_ON + float3 dxy = float3(0.5 / _TextureWidth, 0.5 / _TextureHeight, 0); + float3 n = GetSurfaceNormal(input.atlas, weight, dxy); + + float3 bump = UnpackNormal(tex2D(_BumpMap, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y)).xyz; + bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5)); + n = normalize(n- bump); + + float3 light = normalize(float3(sin(_LightAngle), cos(_LightAngle), -1.0)); + + float3 col = GetSpecular(n, light); + faceColor.rgb += col*faceColor.a; + faceColor.rgb *= 1-(dot(n, light)*_Diffuse); + faceColor.rgb *= lerp(_Ambient, 1, n.z*n.z); + + fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDir, -n)); + faceColor.rgb += reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a; + #endif + + #if UNDERLAY_ON + float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z; + faceColor += input.underlayColor * saturate(d - input.texcoord2.w) * (1 - faceColor.a); + #endif + + #if UNDERLAY_INNER + float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z; + faceColor += input.underlayColor * (1 - saturate(d - input.texcoord2.w)) * saturate(1 - sd) * (1 - faceColor.a); + #endif + + #if GLOW_ON + float4 glowColor = GetGlowColor(sd, scale); + faceColor.rgb += glowColor.rgb * glowColor.a; + #endif + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); + faceColor *= m.x * m.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip(faceColor.a - 0.001); + #endif + + return faceColor * input.color.a; + } + + ENDCG + } +} + +Fallback "TextMeshPro/Mobile/Distance Field" +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF Overlay.shader.meta b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF Overlay.shader.meta new file mode 100644 index 00000000..6c8679f4 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF Overlay.shader.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: dd89cf5b9246416f84610a006f916af7 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Masking.shader b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Masking.shader new file mode 100644 index 00000000..9147630b --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Masking.shader @@ -0,0 +1,246 @@ +// Simplified SDF shader: +// - No Shading Option (bevel / bump / env map) +// - No Glow Option +// - Softness is applied on both side of the outline + +Shader "TextMeshPro/Mobile/Distance Field - Masking" { + +Properties { + _FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + _OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineWidth ("Outline Thickness", Range(0,1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + _UnderlayColor ("Border Color", Color) = (0,0,0,.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = .5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5 + _ScaleX ("Scale X", float) = 1 + _ScaleY ("Scale Y", float) = 1 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + _MaskTex ("Mask Texture", 2D) = "white" {} + _MaskInverse ("Inverse", float) = 0 + _MaskEdgeColor ("Edge Color", Color) = (1,1,1,1) + _MaskEdgeSoftness ("Edge Softness", Range(0, 1)) = 0.01 + _MaskWipeControl ("Wipe Position", Range(0, 1)) = 0.5 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest [unity_GUIZTestMode] + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ OUTLINE_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + + struct vertex_t { + float4 vertex : POSITION; + float3 normal : NORMAL; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct pixel_t { + float4 vertex : SV_POSITION; + fixed4 faceColor : COLOR; + fixed4 outlineColor : COLOR1; + float4 texcoord0 : TEXCOORD0; // Texture UV, Mask UV + half4 param : TEXCOORD1; // Scale(x), BiasIn(y), BiasOut(z), Bias(w) + half4 mask : TEXCOORD2; // Position in clip space(xy), Softness(zw) + #if (UNDERLAY_ON | UNDERLAY_INNER) + float4 texcoord1 : TEXCOORD3; // Texture UV, alpha, reserved + half2 underlayParam : TEXCOORD4; // Scale(x), Bias(y) + #endif + }; + + float _MaskWipeControl; + float _MaskEdgeSoftness; + fixed4 _MaskEdgeColor; + bool _MaskInverse; + + pixel_t VertShader(vertex_t input) + { + float bold = step(input.texcoord1.y, 0); + + float4 vert = input.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + float4 vPosition = UnityObjectToClipPos(vert); + + float2 pixelSize = vPosition.w; + pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + + float scale = rsqrt(dot(pixelSize, pixelSize)); + scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); + if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); + + float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; + weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; + + float layerScale = scale; + + scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale); + float bias = (0.5 - weight) * scale - 0.5; + float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale; + + float opacity = input.color.a; + #if (UNDERLAY_ON | UNDERLAY_INNER) + opacity = 1.0; + #endif + + fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; + faceColor.rgb *= faceColor.a; + + fixed4 outlineColor = _OutlineColor; + outlineColor.a *= opacity; + outlineColor.rgb *= outlineColor.a; + outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); + + #if (UNDERLAY_ON | UNDERLAY_INNER) + + layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale); + float layerBias = (.5 - weight) * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale); + + float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; + float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; + float2 layerOffset = float2(x, y); + #endif + + // Generate UV for the Masking Texture + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + + // Structure for pixel shader + pixel_t output = { + vPosition, + faceColor, + outlineColor, + float4(input.texcoord0.x, input.texcoord0.y, maskUV.x, maskUV.y), + half4(scale, bias - outline, bias + outline, bias), + half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)), + #if (UNDERLAY_ON | UNDERLAY_INNER) + float4(input.texcoord0 + layerOffset, input.color.a, 0), + half2(layerScale, layerBias), + #endif + }; + + return output; + } + + + // PIXEL SHADER + fixed4 PixShader(pixel_t input) : SV_Target + { + half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x; + half4 c = input.faceColor * saturate(d - input.param.w); + + #ifdef OUTLINE_ON + c = lerp(input.outlineColor, input.faceColor, saturate(d - input.param.z)); + c *= saturate(d - input.param.y); + #endif + + #if UNDERLAY_ON + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - input.underlayParam.y) * (1 - c.a); + #endif + + #if UNDERLAY_INNER + half sd = saturate(d - input.param.z); + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - input.underlayParam.y)) * sd * (1 - c.a); + #endif + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); + c *= m.x * m.y; + #endif + + float a = abs(_MaskInverse - tex2D(_MaskTex, input.texcoord0.zw).a); + float t = a + (1 - _MaskWipeControl) * _MaskEdgeSoftness - _MaskWipeControl; + a = saturate(t / _MaskEdgeSoftness); + c.rgb = lerp(_MaskEdgeColor.rgb*c.a, c.rgb, a); + c *= a; + + #if (UNDERLAY_ON | UNDERLAY_INNER) + c *= input.texcoord1.z; + #endif + + #if UNITY_UI_ALPHACLIP + clip(c.a - 0.001); + #endif + + return c; + } + ENDCG + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Masking.shader.meta b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Masking.shader.meta new file mode 100644 index 00000000..dbfc71af --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Masking.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: bc1ede39bf3643ee8e493720e4259791 +timeCreated: 1463704911 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Overlay.shader b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Overlay.shader new file mode 100644 index 00000000..bf6ae1a9 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Overlay.shader @@ -0,0 +1,230 @@ +// Simplified SDF shader: +// - No Shading Option (bevel / bump / env map) +// - No Glow Option +// - Softness is applied on both side of the outline + +Shader "TextMeshPro/Mobile/Distance Field Overlay" { + +Properties { + _FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + _OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineWidth ("Outline Thickness", Range(0,1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + _UnderlayColor ("Border Color", Color) = (0,0,0,.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = .5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5 + _ScaleX ("Scale X", float) = 1 + _ScaleY ("Scale Y", float) = 1 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + Tags + { + "Queue"="Overlay" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest Always + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ OUTLINE_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + + struct vertex_t { + float4 vertex : POSITION; + float3 normal : NORMAL; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct pixel_t { + float4 vertex : SV_POSITION; + fixed4 faceColor : COLOR; + fixed4 outlineColor : COLOR1; + float4 texcoord0 : TEXCOORD0; // Texture UV, Mask UV + half4 param : TEXCOORD1; // Scale(x), BiasIn(y), BiasOut(z), Bias(w) + half4 mask : TEXCOORD2; // Position in clip space(xy), Softness(zw) + #if (UNDERLAY_ON | UNDERLAY_INNER) + float4 texcoord1 : TEXCOORD3; // Texture UV, alpha, reserved + half2 underlayParam : TEXCOORD4; // Scale(x), Bias(y) + #endif + }; + + + pixel_t VertShader(vertex_t input) + { + float bold = step(input.texcoord1.y, 0); + + float4 vert = input.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + float4 vPosition = UnityObjectToClipPos(vert); + + float2 pixelSize = vPosition.w; + pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + + float scale = rsqrt(dot(pixelSize, pixelSize)); + scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); + if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); + + float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; + weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; + + float layerScale = scale; + + scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale); + float bias = (0.5 - weight) * scale - 0.5; + float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale; + + float opacity = input.color.a; + #if (UNDERLAY_ON | UNDERLAY_INNER) + opacity = 1.0; + #endif + + fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; + faceColor.rgb *= faceColor.a; + + fixed4 outlineColor = _OutlineColor; + outlineColor.a *= opacity; + outlineColor.rgb *= outlineColor.a; + outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); + + #if (UNDERLAY_ON | UNDERLAY_INNER) + + layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale); + float layerBias = (.5 - weight) * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale); + + float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; + float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; + float2 layerOffset = float2(x, y); + #endif + + // Generate UV for the Masking Texture + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + + // Structure for pixel shader + pixel_t output = { + vPosition, + faceColor, + outlineColor, + float4(input.texcoord0.x, input.texcoord0.y, maskUV.x, maskUV.y), + half4(scale, bias - outline, bias + outline, bias), + half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)), + #if (UNDERLAY_ON | UNDERLAY_INNER) + float4(input.texcoord0 + layerOffset, input.color.a, 0), + half2(layerScale, layerBias), + #endif + }; + + return output; + } + + + // PIXEL SHADER + fixed4 PixShader(pixel_t input) : SV_Target + { + half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x; + half4 c = input.faceColor * saturate(d - input.param.w); + + #ifdef OUTLINE_ON + c = lerp(input.outlineColor, input.faceColor, saturate(d - input.param.z)); + c *= saturate(d - input.param.y); + #endif + + #if UNDERLAY_ON + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - input.underlayParam.y) * (1 - c.a); + #endif + + #if UNDERLAY_INNER + half sd = saturate(d - input.param.z); + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - input.underlayParam.y)) * sd * (1 - c.a); + #endif + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); + c *= m.x * m.y; + #endif + + #if (UNDERLAY_ON | UNDERLAY_INNER) + c *= input.texcoord1.z; + #endif + + #if UNITY_UI_ALPHACLIP + clip(c.a - 0.001); + #endif + + return c; + } + ENDCG + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Overlay.shader.meta b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Overlay.shader.meta new file mode 100644 index 00000000..29cbfccd --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile Overlay.shader.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a02a7d8c237544f1962732b55a9aebf1 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile.shader b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile.shader new file mode 100644 index 00000000..2e68107e --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile.shader @@ -0,0 +1,239 @@ +// Simplified SDF shader: +// - No Shading Option (bevel / bump / env map) +// - No Glow Option +// - Softness is applied on both side of the outline + +Shader "TextMeshPro/Mobile/Distance Field" { + +Properties { + _FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + _OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineWidth ("Outline Thickness", Range(0,1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + _UnderlayColor ("Border Color", Color) = (0,0,0,.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = .5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5 + _ScaleX ("Scale X", float) = 1 + _ScaleY ("Scale Y", float) = 1 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest [unity_GUIZTestMode] + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass { + CGPROGRAM + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ OUTLINE_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + + struct vertex_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + float4 vertex : POSITION; + float3 normal : NORMAL; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + struct pixel_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + float4 vertex : SV_POSITION; + fixed4 faceColor : COLOR; + fixed4 outlineColor : COLOR1; + float4 texcoord0 : TEXCOORD0; // Texture UV, Mask UV + half4 param : TEXCOORD1; // Scale(x), BiasIn(y), BiasOut(z), Bias(w) + half4 mask : TEXCOORD2; // Position in clip space(xy), Softness(zw) + #if (UNDERLAY_ON | UNDERLAY_INNER) + float4 texcoord1 : TEXCOORD3; // Texture UV, alpha, reserved + half2 underlayParam : TEXCOORD4; // Scale(x), Bias(y) + #endif + }; + + + pixel_t VertShader(vertex_t input) + { + pixel_t output; + + UNITY_INITIALIZE_OUTPUT(pixel_t, output); + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + float bold = step(input.texcoord1.y, 0); + + float4 vert = input.vertex; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + float4 vPosition = UnityObjectToClipPos(vert); + + float2 pixelSize = vPosition.w; + pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + + float scale = rsqrt(dot(pixelSize, pixelSize)); + scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); + if(UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); + + float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; + weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; + + float layerScale = scale; + + scale /= 1 + (_OutlineSoftness * _ScaleRatioA * scale); + float bias = (0.5 - weight) * scale - 0.5; + float outline = _OutlineWidth * _ScaleRatioA * 0.5 * scale; + + float opacity = input.color.a; + #if (UNDERLAY_ON | UNDERLAY_INNER) + opacity = 1.0; + #endif + + fixed4 faceColor = fixed4(input.color.rgb, opacity) * _FaceColor; + faceColor.rgb *= faceColor.a; + + fixed4 outlineColor = _OutlineColor; + outlineColor.a *= opacity; + outlineColor.rgb *= outlineColor.a; + outlineColor = lerp(faceColor, outlineColor, sqrt(min(1.0, (outline * 2)))); + + #if (UNDERLAY_ON | UNDERLAY_INNER) + layerScale /= 1 + ((_UnderlaySoftness * _ScaleRatioC) * layerScale); + float layerBias = (.5 - weight) * layerScale - .5 - ((_UnderlayDilate * _ScaleRatioC) * .5 * layerScale); + + float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; + float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; + float2 layerOffset = float2(x, y); + #endif + + // Generate UV for the Masking Texture + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + + // Populate structure for pixel shader + output.vertex = vPosition; + output.faceColor = faceColor; + output.outlineColor = outlineColor; + output.texcoord0 = float4(input.texcoord0.x, input.texcoord0.y, maskUV.x, maskUV.y); + output.param = half4(scale, bias - outline, bias + outline, bias); + output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + #if (UNDERLAY_ON || UNDERLAY_INNER) + output.texcoord1 = float4(input.texcoord0 + layerOffset, input.color.a, 0); + output.underlayParam = half2(layerScale, layerBias); + #endif + + return output; + } + + + // PIXEL SHADER + fixed4 PixShader(pixel_t input) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + + half d = tex2D(_MainTex, input.texcoord0.xy).a * input.param.x; + half4 c = input.faceColor * saturate(d - input.param.w); + + #ifdef OUTLINE_ON + c = lerp(input.outlineColor, input.faceColor, saturate(d - input.param.z)); + c *= saturate(d - input.param.y); + #endif + + #if UNDERLAY_ON + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * saturate(d - input.underlayParam.y) * (1 - c.a); + #endif + + #if UNDERLAY_INNER + half sd = saturate(d - input.param.z); + d = tex2D(_MainTex, input.texcoord1.xy).a * input.underlayParam.x; + c += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - input.underlayParam.y)) * sd * (1 - c.a); + #endif + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); + c *= m.x * m.y; + #endif + + #if (UNDERLAY_ON | UNDERLAY_INNER) + c *= input.texcoord1.z; + #endif + + #if UNITY_UI_ALPHACLIP + clip(c.a - 0.001); + #endif + + return c; + } + ENDCG + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile.shader.meta b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile.shader.meta new file mode 100644 index 00000000..3db6338b --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Mobile.shader.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fe393ace9b354375a9cb14cdbbc28be4 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface-Mobile.shader b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface-Mobile.shader new file mode 100644 index 00000000..8eaba650 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface-Mobile.shader @@ -0,0 +1,137 @@ +// Simplified version of the SDF Surface shader : +// - No support for Bevel, Bump or envmap +// - Diffuse only lighting +// - Fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH. + +Shader "TextMeshPro/Mobile/Distance Field (Surface)" { + +Properties { + _FaceTex ("Fill Texture", 2D) = "white" {} + _FaceColor ("Fill Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + _OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineTex ("Outline Texture", 2D) = "white" {} + _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + _GlowColor ("Color", Color) = (0, 1, 0, 0.5) + _GlowOffset ("Offset", Range(-1,1)) = 0 + _GlowInner ("Inner", Range(0,1)) = 0.05 + _GlowOuter ("Outer", Range(0,1)) = 0.05 + _GlowPower ("Falloff", Range(1, 0)) = 0.75 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = 0.5 + + // Should not be directly exposed to the user + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5.0 + _ScaleX ("Scale X", float) = 1.0 + _ScaleY ("Scale Y", float) = 1.0 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + //_MaskCoord ("Mask Coords", vector) = (0,0,0,0) + //_MaskSoftness ("Mask Softness", float) = 0 +} + +SubShader { + + Tags { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + LOD 300 + Cull [_CullMode] + + CGPROGRAM + #pragma surface PixShader Lambert alpha:blend vertex:VertShader noforwardadd nolightmap nodirlightmap + #pragma target 3.0 + #pragma shader_feature __ GLOW_ON + + #include "TMPro_Properties.cginc" + #include "TMPro.cginc" + + half _FaceShininess; + half _OutlineShininess; + + struct Input + { + fixed4 color : COLOR; + float2 uv_MainTex; + float2 uv2_FaceTex; + float2 uv2_OutlineTex; + float2 param; // Weight, Scale + float3 viewDirEnv; + }; + + #include "TMPro_Surface.cginc" + + ENDCG + + // Pass to render object as a shadow caster + Pass + { + Name "Caster" + Tags { "LightMode" = "ShadowCaster" } + Offset 1, 1 + + Fog {Mode Off} + ZWrite On ZTest LEqual Cull Off + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_shadowcaster + #include "UnityCG.cginc" + + struct v2f { + V2F_SHADOW_CASTER; + float2 uv : TEXCOORD1; + float2 uv2 : TEXCOORD3; + float alphaClip : TEXCOORD2; + }; + + uniform float4 _MainTex_ST; + uniform float4 _OutlineTex_ST; + float _OutlineWidth; + float _FaceDilate; + float _ScaleRatioA; + + v2f vert( appdata_base v ) + { + v2f o; + TRANSFER_SHADOW_CASTER(o) + o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uv2 = TRANSFORM_TEX(v.texcoord, _OutlineTex); + o.alphaClip = o.alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _FaceDilate * _ScaleRatioA) / 2; + return o; + } + + uniform sampler2D _MainTex; + + float4 frag(v2f i) : COLOR + { + fixed4 texcol = tex2D(_MainTex, i.uv).a; + clip(texcol.a - i.alphaClip); + SHADOW_CASTER_FRAGMENT(i) + } + ENDCG + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface-Mobile.shader.meta b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface-Mobile.shader.meta new file mode 100644 index 00000000..d559598d --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface-Mobile.shader.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 85187c2149c549c5b33f0cdb02836b17 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface.shader b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface.shader new file mode 100644 index 00000000..7657aeda --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface.shader @@ -0,0 +1,156 @@ +Shader "TextMeshPro/Distance Field (Surface)" { + +Properties { + _FaceTex ("Fill Texture", 2D) = "white" {} + _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0 + _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0 + _FaceColor ("Fill Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + _OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineTex ("Outline Texture", 2D) = "white" {} + _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0 + _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0 + _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 + _OutlineSoftness ("Outline Softness", Range(0,1)) = 0 + + _Bevel ("Bevel", Range(0,1)) = 0.5 + _BevelOffset ("Bevel Offset", Range(-0.5,0.5)) = 0 + _BevelWidth ("Bevel Width", Range(-.5,0.5)) = 0 + _BevelClamp ("Bevel Clamp", Range(0,1)) = 0 + _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0 + + _BumpMap ("Normalmap", 2D) = "bump" {} + _BumpOutline ("Bump Outline", Range(0,1)) = 0.5 + _BumpFace ("Bump Face", Range(0,1)) = 0.5 + + _ReflectFaceColor ("Face Color", Color) = (0,0,0,1) + _ReflectOutlineColor ("Outline Color", Color) = (0,0,0,1) + _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } + _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) + _SpecColor ("Specular Color", Color) = (0,0,0,1) + + _FaceShininess ("Face Shininess", Range(0,1)) = 0 + _OutlineShininess ("Outline Shininess", Range(0,1)) = 0 + + _GlowColor ("Color", Color) = (0, 1, 0, 0.5) + _GlowOffset ("Offset", Range(-1,1)) = 0 + _GlowInner ("Inner", Range(0,1)) = 0.05 + _GlowOuter ("Outer", Range(0,1)) = 0.05 + _GlowPower ("Falloff", Range(1, 0)) = 0.75 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = 0.5 + + // Should not be directly exposed to the user + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5.0 + _ScaleX ("Scale X", float) = 1.0 + _ScaleY ("Scale Y", float) = 1.0 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + //_MaskCoord ("Mask Coords", vector) = (0,0,0,0) + //_MaskSoftness ("Mask Softness", float) = 0 +} + +SubShader { + + Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } + + LOD 300 + Cull [_CullMode] + + CGPROGRAM + #pragma surface PixShader BlinnPhong alpha:blend vertex:VertShader nolightmap nodirlightmap + #pragma target 3.0 + #pragma shader_feature __ GLOW_ON + #pragma glsl + + #include "TMPro_Properties.cginc" + #include "TMPro.cginc" + + half _FaceShininess; + half _OutlineShininess; + + struct Input + { + fixed4 color : COLOR; + float2 uv_MainTex; + float2 uv2_FaceTex; + float2 uv2_OutlineTex; + float2 param; // Weight, Scale + float3 viewDirEnv; + }; + + + #define BEVEL_ON 1 + #include "TMPro_Surface.cginc" + + ENDCG + + // Pass to render object as a shadow caster + Pass + { + Name "Caster" + Tags { "LightMode" = "ShadowCaster" } + Offset 1, 1 + + Fog {Mode Off} + ZWrite On + ZTest LEqual + Cull Off + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_shadowcaster + #include "UnityCG.cginc" + + struct v2f { + V2F_SHADOW_CASTER; + float2 uv : TEXCOORD1; + float2 uv2 : TEXCOORD3; + float alphaClip : TEXCOORD2; + }; + + uniform float4 _MainTex_ST; + uniform float4 _OutlineTex_ST; + float _OutlineWidth; + float _FaceDilate; + float _ScaleRatioA; + + v2f vert( appdata_base v ) + { + v2f o; + TRANSFER_SHADOW_CASTER(o) + o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); + o.uv2 = TRANSFORM_TEX(v.texcoord, _OutlineTex); + o.alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _FaceDilate * _ScaleRatioA) / 2; + return o; + } + + uniform sampler2D _MainTex; + + float4 frag(v2f i) : COLOR + { + fixed4 texcol = tex2D(_MainTex, i.uv).a; + clip(texcol.a - i.alphaClip); + SHADOW_CASTER_FRAGMENT(i) + } + ENDCG + } +} + +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} + diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface.shader.meta b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface.shader.meta new file mode 100644 index 00000000..bc7933f9 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF-Surface.shader.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f7ada0af4f174f0694ca6a487b8f543d +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF.shader b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF.shader new file mode 100644 index 00000000..d8cf6d7a --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF.shader @@ -0,0 +1,316 @@ +Shader "TextMeshPro/Distance Field" { + +Properties { + _FaceTex ("Face Texture", 2D) = "white" {} + _FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0 + _FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0 + _FaceColor ("Face Color", Color) = (1,1,1,1) + _FaceDilate ("Face Dilate", Range(-1,1)) = 0 + + _OutlineColor ("Outline Color", Color) = (0,0,0,1) + _OutlineTex ("Outline Texture", 2D) = "white" {} + _OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0 + _OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0 + _OutlineWidth ("Outline Thickness", Range(0, 1)) = 0 + _OutlineSoftness ("Outline Softness", Range(-1,1)) = 0 + + _Bevel ("Bevel", Range(0,1)) = 0.5 + _BevelOffset ("Bevel Offset", Range(-0.5,0.5)) = 0 + _BevelWidth ("Bevel Width", Range(-.5,0.5)) = 0 + _BevelClamp ("Bevel Clamp", Range(0,1)) = 0 + _BevelRoundness ("Bevel Roundness", Range(0,1)) = 0 + + _LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416 + _SpecularColor ("Specular", Color) = (1,1,1,1) + _SpecularPower ("Specular", Range(0,4)) = 2.0 + _Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10 + _Diffuse ("Diffuse", Range(0,1)) = 0.5 + _Ambient ("Ambient", Range(1,0)) = 0.5 + + _BumpMap ("Normal map", 2D) = "bump" {} + _BumpOutline ("Bump Outline", Range(0,1)) = 0 + _BumpFace ("Bump Face", Range(0,1)) = 0 + + _ReflectFaceColor ("Reflection Color", Color) = (0,0,0,1) + _ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1) + _Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ } + _EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0) + + + _UnderlayColor ("Border Color", Color) = (0,0,0, 0.5) + _UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0 + _UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0 + _UnderlayDilate ("Border Dilate", Range(-1,1)) = 0 + _UnderlaySoftness ("Border Softness", Range(0,1)) = 0 + + _GlowColor ("Color", Color) = (0, 1, 0, 0.5) + _GlowOffset ("Offset", Range(-1,1)) = 0 + _GlowInner ("Inner", Range(0,1)) = 0.05 + _GlowOuter ("Outer", Range(0,1)) = 0.05 + _GlowPower ("Falloff", Range(1, 0)) = 0.75 + + _WeightNormal ("Weight Normal", float) = 0 + _WeightBold ("Weight Bold", float) = 0.5 + + _ShaderFlags ("Flags", float) = 0 + _ScaleRatioA ("Scale RatioA", float) = 1 + _ScaleRatioB ("Scale RatioB", float) = 1 + _ScaleRatioC ("Scale RatioC", float) = 1 + + _MainTex ("Font Atlas", 2D) = "white" {} + _TextureWidth ("Texture Width", float) = 512 + _TextureHeight ("Texture Height", float) = 512 + _GradientScale ("Gradient Scale", float) = 5.0 + _ScaleX ("Scale X", float) = 1.0 + _ScaleY ("Scale Y", float) = 1.0 + _PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875 + _Sharpness ("Sharpness", Range(-1,1)) = 0 + + _VertexOffsetX ("Vertex OffsetX", float) = 0 + _VertexOffsetY ("Vertex OffsetY", float) = 0 + + _MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767) + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + _MaskSoftnessX ("Mask SoftnessX", float) = 0 + _MaskSoftnessY ("Mask SoftnessY", float) = 0 + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _ColorMask ("Color Mask", Float) = 15 +} + +SubShader { + + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + } + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull [_CullMode] + ZWrite Off + Lighting Off + Fog { Mode Off } + ZTest [unity_GUIZTestMode] + Blend One OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass { + CGPROGRAM + #pragma target 3.0 + #pragma vertex VertShader + #pragma fragment PixShader + #pragma shader_feature __ BEVEL_ON + #pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER + #pragma shader_feature __ GLOW_ON + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + #include "TMPro_Properties.cginc" + #include "TMPro.cginc" + + struct vertex_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + float4 position : POSITION; + float3 normal : NORMAL; + fixed4 color : COLOR; + float2 texcoord0 : TEXCOORD0; + float2 texcoord1 : TEXCOORD1; + }; + + + struct pixel_t { + UNITY_VERTEX_INPUT_INSTANCE_ID + UNITY_VERTEX_OUTPUT_STEREO + float4 position : SV_POSITION; + fixed4 color : COLOR; + float2 atlas : TEXCOORD0; // Atlas + float4 param : TEXCOORD1; // alphaClip, scale, bias, weight + float4 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw) + float3 viewDir : TEXCOORD3; + + #if (UNDERLAY_ON || UNDERLAY_INNER) + float4 texcoord2 : TEXCOORD4; // u,v, scale, bias + fixed4 underlayColor : COLOR1; + #endif + float4 textures : TEXCOORD5; + }; + + // Used by Unity internally to handle Texture Tiling and Offset. + float4 _FaceTex_ST; + float4 _OutlineTex_ST; + + pixel_t VertShader(vertex_t input) + { + pixel_t output; + + UNITY_INITIALIZE_OUTPUT(pixel_t, output); + UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input,output); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + + float bold = step(input.texcoord1.y, 0); + + float4 vert = input.position; + vert.x += _VertexOffsetX; + vert.y += _VertexOffsetY; + + float4 vPosition = UnityObjectToClipPos(vert); + + float2 pixelSize = vPosition.w; + pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy)); + float scale = rsqrt(dot(pixelSize, pixelSize)); + scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1); + if (UNITY_MATRIX_P[3][3] == 0) scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(input.normal.xyz), normalize(WorldSpaceViewDir(vert))))); + + float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0; + weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5; + + float bias =(.5 - weight) + (.5 / scale); + + float alphaClip = (1.0 - _OutlineWidth * _ScaleRatioA - _OutlineSoftness * _ScaleRatioA); + + #if GLOW_ON + alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB); + #endif + + alphaClip = alphaClip / 2.0 - ( .5 / scale) - weight; + + #if (UNDERLAY_ON || UNDERLAY_INNER) + float4 underlayColor = _UnderlayColor; + underlayColor.rgb *= underlayColor.a; + + float bScale = scale; + bScale /= 1 + ((_UnderlaySoftness*_ScaleRatioC) * bScale); + float bBias = (0.5 - weight) * bScale - 0.5 - ((_UnderlayDilate * _ScaleRatioC) * 0.5 * bScale); + + float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth; + float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight; + float2 bOffset = float2(x, y); + #endif + + // Generate UV for the Masking Texture + float4 clampedRect = clamp(_ClipRect, -2e10, 2e10); + float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy); + + // Support for texture tiling and offset + float2 textureUV = UnpackUV(input.texcoord1.x); + float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex); + float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex); + + + output.position = vPosition; + output.color = input.color; + output.atlas = input.texcoord0; + output.param = float4(alphaClip, scale, bias, weight); + output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw, 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy)); + output.viewDir = mul((float3x3)_EnvMatrix, _WorldSpaceCameraPos.xyz - mul(unity_ObjectToWorld, vert).xyz); + #if (UNDERLAY_ON || UNDERLAY_INNER) + output.texcoord2 = float4(input.texcoord0 + bOffset, bScale, bBias); + output.underlayColor = underlayColor; + #endif + output.textures = float4(faceUV, outlineUV); + + return output; + } + + + fixed4 PixShader(pixel_t input) : SV_Target + { + UNITY_SETUP_INSTANCE_ID(input); + + float c = tex2D(_MainTex, input.atlas).a; + + #ifndef UNDERLAY_ON + clip(c - input.param.x); + #endif + + float scale = input.param.y; + float bias = input.param.z; + float weight = input.param.w; + float sd = (bias - c) * scale; + + float outline = (_OutlineWidth * _ScaleRatioA) * scale; + float softness = (_OutlineSoftness * _ScaleRatioA) * scale; + + half4 faceColor = _FaceColor; + half4 outlineColor = _OutlineColor; + + faceColor.rgb *= input.color.rgb; + + faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y); + outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y); + + faceColor = GetColor(sd, faceColor, outlineColor, outline, softness); + + #if BEVEL_ON + float3 dxy = float3(0.5 / _TextureWidth, 0.5 / _TextureHeight, 0); + float3 n = GetSurfaceNormal(input.atlas, weight, dxy); + + float3 bump = UnpackNormal(tex2D(_BumpMap, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y)).xyz; + bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5)); + n = normalize(n- bump); + + float3 light = normalize(float3(sin(_LightAngle), cos(_LightAngle), -1.0)); + + float3 col = GetSpecular(n, light); + faceColor.rgb += col*faceColor.a; + faceColor.rgb *= 1-(dot(n, light)*_Diffuse); + faceColor.rgb *= lerp(_Ambient, 1, n.z*n.z); + + fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDir, -n)); + faceColor.rgb += reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a; + #endif + + #if UNDERLAY_ON + float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z; + faceColor += input.underlayColor * saturate(d - input.texcoord2.w) * (1 - faceColor.a); + #endif + + #if UNDERLAY_INNER + float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z; + faceColor += input.underlayColor * (1 - saturate(d - input.texcoord2.w)) * saturate(1 - sd) * (1 - faceColor.a); + #endif + + #if GLOW_ON + float4 glowColor = GetGlowColor(sd, scale); + faceColor.rgb += glowColor.rgb * glowColor.a; + #endif + + // Alternative implementation to UnityGet2DClipping with support for softness. + #if UNITY_UI_CLIP_RECT + half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw); + faceColor *= m.x * m.y; + #endif + + #if UNITY_UI_ALPHACLIP + clip(faceColor.a - 0.001); + #endif + + return faceColor * input.color.a; + } + + ENDCG + } +} + +Fallback "TextMeshPro/Mobile/Distance Field" +CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI" +} diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF.shader.meta b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF.shader.meta new file mode 100644 index 00000000..e3431366 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_SDF.shader.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 68e6db2ebdc24f95958faec2be5558d6 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_Sprite.shader b/Assets/TextMesh Pro/Resources/Shaders/TMP_Sprite.shader new file mode 100644 index 00000000..f90467d6 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_Sprite.shader @@ -0,0 +1,113 @@ +Shader "TextMeshPro/Sprite" +{ + Properties + { + _MainTex ("Sprite Texture", 2D) = "white" {} + _Color ("Tint", Color) = (1,1,1,1) + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _ColorMask ("Color Mask", Float) = 15 + _ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767) + + [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0 + } + + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + "PreviewType"="Plane" + "CanUseSpriteAtlas"="True" + } + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull Off + Lighting Off + ZWrite Off + ZTest [unity_GUIZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + + #pragma multi_compile __ UNITY_UI_CLIP_RECT + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + struct appdata_t + { + float4 vertex : POSITION; + float4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + half2 texcoord : TEXCOORD0; + float4 worldPosition : TEXCOORD1; + }; + + fixed4 _Color; + fixed4 _TextureSampleAdd; + float4 _ClipRect; + + v2f vert(appdata_t IN) + { + v2f OUT; + OUT.worldPosition = IN.vertex; + OUT.vertex = UnityObjectToClipPos(OUT.worldPosition); + + OUT.texcoord = IN.texcoord; + + #ifdef UNITY_HALF_TEXEL_OFFSET + OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1); + #endif + + OUT.color = IN.color * _Color; + return OUT; + } + + sampler2D _MainTex; + + fixed4 frag(v2f IN) : SV_Target + { + half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color; + + #if UNITY_UI_CLIP_RECT + color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); + #endif + + #ifdef UNITY_UI_ALPHACLIP + clip (color.a - 0.001); + #endif + + return color; + } + ENDCG + } + } +} diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMP_Sprite.shader.meta b/Assets/TextMesh Pro/Resources/Shaders/TMP_Sprite.shader.meta new file mode 100644 index 00000000..f3e9cc9b --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMP_Sprite.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: cf81c85f95fe47e1a27f6ae460cf182c +timeCreated: 1450517184 +licenseType: Pro +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMPro.cginc b/Assets/TextMesh Pro/Resources/Shaders/TMPro.cginc new file mode 100644 index 00000000..58981304 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMPro.cginc @@ -0,0 +1,84 @@ +float2 UnpackUV(float uv) +{ + float2 output; + output.x = floor(uv / 4096); + output.y = uv - 4096 * output.x; + + return output * 0.001953125; +} + +fixed4 GetColor(half d, fixed4 faceColor, fixed4 outlineColor, half outline, half softness) +{ + half faceAlpha = 1-saturate((d - outline * 0.5 + softness * 0.5) / (1.0 + softness)); + half outlineAlpha = saturate((d + outline * 0.5)) * sqrt(min(1.0, outline)); + + faceColor.rgb *= faceColor.a; + outlineColor.rgb *= outlineColor.a; + + faceColor = lerp(faceColor, outlineColor, outlineAlpha); + + faceColor *= faceAlpha; + + return faceColor; +} + +float3 GetSurfaceNormal(float4 h, float bias) +{ + bool raisedBevel = step(1, fmod(_ShaderFlags, 2)); + + h += bias+_BevelOffset; + + float bevelWidth = max(.01, _OutlineWidth+_BevelWidth); + + // Track outline + h -= .5; + h /= bevelWidth; + h = saturate(h+.5); + + if(raisedBevel) h = 1 - abs(h*2.0 - 1.0); + h = lerp(h, sin(h*3.141592/2.0), _BevelRoundness); + h = min(h, 1.0-_BevelClamp); + h *= _Bevel * bevelWidth * _GradientScale * -2.0; + + float3 va = normalize(float3(1.0, 0.0, h.y - h.x)); + float3 vb = normalize(float3(0.0, -1.0, h.w - h.z)); + + return cross(va, vb); +} + +float3 GetSurfaceNormal(float2 uv, float bias, float3 delta) +{ + // Read "height field" + float4 h = {tex2D(_MainTex, uv - delta.xz).a, + tex2D(_MainTex, uv + delta.xz).a, + tex2D(_MainTex, uv - delta.zy).a, + tex2D(_MainTex, uv + delta.zy).a}; + + return GetSurfaceNormal(h, bias); +} + +float3 GetSpecular(float3 n, float3 l) +{ + float spec = pow(max(0.0, dot(n, l)), _Reflectivity); + return _SpecularColor.rgb * spec * _SpecularPower; +} + +float4 GetGlowColor(float d, float scale) +{ + float glow = d - (_GlowOffset*_ScaleRatioB) * 0.5 * scale; + float t = lerp(_GlowInner, (_GlowOuter * _ScaleRatioB), step(0.0, glow)) * 0.5 * scale; + glow = saturate(abs(glow/(1.0 + t))); + glow = 1.0-pow(glow, _GlowPower); + glow *= sqrt(min(1.0, t)); // Fade off glow thinner than 1 screen pixel + return float4(_GlowColor.rgb, saturate(_GlowColor.a * glow * 2)); +} + +float4 BlendARGB(float4 overlying, float4 underlying) +{ + overlying.rgb *= overlying.a; + underlying.rgb *= underlying.a; + float3 blended = overlying.rgb + ((1-overlying.a)*underlying.rgb); + float alpha = underlying.a + (1-underlying.a)*overlying.a; + return float4(blended, alpha); +} + diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMPro.cginc.meta b/Assets/TextMesh Pro/Resources/Shaders/TMPro.cginc.meta new file mode 100644 index 00000000..f633f580 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMPro.cginc.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 407bc68d299748449bbf7f48ee690f8d +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc b/Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc new file mode 100644 index 00000000..2e962588 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc @@ -0,0 +1,85 @@ +// UI Editable properties +uniform sampler2D _FaceTex; // Alpha : Signed Distance +uniform float _FaceUVSpeedX; +uniform float _FaceUVSpeedY; +uniform fixed4 _FaceColor; // RGBA : Color + Opacity +uniform float _FaceDilate; // v[ 0, 1] +uniform float _OutlineSoftness; // v[ 0, 1] + +uniform sampler2D _OutlineTex; // RGBA : Color + Opacity +uniform float _OutlineUVSpeedX; +uniform float _OutlineUVSpeedY; +uniform fixed4 _OutlineColor; // RGBA : Color + Opacity +uniform float _OutlineWidth; // v[ 0, 1] + +uniform float _Bevel; // v[ 0, 1] +uniform float _BevelOffset; // v[-1, 1] +uniform float _BevelWidth; // v[-1, 1] +uniform float _BevelClamp; // v[ 0, 1] +uniform float _BevelRoundness; // v[ 0, 1] + +uniform sampler2D _BumpMap; // Normal map +uniform float _BumpOutline; // v[ 0, 1] +uniform float _BumpFace; // v[ 0, 1] + +uniform samplerCUBE _Cube; // Cube / sphere map +uniform fixed4 _ReflectFaceColor; // RGB intensity +uniform fixed4 _ReflectOutlineColor; +//uniform float _EnvTiltX; // v[-1, 1] +//uniform float _EnvTiltY; // v[-1, 1] +uniform float3 _EnvMatrixRotation; +uniform float4x4 _EnvMatrix; + +uniform fixed4 _SpecularColor; // RGB intensity +uniform float _LightAngle; // v[ 0,Tau] +uniform float _SpecularPower; // v[ 0, 1] +uniform float _Reflectivity; // v[ 5, 15] +uniform float _Diffuse; // v[ 0, 1] +uniform float _Ambient; // v[ 0, 1] + +uniform fixed4 _UnderlayColor; // RGBA : Color + Opacity +uniform float _UnderlayOffsetX; // v[-1, 1] +uniform float _UnderlayOffsetY; // v[-1, 1] +uniform float _UnderlayDilate; // v[-1, 1] +uniform float _UnderlaySoftness; // v[ 0, 1] + +uniform fixed4 _GlowColor; // RGBA : Color + Intesity +uniform float _GlowOffset; // v[-1, 1] +uniform float _GlowOuter; // v[ 0, 1] +uniform float _GlowInner; // v[ 0, 1] +uniform float _GlowPower; // v[ 1, 1/(1+4*4)] + +// API Editable properties +uniform float _ShaderFlags; +uniform float _WeightNormal; +uniform float _WeightBold; + +uniform float _ScaleRatioA; +uniform float _ScaleRatioB; +uniform float _ScaleRatioC; + +uniform float _VertexOffsetX; +uniform float _VertexOffsetY; + +//uniform float _UseClipRect; +uniform float _MaskID; +uniform sampler2D _MaskTex; +uniform float4 _MaskCoord; +uniform float4 _ClipRect; // bottom left(x,y) : top right(z,w) +//uniform float _MaskWipeControl; +//uniform float _MaskEdgeSoftness; +//uniform fixed4 _MaskEdgeColor; +//uniform bool _MaskInverse; + +uniform float _MaskSoftnessX; +uniform float _MaskSoftnessY; + +// Font Atlas properties +uniform sampler2D _MainTex; +uniform float _TextureWidth; +uniform float _TextureHeight; +uniform float _GradientScale; +uniform float _ScaleX; +uniform float _ScaleY; +uniform float _PerspectiveFilter; +uniform float _Sharpness; diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc.meta b/Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc.meta new file mode 100644 index 00000000..24f0f8fc --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMPro_Properties.cginc.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3997e2241185407d80309a82f9148466 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMPro_Surface.cginc b/Assets/TextMesh Pro/Resources/Shaders/TMPro_Surface.cginc new file mode 100644 index 00000000..9a58aef2 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMPro_Surface.cginc @@ -0,0 +1,115 @@ +void VertShader(inout appdata_full v, out Input data) +{ + v.vertex.x += _VertexOffsetX; + v.vertex.y += _VertexOffsetY; + + UNITY_INITIALIZE_OUTPUT(Input, data); + + float bold = step(v.texcoord1.y, 0); + + // Generate normal for backface + float3 view = ObjSpaceViewDir(v.vertex); + v.normal *= sign(dot(v.normal, view)); + +#if USE_DERIVATIVE + data.param.y = 1; +#else + float4 vert = v.vertex; + float4 vPosition = UnityObjectToClipPos(vert); + float2 pixelSize = vPosition.w; + + pixelSize /= float2(_ScaleX, _ScaleY) * mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy); + float scale = rsqrt(dot(pixelSize, pixelSize)); + scale *= abs(v.texcoord1.y) * _GradientScale * (_Sharpness + 1); + scale = lerp(scale * (1 - _PerspectiveFilter), scale, abs(dot(UnityObjectToWorldNormal(v.normal.xyz), normalize(WorldSpaceViewDir(vert))))); + data.param.y = scale; +#endif + + //float opacity = v.color.a; + + data.param.x = (lerp(_WeightNormal, _WeightBold, bold) / 4.0 + _FaceDilate) * _ScaleRatioA * 0.5; // + + v.texcoord1.xy = UnpackUV(v.texcoord1.x); + data.viewDirEnv = mul((float3x3)_EnvMatrix, WorldSpaceViewDir(v.vertex)); +} + +void PixShader(Input input, inout SurfaceOutput o) +{ + +#if USE_DERIVATIVE | BEVEL_ON + float3 delta = float3(1.0 / _TextureWidth, 1.0 / _TextureHeight, 0.0); + + float4 smp4x = { tex2D(_MainTex, input.uv_MainTex - delta.xz).a, + tex2D(_MainTex, input.uv_MainTex + delta.xz).a, + tex2D(_MainTex, input.uv_MainTex - delta.zy).a, + tex2D(_MainTex, input.uv_MainTex + delta.zy).a }; +#endif + +#if USE_DERIVATIVE + // Screen space scaling reciprocal with anisotropic correction + float2 edgeNormal = Normalize(float2(smp4x.x - smp4x.y, smp4x.z - smp4x.w)); + float2 res = float2(_TextureWidth * input.param.y, _TextureHeight); + float2 tdx = ddx(input.uv_MainTex)*res; + float2 tdy = ddy(input.uv_MainTex)*res; + float lx = length(tdx); + float ly = length(tdy); + float s = sqrt(min(lx, ly) / max(lx, ly)); + s = lerp(1, s, abs(dot(normalize(tdx + tdy), edgeNormal))); + float scale = rsqrt(abs(tdx.x * tdy.y - tdx.y * tdy.x)) * (_GradientScale * 2) * s; +#else + float scale = input.param.y; +#endif + + // Signed distance + float c = tex2D(_MainTex, input.uv_MainTex).a; + float sd = (.5 - c - input.param.x) * scale + .5; + float outline = _OutlineWidth*_ScaleRatioA * scale; + float softness = _OutlineSoftness*_ScaleRatioA * scale; + + // Color & Alpha + float4 faceColor = _FaceColor; + float4 outlineColor = _OutlineColor; + faceColor *= input.color; + outlineColor.a *= input.color.a; + faceColor *= tex2D(_FaceTex, float2(input.uv2_FaceTex.x + _FaceUVSpeedX * _Time.y, input.uv2_FaceTex.y + _FaceUVSpeedY * _Time.y)); + outlineColor *= tex2D(_OutlineTex, float2(input.uv2_OutlineTex.x + _OutlineUVSpeedX * _Time.y, input.uv2_OutlineTex.y + _OutlineUVSpeedY * _Time.y)); + faceColor = GetColor(sd, faceColor, outlineColor, outline, softness); + faceColor.rgb /= max(faceColor.a, 0.0001); + + +#if BEVEL_ON + // Face Normal + float3 n = GetSurfaceNormal(smp4x, input.param.x); + + // Bumpmap + float3 bump = UnpackNormal(tex2D(_BumpMap, input.uv2_FaceTex.xy)).xyz; + bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5)); + bump = lerp(float3(0, 0, 1), bump, faceColor.a); + n = normalize(n - bump); + + // Cubemap reflection + fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDirEnv, mul((float3x3)unity_ObjectToWorld, n))); + float3 emission = reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a; +#else + float3 n = float3(0, 0, -1); + float3 emission = float3(0, 0, 0); +#endif + + + +#if GLOW_ON + float4 glowColor = GetGlowColor(sd, scale); + glowColor.a *= input.color.a; + emission += glowColor.rgb*glowColor.a; + faceColor = BlendARGB(glowColor, faceColor); + faceColor.rgb /= max(faceColor.a, 0.0001); +#endif + + // Set Standard output structure + o.Albedo = faceColor.rgb; + o.Normal = -n; + o.Emission = emission; + o.Specular = lerp(_FaceShininess, _OutlineShininess, saturate(sd + outline * 0.5)); + o.Gloss = 1; + o.Alpha = faceColor.a; +} diff --git a/Assets/TextMesh Pro/Resources/Shaders/TMPro_Surface.cginc.meta b/Assets/TextMesh Pro/Resources/Shaders/TMPro_Surface.cginc.meta new file mode 100644 index 00000000..8e750228 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Shaders/TMPro_Surface.cginc.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d930090c0cd643c7b55f19a38538c162 +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Sprite Assets.meta b/Assets/TextMesh Pro/Resources/Sprite Assets.meta new file mode 100644 index 00000000..5171f1b6 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Sprite Assets.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 512a49d95c0c4332bdd98131869c23c9 +folderAsset: yes +timeCreated: 1441876896 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset b/Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset new file mode 100644 index 00000000..2484fcd0 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset @@ -0,0 +1,638 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2103686 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TextMeshPro/Sprite + m_Shader: {fileID: 4800000, guid: cf81c85f95fe47e1a27f6ae460cf182c, type: 3} + m_ShaderKeywords: UNITY_UI_CLIP_RECT + m_LightmapFlags: 5 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _MainTex: + m_Texture: {fileID: 2800000, guid: dffef66376be4fa480fb02b19edbe903, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _ColorMask: 15 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UseUIAlphaClip: 0 + m_Colors: + - _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767} + - _Color: {r: 1, g: 1, b: 1, a: 1} +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 84a92b25f83d49b9bc132d206b370281, type: 3} + m_Name: EmojiOne + m_EditorClassIdentifier: + hashCode: -1836805472 + material: {fileID: 2103686} + materialHashCode: 0 + m_Version: 1.1.0 + spriteSheet: {fileID: 2800000, guid: dffef66376be4fa480fb02b19edbe903, type: 3} + m_SpriteCharacterTable: + - m_ElementType: 2 + m_Unicode: 128522 + m_GlyphIndex: 0 + m_Scale: 1 + m_Name: Smiling face with smiling eyes + m_HashCode: -1318250903 + - m_ElementType: 2 + m_Unicode: 128523 + m_GlyphIndex: 1 + m_Scale: 1 + m_Name: 1f60b + m_HashCode: 57188339 + - m_ElementType: 2 + m_Unicode: 128525 + m_GlyphIndex: 2 + m_Scale: 1 + m_Name: 1f60d + m_HashCode: 57188341 + - m_ElementType: 2 + m_Unicode: 128526 + m_GlyphIndex: 3 + m_Scale: 1 + m_Name: 1f60e + m_HashCode: 57188340 + - m_ElementType: 2 + m_Unicode: 128512 + m_GlyphIndex: 4 + m_Scale: 1 + m_Name: Grinning face + m_HashCode: -95541379 + - m_ElementType: 2 + m_Unicode: 128513 + m_GlyphIndex: 5 + m_Scale: 1 + m_Name: 1f601 + m_HashCode: 57188256 + - m_ElementType: 2 + m_Unicode: 128514 + m_GlyphIndex: 6 + m_Scale: 1 + m_Name: Face with tears of joy + m_HashCode: 239522663 + - m_ElementType: 2 + m_Unicode: 128515 + m_GlyphIndex: 7 + m_Scale: 1 + m_Name: 1f603 + m_HashCode: 57188258 + - m_ElementType: 2 + m_Unicode: 128516 + m_GlyphIndex: 8 + m_Scale: 1 + m_Name: 1f604 + m_HashCode: 57188261 + - m_ElementType: 2 + m_Unicode: 128517 + m_GlyphIndex: 9 + m_Scale: 1 + m_Name: 1f605 + m_HashCode: 57188260 + - m_ElementType: 2 + m_Unicode: 128518 + m_GlyphIndex: 10 + m_Scale: 1 + m_Name: 1f606 + m_HashCode: 57188263 + - m_ElementType: 2 + m_Unicode: 128521 + m_GlyphIndex: 11 + m_Scale: 1 + m_Name: 1f609 + m_HashCode: 57188264 + - m_ElementType: 2 + m_Unicode: 128536 + m_GlyphIndex: 12 + m_Scale: 1 + m_Name: 1f618 + m_HashCode: 57188168 + - m_ElementType: 2 + m_Unicode: 129315 + m_GlyphIndex: 13 + m_Scale: 1 + m_Name: 1f923 + m_HashCode: 57200239 + - m_ElementType: 2 + m_Unicode: 9786 + m_GlyphIndex: 14 + m_Scale: 1 + m_Name: 263a + m_HashCode: 1748406 + - m_ElementType: 2 + m_Unicode: 9785 + m_GlyphIndex: 15 + m_Scale: 1 + m_Name: 2639 + m_HashCode: 1748462 + m_SpriteGlyphTable: + - m_Index: 0 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 0 + m_Y: 384 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 1 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 128 + m_Y: 384 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 2 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 256 + m_Y: 384 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 3 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 384 + m_Y: 384 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 4 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 0 + m_Y: 256 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 5 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 128 + m_Y: 256 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 6 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 256 + m_Y: 256 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 7 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 384 + m_Y: 256 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 8 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 0 + m_Y: 128 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 9 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 128 + m_Y: 128 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 10 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 256 + m_Y: 128 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 11 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 384 + m_Y: 128 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 12 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 0 + m_Y: 0 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 13 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 128 + m_Y: 0 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 14 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 256 + m_Y: 0 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + - m_Index: 15 + m_Metrics: + m_Width: 128 + m_Height: 128 + m_HorizontalBearingX: 0 + m_HorizontalBearingY: 115.6 + m_HorizontalAdvance: 128 + m_GlyphRect: + m_X: 384 + m_Y: 0 + m_Width: 128 + m_Height: 128 + m_Scale: 1 + m_AtlasIndex: 0 + sprite: {fileID: 0} + spriteInfoList: + - id: 0 + x: 0 + y: 384 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: Smiling face with smiling eyes + hashCode: -1318250903 + unicode: 128522 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 1 + x: 128 + y: 384 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 1f60b + hashCode: 57188339 + unicode: 128523 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 2 + x: 256 + y: 384 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 1f60d + hashCode: 57188341 + unicode: 128525 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 3 + x: 384 + y: 384 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 1f60e + hashCode: 57188340 + unicode: 128526 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 4 + x: 0 + y: 256 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: Grinning face + hashCode: -95541379 + unicode: 128512 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 5 + x: 128 + y: 256 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 1f601 + hashCode: 57188256 + unicode: 128513 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 6 + x: 256 + y: 256 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: Face with tears of joy + hashCode: 239522663 + unicode: 128514 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 7 + x: 384 + y: 256 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 1f603 + hashCode: 57188258 + unicode: 128515 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 8 + x: 0 + y: 128 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 1f604 + hashCode: 57188261 + unicode: 128516 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 9 + x: 128 + y: 128 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 1f605 + hashCode: 57188260 + unicode: 128517 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 10 + x: 256 + y: 128 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 1f606 + hashCode: 57188263 + unicode: 128518 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 11 + x: 384 + y: 128 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 1f609 + hashCode: 57188264 + unicode: 128521 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 12 + x: 0 + y: 0 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 1f618 + hashCode: 57188168 + unicode: 128536 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 13 + x: 128 + y: 0 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 1f923 + hashCode: 57200239 + unicode: 129315 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 14 + x: 256 + y: 0 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 263a + hashCode: 1748406 + unicode: 9786 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + - id: 15 + x: 384 + y: 0 + width: 128 + height: 128 + xOffset: 0 + yOffset: 115.6 + xAdvance: 128 + scale: 1 + name: 2639 + hashCode: 1748462 + unicode: 9785 + pivot: {x: 0.5, y: 0.5} + sprite: {fileID: 0} + fallbackSpriteAssets: [] +--- !u!21 &1369835458 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TextMeshPro/Sprite + m_Shader: {fileID: 4800000, guid: cf81c85f95fe47e1a27f6ae460cf182c, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: [] + m_Floats: [] + m_Colors: [] diff --git a/Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset.meta b/Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset.meta new file mode 100644 index 00000000..c7ac83f4 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Sprite Assets/EmojiOne.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c41005c129ba4d66911b75229fd70b45 +timeCreated: 1480316912 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Style Sheets.meta b/Assets/TextMesh Pro/Resources/Style Sheets.meta new file mode 100644 index 00000000..4958550d --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Style Sheets.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4aecb92fff08436c8303b10eab8da368 +folderAsset: yes +timeCreated: 1441876950 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset b/Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset new file mode 100644 index 00000000..ceb609b2 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset @@ -0,0 +1,68 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ab2114bdc8544297b417dfefe9f1e410, type: 3} + m_Name: Default Style Sheet + m_EditorClassIdentifier: + m_StyleList: + - m_Name: H1 + m_HashCode: 2425 + m_OpeningDefinition: <#40ff80>* + m_ClosingDefinition: '*' + m_OpeningTagArray: 3c00000073000000690000007a000000650000003d00000032000000650000006d0000003e0000003c000000620000003e0000003c000000230000003400000030000000660000006600000038000000300000003e0000002a000000 + m_ClosingTagArray: 2a0000003c0000002f00000073000000690000007a000000650000003e0000003c0000002f000000620000003e0000003c0000002f000000630000006f0000006c0000006f000000720000003e000000 + - m_Name: Quote + m_HashCode: 92254330 + m_OpeningDefinition: + m_ClosingDefinition: + m_OpeningTagArray: 3c000000690000003e0000003c00000073000000690000007a000000650000003d0000003700000035000000250000003e0000003c0000006d000000610000007200000067000000690000006e0000003d0000003100000030000000250000003e000000 + m_ClosingTagArray: 3c0000002f000000690000003e0000003c0000002f00000073000000690000007a000000650000003e0000003c0000002f00000077000000690000006400000074000000680000003e0000003c0000002f0000006d000000610000007200000067000000690000006e0000003e000000 + - m_Name: Link + m_HashCode: 2687968 + m_OpeningDefinition: <#40a0ff> + m_ClosingDefinition: + m_OpeningTagArray: 3c000000750000003e0000003c000000230000003400000030000000610000003000000066000000660000003e0000003c0000006c000000690000006e0000006b0000003d0000002200000049000000440000005f0000003000000031000000220000003e000000 + m_ClosingTagArray: 3c0000002f000000750000003e0000003c0000002f000000630000006f0000006c0000006f000000720000003e0000003c0000002f0000006c000000690000006e0000006b0000003e000000 + - m_Name: Title + m_HashCode: 98732960 + m_OpeningDefinition: + m_ClosingDefinition: + m_OpeningTagArray: 3c00000073000000690000007a000000650000003d000000310000003200000035000000250000003e0000003c000000620000003e0000003c000000610000006c00000069000000670000006e0000003d00000063000000650000006e0000007400000065000000720000003e000000 + m_ClosingTagArray: 3c0000002f00000073000000690000007a000000650000003e0000003c0000002f000000620000003e0000003c0000002f000000610000006c00000069000000670000006e0000003e000000 + - m_Name: H2 + m_HashCode: 2426 + m_OpeningDefinition: <#4080FF> + m_ClosingDefinition: + m_OpeningTagArray: 3c00000073000000690000007a000000650000003d000000310000002e00000035000000650000006d0000003e0000003c000000620000003e0000003c000000230000003400000030000000380000003000000046000000460000003e000000 + m_ClosingTagArray: 3c0000002f00000073000000690000007a000000650000003e0000003c0000002f000000620000003e0000003c0000002f000000630000006f0000006c0000006f000000720000003e000000 + - m_Name: H3 + m_HashCode: 2427 + m_OpeningDefinition: <#FF8040> + m_ClosingDefinition: + m_OpeningTagArray: 3c00000073000000690000007a000000650000003d000000310000002e0000003100000037000000650000006d0000003e0000003c000000620000003e0000003c000000230000004600000046000000380000003000000034000000300000003e000000 + m_ClosingTagArray: 3c0000002f00000073000000690000007a000000650000003e0000003c0000002f000000620000003e0000003c0000002f000000630000006f0000006c0000006f000000720000003e000000 + - m_Name: C1 + m_HashCode: 2194 + m_OpeningDefinition: + m_ClosingDefinition: + m_OpeningTagArray: 3c000000630000006f0000006c0000006f000000720000003d000000230000006600000066000000660000006600000034000000300000003e000000 + m_ClosingTagArray: 3c0000002f000000630000006f0000006c0000006f000000720000003e000000 + - m_Name: C2 + m_HashCode: 2193 + m_OpeningDefinition: + m_ClosingDefinition: + m_OpeningTagArray: 3c000000630000006f0000006c0000006f000000720000003d000000230000006600000066000000340000003000000046000000460000003e0000003c00000073000000690000007a000000650000003d000000310000003200000035000000250000003e000000 + m_ClosingTagArray: 3c0000002f000000630000006f0000006c0000006f000000720000003e0000003c0000002f00000073000000690000007a000000650000003e000000 + - m_Name: C3 + m_HashCode: 2192 + m_OpeningDefinition: + m_ClosingDefinition: + m_OpeningTagArray: 3c000000630000006f0000006c0000006f000000720000003d000000230000003800000030000000410000003000000046000000460000003e0000003c000000620000003e000000 + m_ClosingTagArray: 3c0000002f000000630000006f0000006c0000006f000000720000003e0000003c0000002f000000620000003e000000 diff --git a/Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset.meta b/Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset.meta new file mode 100644 index 00000000..95fd96ed --- /dev/null +++ b/Assets/TextMesh Pro/Resources/Style Sheets/Default Style Sheet.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f952c082cb03451daed3ee968ac6c63e +timeCreated: 1432805430 +licenseType: Store +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Resources/TMP Settings.asset b/Assets/TextMesh Pro/Resources/TMP Settings.asset new file mode 100644 index 00000000..5e2d07d5 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/TMP Settings.asset @@ -0,0 +1,43 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2705215ac5b84b70bacc50632be6e391, type: 3} + m_Name: TMP Settings + m_EditorClassIdentifier: + m_enableWordWrapping: 1 + m_enableKerning: 1 + m_enableExtraPadding: 0 + m_enableTintAllSprites: 0 + m_enableParseEscapeCharacters: 1 + m_EnableRaycastTarget: 1 + m_GetFontFeaturesAtRuntime: 1 + m_missingGlyphCharacter: 0 + m_warningsDisabled: 0 + m_defaultFontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_defaultFontAssetPath: Fonts & Materials/ + m_defaultFontSize: 36 + m_defaultAutoSizeMinRatio: 0.5 + m_defaultAutoSizeMaxRatio: 2 + m_defaultTextMeshProTextContainerSize: {x: 20, y: 5} + m_defaultTextMeshProUITextContainerSize: {x: 200, y: 50} + m_autoSizeTextContainer: 0 + m_fallbackFontAssets: [] + m_matchMaterialPreset: 1 + m_defaultSpriteAsset: {fileID: 11400000, guid: c41005c129ba4d66911b75229fd70b45, + type: 2} + m_defaultSpriteAssetPath: Sprite Assets/ + m_defaultColorGradientPresetsPath: Color Gradient Presets/ + m_enableEmojiSupport: 1 + m_defaultStyleSheet: {fileID: 11400000, guid: f952c082cb03451daed3ee968ac6c63e, + type: 2} + m_leadingCharacters: {fileID: 4900000, guid: d82c1b31c7e74239bff1220585707d2b, type: 3} + m_followingCharacters: {fileID: 4900000, guid: fade42e8bc714b018fac513c043d323b, + type: 3} diff --git a/Assets/TextMesh Pro/Resources/TMP Settings.asset.meta b/Assets/TextMesh Pro/Resources/TMP Settings.asset.meta new file mode 100644 index 00000000..32db3845 --- /dev/null +++ b/Assets/TextMesh Pro/Resources/TMP Settings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f5b5dff67a942289a9defa416b206f3 +timeCreated: 1436653997 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Sprites.meta b/Assets/TextMesh Pro/Sprites.meta new file mode 100644 index 00000000..8b699e5f --- /dev/null +++ b/Assets/TextMesh Pro/Sprites.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d0603b6d5186471b96c778c3949c7ce2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt b/Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt new file mode 100644 index 00000000..384180a9 --- /dev/null +++ b/Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt @@ -0,0 +1,3 @@ +This sample of beautiful emojis are provided by EmojiOne https://www.emojione.com/ + +Please visit their website to view the complete set of their emojis and review their licensing terms. \ No newline at end of file diff --git a/Assets/favorites.txt.meta b/Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt.meta similarity index 75% rename from Assets/favorites.txt.meta rename to Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt.meta index b610ab1e..0d30e653 100644 --- a/Assets/favorites.txt.meta +++ b/Assets/TextMesh Pro/Sprites/EmojiOne Attribution.txt.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e22ccf74b7b4d05469ff5e9ff9363c83 +guid: 381dcb09d5029d14897e55f98031fca5 TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/TextMesh Pro/Sprites/EmojiOne.json b/Assets/TextMesh Pro/Sprites/EmojiOne.json new file mode 100644 index 00000000..6c4e50bc --- /dev/null +++ b/Assets/TextMesh Pro/Sprites/EmojiOne.json @@ -0,0 +1,156 @@ +{"frames": [ + +{ + "filename": "1f60a.png", + "frame": {"x":0,"y":0,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f60b.png", + "frame": {"x":128,"y":0,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f60d.png", + "frame": {"x":256,"y":0,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f60e.png", + "frame": {"x":384,"y":0,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f600.png", + "frame": {"x":0,"y":128,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f601.png", + "frame": {"x":128,"y":128,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f602.png", + "frame": {"x":256,"y":128,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f603.png", + "frame": {"x":384,"y":128,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f604.png", + "frame": {"x":0,"y":256,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f605.png", + "frame": {"x":128,"y":256,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f606.png", + "frame": {"x":256,"y":256,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f609.png", + "frame": {"x":384,"y":256,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f618.png", + "frame": {"x":0,"y":384,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "1f923.png", + "frame": {"x":128,"y":384,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "263a.png", + "frame": {"x":256,"y":384,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}, +{ + "filename": "2639.png", + "frame": {"x":384,"y":384,"w":128,"h":128}, + "rotated": false, + "trimmed": false, + "spriteSourceSize": {"x":0,"y":0,"w":128,"h":128}, + "sourceSize": {"w":128,"h":128}, + "pivot": {"x":0.5,"y":0.5} +}], +"meta": { + "app": "http://www.codeandweb.com/texturepacker", + "version": "1.0", + "image": "EmojiOne.png", + "format": "RGBA8888", + "size": {"w":512,"h":512}, + "scale": "1", + "smartupdate": "$TexturePacker:SmartUpdate:196a26a2e149d875b91ffc8fa3581e76:fc928c7e275404b7e0649307410475cb:424723c3774975ddb2053fd5c4b85f6e$" +} +} diff --git a/Assets/TextMesh Pro/Sprites/EmojiOne.json.meta b/Assets/TextMesh Pro/Sprites/EmojiOne.json.meta new file mode 100644 index 00000000..762cf15c --- /dev/null +++ b/Assets/TextMesh Pro/Sprites/EmojiOne.json.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f05276190cf498a8153f6cbe761d4e6 +timeCreated: 1480316860 +licenseType: Pro +TextScriptImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TextMesh Pro/Sprites/EmojiOne.png b/Assets/TextMesh Pro/Sprites/EmojiOne.png new file mode 100644 index 00000000..4adb015b Binary files /dev/null and b/Assets/TextMesh Pro/Sprites/EmojiOne.png differ diff --git a/Assets/TextMesh Pro/Sprites/EmojiOne.png.meta b/Assets/TextMesh Pro/Sprites/EmojiOne.png.meta new file mode 100644 index 00000000..c9fa1a7d --- /dev/null +++ b/Assets/TextMesh Pro/Sprites/EmojiOne.png.meta @@ -0,0 +1,431 @@ +fileFormatVersion: 2 +guid: dffef66376be4fa480fb02b19edbe903 +TextureImporter: + fileIDToRecycleName: + 21300000: EmojiOne_0 + 21300002: EmojiOne_1 + 21300004: EmojiOne_2 + 21300006: EmojiOne_3 + 21300008: EmojiOne_4 + 21300010: EmojiOne_6 + 21300012: EmojiOne_7 + 21300014: EmojiOne_8 + 21300016: EmojiOne_9 + 21300018: EmojiOne_10 + 21300020: EmojiOne_11 + 21300022: EmojiOne_12 + 21300024: EmojiOne_13 + 21300026: EmojiOne_5 + 21300028: EmojiOne_14 + externalObjects: {} + serializedVersion: 5 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: iPhone + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Android + maxTextureSize: 512 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: EmojiOne_0 + rect: + serializedVersion: 2 + x: 0 + y: 384 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 4bcc36da2108f2c4ba3de5c921d25c3c + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_1 + rect: + serializedVersion: 2 + x: 128 + y: 384 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: e9eea8093eaeaee4d901c4553f572c22 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_2 + rect: + serializedVersion: 2 + x: 256 + y: 384 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 49451da35411dcc42a3692e39b0fde70 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_3 + rect: + serializedVersion: 2 + x: 384 + y: 384 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: f65709664b924904790c850a50ca82bc + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_4 + rect: + serializedVersion: 2 + x: 0 + y: 256 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 5b92c568a5ec9ad4b9ed90e271f1c9a8 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_6 + rect: + serializedVersion: 2 + x: 256 + y: 256 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: b10f2b48b7281594bb8a24a6511a35af + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_7 + rect: + serializedVersion: 2 + x: 384 + y: 256 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 10a600f9329dc2246a897e89f4d283cd + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_8 + rect: + serializedVersion: 2 + x: 0 + y: 128 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 66cffa363b90ab14787d8a5b90cf4502 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_9 + rect: + serializedVersion: 2 + x: 128 + y: 128 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 55cf3d409c9b89349b1e1bdc1cc224ad + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_10 + rect: + serializedVersion: 2 + x: 256 + y: 128 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 2a9e58eaf96feef42bcefa1cf257193f + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_11 + rect: + serializedVersion: 2 + x: 384 + y: 128 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 2489120affc155840ae6a7be2e93ce19 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_12 + rect: + serializedVersion: 2 + x: 0 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 412349a150598d14da4d7140df5c0286 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_13 + rect: + serializedVersion: 2 + x: 128 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: a937464b42bb3634782dea34c6becb6c + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_5 + rect: + serializedVersion: 2 + x: 256 + y: 0 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: b0f933b217682124dbfc5e6b89abe3d0 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: EmojiOne_14 + rect: + serializedVersion: 2 + x: 128 + y: 256 + width: 128 + height: 128 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: f7235c763afe4434e8bb666750a41096 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 3e32d8f5477abfc43b19066e8ad5032e + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Textures/baseName_diffuseOriginal.png b/Assets/Textures/baseName_diffuseOriginal.png new file mode 100644 index 00000000..52934224 Binary files /dev/null and b/Assets/Textures/baseName_diffuseOriginal.png differ diff --git a/Assets/Textures/baseName_diffuseOriginal.png.meta b/Assets/Textures/baseName_diffuseOriginal.png.meta new file mode 100644 index 00000000..308c2179 --- /dev/null +++ b/Assets/Textures/baseName_diffuseOriginal.png.meta @@ -0,0 +1,112 @@ +fileFormatVersion: 2 +guid: d64f293f16e8ed54e9c767ae8872eb47 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: fd1bcdba13dd2524e9ac6a555a7fc387 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Textures/test2_Property.png b/Assets/Textures/test2_Property.png new file mode 100644 index 00000000..6d2b657e Binary files /dev/null and b/Assets/Textures/test2_Property.png differ diff --git a/Assets/Textures/test2_Property.png.meta b/Assets/Textures/test2_Property.png.meta new file mode 100644 index 00000000..7e629a34 --- /dev/null +++ b/Assets/Textures/test2_Property.png.meta @@ -0,0 +1,91 @@ +fileFormatVersion: 2 +guid: f7bde5e273d81494aa25d9e4f5940337 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Textures/test_Property.png b/Assets/Textures/test_Property.png new file mode 100644 index 00000000..b728ae8d Binary files /dev/null and b/Assets/Textures/test_Property.png differ diff --git a/Assets/Textures/test_Property.png.meta b/Assets/Textures/test_Property.png.meta new file mode 100644 index 00000000..4f30c2c1 --- /dev/null +++ b/Assets/Textures/test_Property.png.meta @@ -0,0 +1,91 @@ +fileFormatVersion: 2 +guid: dc38d958c4b6a7d47b09a827978d88a5 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/favorites.txt b/Assets/favorites.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/Builds/Materialize_IL2CPP_win_x64_1.4.0/Materialize.nsi b/Builds/Materialize_IL2CPP_win_x64_1.4.0/Materialize.nsi new file mode 100644 index 00000000..386186c6 --- /dev/null +++ b/Builds/Materialize_IL2CPP_win_x64_1.4.0/Materialize.nsi @@ -0,0 +1,125 @@ +# This installs two files, Materialize.exe and icon.ico, creates a start menu shortcut, builds an uninstaller, and +# adds uninstall information to the registry for Add/Remove Programs + +# To get started, put this script into a folder with the two files (Materialize.exe, icon.ico, and license.rtf - +# You'll have to create these yourself) and run makensis on it + +# If you change the names "Materialize.exe", "icon.ico", or "license.rtf" you should do a search and replace - they +# show up in a few places. +# All the other settings can be tweaked by editing the !defines at the top of this script +!define APPNAME "Materialize" +!define COMPANYNAME "Bounding Box Software" +!define DESCRIPTION "Materialize is a program for converting images to materials for use in video games and other 3D applications." +# These three must be integers +!define VERSIONMAJOR 1 +!define VERSIONMINOR 4 +!define VERSIONBUILD 0 +# These will be displayed by the "Click here for support information" link in "Add/Remove Programs" +# It is possible to use "mailto:" links in here to open the email client +!define HELPURL "https://github.com/ParkingLotGames/Materialize2019-by-finepointcgi/" # "Support Information" link +!define UPDATEURL "https://github.com/ParkingLotGames/Materialize2019-by-finepointcgi/" # "Product Updates" link +!define ABOUTURL "https://github.com/ParkingLotGames/Materialize2019-by-finepointcgi/" # "Publisher" link +# This is the size (in kB) of all the files copied into "Program Files" +!define INSTALLSIZE 79900 + +RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on) + +InstallDir "$PROGRAMFILES64\${COMPANYNAME}\${APPNAME}" + +# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n) +#LicenseData "license.rtf" +# This will be in the installer/uninstaller's title bar +Name "${COMPANYNAME} - ${APPNAME}" +Icon "icon.ico" +outFile "C:\Users\admin\MaterializeBuilds\Materialize_IL2CPP_win_x64.exe" + +!include LogicLib.nsh + +# Just three pages - license agreement, install location, and installation +# page license +page directory +Page instfiles + +!macro VerifyUserIsAdmin +UserInfo::GetAccountType +pop $0 +${If} $0 != "admin" ;Require admin rights on NT4+ + messageBox mb_iconstop "Administrator rights required!" + setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED + quit +${EndIf} +!macroend + +function .onInit + setShellVarContext all + !insertmacro VerifyUserIsAdmin +functionEnd + +section "install" + # Files for the install directory - to build the installer, these should be in the same directory as the install script (this file) + setOutPath $INSTDIR + # Files added here should be removed by the uninstaller (see section "uninstall") + file /r "*.*" + # Add any other files for the install directory (license files, app data, etc) here + + # Uninstaller - See function un.onInit and section "uninstall" for configuration + writeUninstaller "$INSTDIR\uninstall.exe" + + # Start Menu + createDirectory "$SMPROGRAMS\${APPNAME}" + createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\Materialize.exe" "" "$INSTDIR\icon.ico" + createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "" + + # Registry information for add/remove programs + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${COMPANYNAME} - ${APPNAME} - ${DESCRIPTION}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\icon.ico$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "$\"${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}$\"" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR} + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR} + # There is no option for modifying or repairing the install + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1 + # Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE} +sectionEnd + +# Uninstaller + +function un.onInit + SetShellVarContext all + + #Verify the uninstaller - last chance to back out + MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next + Abort + next: + !insertmacro VerifyUserIsAdmin +functionEnd + +section "uninstall" + + # Remove Start Menu launcher + delete "$SMPROGRAMS\${APPNAME}\*.lnk" + # Try to remove the Start Menu folder - this will only happen if it is empty + rmDir "$SMPROGRAMS\${APPNAME}" + + # Remove files + delete $INSTDIR\* + rmDir /r $INSTDIR\* + + # Always delete uninstaller as the last action + delete $INSTDIR\uninstall.exe + + # Try to remove the install directory - this will only happen if it is empty + rmDir /r $INSTDIR + rmDir /r "$PROGRAMFILES64\${COMPANYNAME}" + + # Remove uninstaller information from the registry + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" +sectionEnd \ No newline at end of file diff --git a/Builds/Materialize_IL2CPP_win_x64_1.4.0/icon.ico b/Builds/Materialize_IL2CPP_win_x64_1.4.0/icon.ico new file mode 100644 index 00000000..1b4c23e9 Binary files /dev/null and b/Builds/Materialize_IL2CPP_win_x64_1.4.0/icon.ico differ diff --git a/Builds/Materialize_Mono_win_x86_1.4.0/Materialize_x86.nsi b/Builds/Materialize_Mono_win_x86_1.4.0/Materialize_x86.nsi new file mode 100644 index 00000000..27c9364d --- /dev/null +++ b/Builds/Materialize_Mono_win_x86_1.4.0/Materialize_x86.nsi @@ -0,0 +1,125 @@ +# This installs two files, Materialize.exe and icon.ico, creates a start menu shortcut, builds an uninstaller, and +# adds uninstall information to the registry for Add/Remove Programs + +# To get started, put this script into a folder with the two files (Materialize.exe, icon.ico, and license.rtf - +# You'll have to create these yourself) and run makensis on it + +# If you change the names "Materialize.exe", "icon.ico", or "license.rtf" you should do a search and replace - they +# show up in a few places. +# All the other settings can be tweaked by editing the !defines at the top of this script +!define APPNAME "Materialize" +!define COMPANYNAME "Bounding Box Software" +!define DESCRIPTION "Materialize is a program for converting images to materials for use in video games and other 3D applications." +# These three must be integers +!define VERSIONMAJOR 1 +!define VERSIONMINOR 4 +!define VERSIONBUILD 0 +# These will be displayed by the "Click here for support information" link in "Add/Remove Programs" +# It is possible to use "mailto:" links in here to open the email client +!define HELPURL "https://github.com/ParkingLotGames/Materialize2019-by-finepointcgi/" # "Support Information" link +!define UPDATEURL "https://github.com/ParkingLotGames/Materialize2019-by-finepointcgi/" # "Product Updates" link +!define ABOUTURL "https://github.com/ParkingLotGames/Materialize2019-by-finepointcgi/" # "Publisher" link +# This is the size (in kB) of all the files copied into "Program Files" +!define INSTALLSIZE 79900 + +RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on) + +InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}" + +# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n) +#LicenseData "license.rtf" +# This will be in the installer/uninstaller's title bar +Name "${COMPANYNAME} - ${APPNAME}" +Icon "icon.ico" +outFile "C:\Users\admin\Destop\Materialize Builds\Materialize_Mono_win_x86.exe" + +!include LogicLib.nsh + +# Just three pages - license agreement, install location, and installation +# page license +page directory +Page instfiles + +!macro VerifyUserIsAdmin +UserInfo::GetAccountType +pop $0 +${If} $0 != "admin" ;Require admin rights on NT4+ + messageBox mb_iconstop "Administrator rights required!" + setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED + quit +${EndIf} +!macroend + +function .onInit + setShellVarContext all + !insertmacro VerifyUserIsAdmin +functionEnd + +section "install" + # Files for the install directory - to build the installer, these should be in the same directory as the install script (this file) + setOutPath $INSTDIR + # Files added here should be removed by the uninstaller (see section "uninstall") + file /r "*.*" + # Add any other files for the install directory (license files, app data, etc) here + + # Uninstaller - See function un.onInit and section "uninstall" for configuration + writeUninstaller "$INSTDIR\uninstall.exe" + + # Start Menu + createDirectory "$SMPROGRAMS\${APPNAME}" + createShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\Materialize.exe" "" "$INSTDIR\icon.ico" + createShortCut "$SMPROGRAMS\${APPNAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "" + + # Registry information for add/remove programs + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${COMPANYNAME} - ${APPNAME} - ${DESCRIPTION}" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\icon.ico$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\"" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "$\"${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}$\"" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR} + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR} + # There is no option for modifying or repairing the install + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1 + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1 + # Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE} +sectionEnd + +# Uninstaller + +function un.onInit + SetShellVarContext all + + #Verify the uninstaller - last chance to back out + MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next + Abort + next: + !insertmacro VerifyUserIsAdmin +functionEnd + +section "uninstall" + + # Remove Start Menu launcher + delete "$SMPROGRAMS\${APPNAME}\*.lnk" + # Try to remove the Start Menu folder - this will only happen if it is empty + rmDir "$SMPROGRAMS\${APPNAME}" + + # Remove files + delete $INSTDIR\* + rmDir /r $INSTDIR\* + + # Always delete uninstaller as the last action + delete $INSTDIR\uninstall.exe + + # Try to remove the install directory - this will only happen if it is empty + rmDir /r $INSTDIR + rmDir /r "$PROGRAMFILES\${COMPANYNAME}" + + # Remove uninstaller information from the registry + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" +sectionEnd \ No newline at end of file diff --git a/Builds/Materialize_Mono_win_x86_1.4.0/icon.ico b/Builds/Materialize_Mono_win_x86_1.4.0/icon.ico new file mode 100644 index 00000000..1b4c23e9 Binary files /dev/null and b/Builds/Materialize_Mono_win_x86_1.4.0/icon.ico differ diff --git a/Logs/Packages-Update.log b/Logs/Packages-Update.log index c93eb87a..c14cb65d 100644 --- a/Logs/Packages-Update.log +++ b/Logs/Packages-Update.log @@ -71,3 +71,64 @@ The following packages were updated: com.unity.ads from version 2.0.8 to 2.3.1 com.unity.analytics from version 3.0.9 to 3.2.2 com.unity.collab-proxy from version 1.2.11 to 1.2.15 + +=== Mon Apr 1 23:08:26 2019 + +Packages were changed. +Update Mode: updateDependencies + +The following packages were updated: + com.unity.package-manager-ui from version 2.0.3 to 2.0.7 + +=== Thu Apr 18 21:30:01 2019 + +Packages were changed. +Update Mode: updateDependencies + +The following packages were added: + com.unity.timeline@1.0.0 + com.unity.multiplayer-hlapi@1.0.2 + com.unity.xr.legacyinputhelpers@2.0.2 +The following packages were updated: + com.unity.analytics from version 3.2.2 to 3.3.2 + com.unity.collab-proxy from version 1.2.15 to 1.2.16 + com.unity.package-manager-ui from version 2.0.7 to 2.1.2 + com.unity.purchasing from version 2.0.3 to 2.0.6 + com.unity.textmeshpro from version 1.3.0 to 2.0.0 + +=== Sat Jul 6 22:29:03 2019 + +Packages were changed. +Update Mode: updateDependencies + +The following packages were updated: + com.unity.textmeshpro from version 2.0.0 to 2.0.1 + +=== Tue Sep 29 19:41:50 2020 + +Packages were changed. +Update Mode: updateDependencies + +The following packages were updated: + com.unity.ide.rider from version 1.1.0 to 1.1.4 + com.unity.ide.vscode from version 1.0.7 to 1.2.1 + com.unity.test-framework from version 1.0.13 to 1.1.16 + com.unity.timeline from version 1.1.0 to 1.2.6 +The following packages were removed: + com.unity.package-manager-ui@2.2.0 + +=== Mon Jan 9 15:13:27 2023 + +Packages were changed. +Update Mode: updateDependencies + +The following packages were added: + com.unity.ide.visualstudio@2.0.15 +The following packages were updated: + com.unity.collab-proxy from version 1.2.16 to 1.14.18 + com.unity.ext.nunit from version 1.0.0 to 1.0.6 + com.unity.ide.rider from version 1.1.4 to 1.2.1 + com.unity.ide.vscode from version 1.2.1 to 1.2.5 + com.unity.test-framework from version 1.1.16 to 1.1.31 + com.unity.textmeshpro from version 2.0.1 to 2.1.4 + com.unity.timeline from version 1.2.6 to 1.2.18 diff --git a/NOTES-WARNINGS.md b/NOTES-WARNINGS.md new file mode 100644 index 00000000..d312b22d --- /dev/null +++ b/NOTES-WARNINGS.md @@ -0,0 +1,6 @@ +Shader warning in 'Custom/SurfacePBS_Tess_Generated': floating point division by zero at line 205 (on d3d11) + +Compiling Fragment program with UNITY_PASS_FORWARDBASE DIRECTIONAL LIGHTPROBE_SH +Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING + +There is 22 missing scripts on play on LEGACY (Assume they are all legacy scripts removed by other contributors and there is no adverse effect but check with the BBS repository and remove or restore as needed) \ No newline at end of file diff --git a/Packages/manifest.json b/Packages/manifest.json index 16819bf7..e0b3759c 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,12 +1,19 @@ { "dependencies": { - "com.unity.ads": "2.3.1", - "com.unity.analytics": "3.2.2", - "com.unity.collab-proxy": "1.2.15", - "com.unity.package-manager-ui": "2.0.3", - "com.unity.purchasing": "2.0.3", - "com.unity.textmeshpro": "1.3.0", + "com.yasirkula.dynamicpanels": "https://github.com/yasirkula/UnityDynamicPanels.git", + "com.parkinglotgames.tessellatedquads": "https://github.com/ParkingLotGames/Tessellated-Quads.git", + "com.parkinglotgames.hierarchywindowgroupheader": "https://github.com/ParkingLotGames/HierarchyWindowGroupHeader.git", + "com.unity.ext.nunit": "1.0.6", + "com.unity.ide.rider": "1.2.1", + "com.unity.ide.visualstudio": "2.0.15", + "com.unity.ide.vscode": "1.2.5", + "com.unity.test-framework": "1.1.31", + "com.unity.textmeshpro": "2.1.4", + "com.unity.timeline": "1.2.18", + "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.4", + "com.unity.ugui": "1.0.0", "com.unity.modules.ai": "1.0.0", + "com.unity.modules.androidjni": "1.0.0", "com.unity.modules.animation": "1.0.0", "com.unity.modules.assetbundle": "1.0.0", "com.unity.modules.audio": "1.0.0", @@ -36,5 +43,15 @@ "com.unity.modules.vr": "1.0.0", "com.unity.modules.wind": "1.0.0", "com.unity.modules.xr": "1.0.0" - } + }, + "scopedRegistries": [ + { + "name": "package.openupm.com", + "url": "https://package.openupm.com", + "scopes": [ + "com.reactunity", + "com.reactunity.quickjs" + ] + } + ] } diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json new file mode 100644 index 00000000..a63b0fc6 --- /dev/null +++ b/Packages/packages-lock.json @@ -0,0 +1,366 @@ +{ + "dependencies": { + "com.parkinglotgames.hierarchywindowgroupheader": { + "version": "https://github.com/ParkingLotGames/HierarchyWindowGroupHeader.git", + "depth": 0, + "source": "git", + "dependencies": {}, + "hash": "926386e24796105ef0bd5f93b000388bdeea3f6b" + }, + "com.parkinglotgames.tessellatedquads": { + "version": "https://github.com/ParkingLotGames/Tessellated-Quads.git", + "depth": 0, + "source": "git", + "dependencies": {}, + "hash": "2daa9dd89776026729c57500fc465d46de5e7e4d" + }, + "com.unity.ext.nunit": { + "version": "1.0.6", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.ide.rider": { + "version": "1.2.1", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.test-framework": "1.1.1" + }, + "url": "https://packages.unity.com" + }, + "com.unity.ide.visualstudio": { + "version": "2.0.15", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.test-framework": "1.1.9" + }, + "url": "https://packages.unity.com" + }, + "com.unity.ide.vscode": { + "version": "1.2.5", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.sysroot": { + "version": "2.0.5", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.sysroot.linux-x86_64": { + "version": "2.0.4", + "depth": 1, + "source": "registry", + "dependencies": { + "com.unity.sysroot": "2.0.5" + }, + "url": "https://packages.unity.com" + }, + "com.unity.test-framework": { + "version": "1.1.31", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ext.nunit": "1.0.6", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.textmeshpro": { + "version": "2.1.4", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ugui": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.timeline": { + "version": "1.2.18", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.director": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.toolchain.win-x86_64-linux-x86_64": { + "version": "2.0.4", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.sysroot": "2.0.5", + "com.unity.sysroot.linux-x86_64": "2.0.4" + }, + "url": "https://packages.unity.com" + }, + "com.unity.ugui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0" + } + }, + "com.yasirkula.dynamicpanels": { + "version": "https://github.com/yasirkula/UnityDynamicPanels.git", + "depth": 0, + "source": "git", + "dependencies": {}, + "hash": "0d0a19d913191a33bff19e95d2794a4451f4d832" + }, + "com.unity.modules.ai": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.androidjni": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.animation": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.assetbundle": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.audio": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.cloth": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0" + } + }, + "com.unity.modules.director": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.animation": "1.0.0" + } + }, + "com.unity.modules.imageconversion": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.imgui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.jsonserialize": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.particlesystem": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics2d": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.screencapture": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.subsystems": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": { + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.terrain": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.terrainphysics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.terrain": "1.0.0" + } + }, + "com.unity.modules.tilemap": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics2d": "1.0.0" + } + }, + "com.unity.modules.ui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.uielements": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.umbra": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unityanalytics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + } + }, + "com.unity.modules.unitywebrequest": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unitywebrequestassetbundle": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestaudio": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.audio": "1.0.0" + } + }, + "com.unity.modules.unitywebrequesttexture": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestwww": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } + }, + "com.unity.modules.vehicles": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0" + } + }, + "com.unity.modules.video": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + } + }, + "com.unity.modules.vr": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.xr": "1.0.0" + } + }, + "com.unity.modules.wind": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.xr": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.subsystems": "1.0.0" + } + } + } +} diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index bb36b065..21478190 100644 Binary files a/ProjectSettings/EditorBuildSettings.asset and b/ProjectSettings/EditorBuildSettings.asset differ diff --git a/ProjectSettings/EditorSettings.asset b/ProjectSettings/EditorSettings.asset index 4f88c95f..312bb663 100644 Binary files a/ProjectSettings/EditorSettings.asset and b/ProjectSettings/EditorSettings.asset differ diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index 34842e0a..95498c17 100644 Binary files a/ProjectSettings/GraphicsSettings.asset and b/ProjectSettings/GraphicsSettings.asset differ diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index a36065eb..b239943a 100644 Binary files a/ProjectSettings/InputManager.asset and b/ProjectSettings/InputManager.asset differ diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset new file mode 100644 index 00000000..5a6f1d09 --- /dev/null +++ b/ProjectSettings/PackageManagerSettings.asset @@ -0,0 +1,48 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 61 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} + m_Name: + m_EditorClassIdentifier: + m_ScopedRegistriesSettingsExpanded: 1 + oneTimeWarningShown: 0 + m_Registries: + - m_Id: main + m_Name: + m_Url: https://packages.unity.com + m_Scopes: [] + m_IsDefault: 1 + - m_Id: scoped:package.openupm.com + m_Name: package.openupm.com + m_Url: https://package.openupm.com + m_Scopes: + - com.reactunity + - com.reactunity.quickjs + m_IsDefault: 0 + m_UserSelectedRegistryName: + m_UserAddingNewScopedRegistry: 0 + m_RegistryInfoDraft: + m_ErrorMessage: + m_Original: + m_Id: scoped:package.openupm.com + m_Name: package.openupm.com + m_Url: https://package.openupm.com + m_Scopes: + - com.reactunity + - com.reactunity.quickjs + m_IsDefault: 0 + m_Modified: 0 + m_Name: package.openupm.com + m_Url: https://package.openupm.com + m_Scopes: + - com.reactunity + - com.reactunity.quickjs + m_SelectedScopeIndex: 0 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 7051253f..bbd92776 100644 Binary files a/ProjectSettings/ProjectSettings.asset and b/ProjectSettings/ProjectSettings.asset differ diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 85074f53..4c191298 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1 +1,2 @@ -m_EditorVersion: 2018.3.7f1 +m_EditorVersion: 2019.4.40f1 +m_EditorVersionWithRevision: 2019.4.40f1 (ffc62b691db5) diff --git a/ProjectSettings/QualitySettings.asset b/ProjectSettings/QualitySettings.asset index a13f1c59..706129d0 100644 Binary files a/ProjectSettings/QualitySettings.asset and b/ProjectSettings/QualitySettings.asset differ diff --git a/ProjectSettings/UnityConnectSettings.asset b/ProjectSettings/UnityConnectSettings.asset index 2bdf5b46..08283193 100644 Binary files a/ProjectSettings/UnityConnectSettings.asset and b/ProjectSettings/UnityConnectSettings.asset differ diff --git a/ProjectSettings/XRSettings.asset b/ProjectSettings/XRSettings.asset new file mode 100644 index 00000000..482590c1 --- /dev/null +++ b/ProjectSettings/XRSettings.asset @@ -0,0 +1,10 @@ +{ + "m_SettingKeys": [ + "VR Device Disabled", + "VR Device User Alert" + ], + "m_SettingValues": [ + "False", + "False" + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 73010218..630a53ab 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,30 @@ # Materialize -Materialize is a program for converting images to materials for use mainly but not restrict to video games. +Materialize is a program for converting images to materials. -## Motivation -I decided to port materialize to linux, since the original is for windows only. I will keep improving it. +# Releases +https://github.com/ParkingLotGames/Materialize2019-by-finepointcgi/releases + +## Platforms +- Linux and Windows x64 - IL2CPP +- macOS and Windows x86 - Mono ## Contact -For sugestions, doubts or anything related to this port. -- Email : mk2play.materialize@gmail.com +For sugestions, doubts or anything related to this tool. +Make an issue and we can talk about it. -## Using -To use, unity is not necessary, you can use like a normal linux application. +# Building +### Prerequisites +- Unity 2019.4.40f1. +- IL2CPP module for Linux or win_x64. +- Remove Mono.Posix and Mono.WebBrowser from Assets/Plugins when building for win_x86 or macOS. -## Building -I'm developing using Unity 2018.3.3f, then, is recomended to use it also. You can try to downgrade or upgrade the package, but mainly downgrading, something can go wrong. +## Changelog: +- Switched build backend to IL2CPP +- Enabled the Incremental Garbage Collector +- Added the Vulkan API as fallback on Linux +- (In Progress) UnityDynamicPanels based UI - https://github.com/yasirkula/UnityDynamicPanels -## Added features +## Features added by finepointcgi ### Paste Images from clipboard on Linux - You can copy a file in your file browser (Tested with nautilus) and then press the "P" close to the slot you want to paste. - **Highlight** - You can also press copy image on browser and it will paste also. This make it fast to take a image from internet @@ -22,11 +32,19 @@ I'm developing using Unity 2018.3.3f, then, is recomended to use it also. You ca - The GUI is hidden when panning/rotating the material plane. ### Native File Picker - Added a new native file/folder picker - Unity Standalone File Browser - https://github.com/gkngkc/UnityStandaloneFileBrowser - Thanks to @gkngkc for the amazing work. + + ### Batch Textures Mode + - You can export multiple textures using the same settings. + + ### FPS Limiter + - This will limit your fps to 30 60 or 120 for your high refresh rate monitors. + + ## Changed from original -## Changed from original ### Save and Load Project -- When you save your project, every map will be saved in the same place, with them respective types, ex:myTexture_Diffuse.png. +- When you save your project, every map will be saved in the same place, with there respective types, ex:myTexture_Diffuse.png. - The extension used will be the one set in the GUI Panel. + #### Suported extensions ##### Save - jpg @@ -41,6 +59,12 @@ I'm developing using Unity 2018.3.3f, then, is recomended to use it also. You ca - exr - bmp -## Not implemented -- QuickSave - Will implement in settings, then you can set the folder to save the texture. This will be a persistent setting, that means you can close and open the program without lose the Quick Save path. *Planed for v0.4*. -- Copy to clipboard. *Planed for v0.4*. +## (Previous) Future Feature List by finepointcgi +Feel free to contribute to it and I'll merge your work but I don't think I can tackle these, I simply don't have the time, I'm updating and sharing the project because I need it for personal use. I can't make a full time commitment to this project, I'm just contributing what I can. +- QuickSave - Will implement in settings, then you can set the folder to save the texture. This will be a persistent setting, that means you can close and open the program without lose the Quick Save path. *Planned for .41* +- Copy to clipboard. +- New UI*Planned for .50* +- Ability to bake AO into Diffuse Map *Planned for .40* +- Add Texture Presets for Unreal Unity and Cryengine *Planned for .41* +- Create update notification system *Planned for .40* +- Create installer