diff --git a/Assets/UI/TextEntryPanel.prefab b/Assets/UI/TextEntryPanel.prefab index 2557602..17cf486 100644 --- a/Assets/UI/TextEntryPanel.prefab +++ b/Assets/UI/TextEntryPanel.prefab @@ -883,7 +883,7 @@ MonoBehaviour: m_InputType: 0 m_AsteriskChar: 42 m_KeyboardType: 0 - m_LineType: 1 + m_LineType: 2 m_HideMobileInput: 0 m_CharacterValidation: 0 m_RegexValue: @@ -1407,7 +1407,7 @@ MonoBehaviour: m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} m_isInputParsingRequired: 0 - m_inputSource: 0 + m_inputSource: 3 m_hasFontAssetChanged: 0 m_subTextObjects: - {fileID: 0} @@ -3679,7 +3679,7 @@ MonoBehaviour: m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} m_isInputParsingRequired: 0 - m_inputSource: 3 + m_inputSource: 0 m_hasFontAssetChanged: 0 m_subTextObjects: - {fileID: 0} @@ -3838,7 +3838,7 @@ MonoBehaviour: m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} m_isInputParsingRequired: 0 - m_inputSource: 3 + m_inputSource: 0 m_hasFontAssetChanged: 0 m_subTextObjects: - {fileID: 0} diff --git a/GameData/ConformalDecals/Plugins/ConformalDecals.dll b/GameData/ConformalDecals/Plugins/ConformalDecals.dll index d6fc903..efb093e 100644 Binary files a/GameData/ConformalDecals/Plugins/ConformalDecals.dll and b/GameData/ConformalDecals/Plugins/ConformalDecals.dll differ diff --git a/GameData/ConformalDecals/Resources/conformaldecals.decalfont b/GameData/ConformalDecals/Resources/conformaldecals.decalfont new file mode 100644 index 0000000..bbe2eaa Binary files /dev/null and b/GameData/ConformalDecals/Resources/conformaldecals.decalfont differ diff --git a/GameData/ConformalDecals/Resources/conformaldecals.kspfont b/GameData/ConformalDecals/Resources/conformaldecals.kspfont deleted file mode 100644 index 3a82b57..0000000 --- a/GameData/ConformalDecals/Resources/conformaldecals.kspfont +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8580f3c17793051fdc08447401fb7920665ad681ff352588508044b662a3240b -size 364900 diff --git a/GameData/ConformalDecals/Resources/ui.conformaldecals b/GameData/ConformalDecals/Resources/ui.conformaldecals index 062eff7..a286abb 100644 Binary files a/GameData/ConformalDecals/Resources/ui.conformaldecals and b/GameData/ConformalDecals/Resources/ui.conformaldecals differ diff --git a/GameData/ConformalDecals/Versioning/ConformalDecals.version b/GameData/ConformalDecals/Versioning/ConformalDecals.version index 4394fde..15b06f1 100644 --- a/GameData/ConformalDecals/Versioning/ConformalDecals.version +++ b/GameData/ConformalDecals/Versioning/ConformalDecals.version @@ -6,7 +6,7 @@ { "MAJOR":0, "MINOR":2, - "PATCH":0, + "PATCH":1, "BUILD":0 }, "KSP_VERSION": diff --git a/README.md b/README.md index 685c2b2..285a4b3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Conformal Decals v0.2.0 +# Conformal Decals v0.2.1 [![Build Status](https://travis-ci.org/drewcassidy/KSP-Conformal-Decals.svg?branch=release)](https://travis-ci.org/drewcassidy/KSP-Conformal-Decals) [![Art: CC BY-SA 4.0](https://img.shields.io/badge/Art%20License-CC%20BY--SA%204.0-orange.svg)](https://creativecommons.org/licenses/by-sa/4.0/) [![Code: GPL v3](https://img.shields.io/badge/Code%20License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) ![Screenshot](http://pileof.rocks/KSP/images/ConformalDecalsHeader.png) diff --git a/Source/ConformalDecals/ConformalDecals.csproj b/Source/ConformalDecals/ConformalDecals.csproj index 633ca50..8ab7fce 100644 --- a/Source/ConformalDecals/ConformalDecals.csproj +++ b/Source/ConformalDecals/ConformalDecals.csproj @@ -36,6 +36,9 @@ dlls/Assembly-CSharp.dll + + dlls\KSPAssets.dll + dlls/Shabby.dll diff --git a/Source/ConformalDecals/Text/FontLoader.cs b/Source/ConformalDecals/Text/FontLoader.cs index 1fe5863..01f16ad 100644 --- a/Source/ConformalDecals/Text/FontLoader.cs +++ b/Source/ConformalDecals/Text/FontLoader.cs @@ -8,7 +8,7 @@ using UnityEngine; namespace ConformalDecals.Text { /// KSP database loader for KSPFont files which contain TextMeshPro font assets - [DatabaseLoaderAttrib(new[] {"kspfont"})] + [DatabaseLoaderAttrib(new[] {"decalfont"})] public class FontLoader : DatabaseLoader { private const string FallbackName = "NotoSans-Regular SDF"; private static TMP_FontAsset _fallbackFont; diff --git a/Source/ConformalDecals/Text/TextRenderer.cs b/Source/ConformalDecals/Text/TextRenderer.cs index 5f25400..4aef069 100644 --- a/Source/ConformalDecals/Text/TextRenderer.cs +++ b/Source/ConformalDecals/Text/TextRenderer.cs @@ -4,6 +4,7 @@ using ConformalDecals.Util; using TMPro; using UnityEngine; using UnityEngine.Events; +using UnityEngine.Rendering; namespace ConformalDecals.Text { // TODO: Testing shows the job system is unnecessary, so remove job system code. @@ -15,10 +16,11 @@ namespace ConformalDecals.Text { /// Texture format used for returned textures. /// Unfortunately due to how Unity textures work, this cannot be R8 or Alpha8, /// so theres always a superfluous green channel using memory - public const TextureFormat TextTextureFormat = TextureFormat.RG16; + public static TextureFormat textTextureFormat = TextureFormat.RG16; /// Render Texture format used when rendering - public const RenderTextureFormat TextRenderTextureFormat = RenderTextureFormat.R8; + /// Overriden below to be ARGB32 on DirectX because DirectX is dumb + public static RenderTextureFormat textRenderTextureFormat = RenderTextureFormat.R8; /// The text renderer object within the scene which contains the TextMeshPro component used for rendering. public static TextRenderer Instance { @@ -84,6 +86,15 @@ namespace ConformalDecals.Text { Logging.Log("Creating TextRenderer Object"); _instance = this; DontDestroyOnLoad(gameObject); + if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12) { + textRenderTextureFormat = RenderTextureFormat.ARGB32; // DirectX is dumb + } + if (!SystemInfo.SupportsTextureFormat(textTextureFormat)) { + Logging.LogError($"Text texture format {textTextureFormat} not supported on this platform."); + } + if (!SystemInfo.SupportsRenderTextureFormat(textRenderTextureFormat)) { + Logging.LogError($"Text texture format {textRenderTextureFormat} not supported on this platform."); + } } /// Setup this text renderer instance for rendering @@ -227,10 +238,10 @@ namespace ConformalDecals.Text { // SETUP TEXTURE if (texture == null) { - texture = new Texture2D(textureSize.x, textureSize.y, TextTextureFormat, true); + texture = new Texture2D(textureSize.x, textureSize.y, textTextureFormat, true); } - else if (texture.width != textureSize.x || texture.height != textureSize.y || texture.format != TextTextureFormat) { - texture.Resize(textureSize.x, textureSize.y, TextTextureFormat, true); + else if (texture.width != textureSize.x || texture.height != textureSize.y || texture.format != textTextureFormat) { + texture.Resize(textureSize.x, textureSize.y, textTextureFormat, true); } // GENERATE PROJECTION MATRIX @@ -239,7 +250,7 @@ namespace ConformalDecals.Text { bounds.center.y - halfSize.y, bounds.center.y + halfSize.y, -1, 1); // GET RENDERTEX - var renderTex = RenderTexture.GetTemporary(textureSize.x, textureSize.y, 0, TextRenderTextureFormat, RenderTextureReadWrite.Linear, 1); + var renderTex = RenderTexture.GetTemporary(textureSize.x, textureSize.y, 0, textRenderTextureFormat, RenderTextureReadWrite.Linear, 1); renderTex.autoGenerateMips = false; // RENDER diff --git a/changelog.txt b/changelog.txt index 238b8d8..71c69d1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,11 @@ +v0.2.1 +------ +- Changes + - Pressing enter in the text entry window now types a newline. +- Fixes + - Renamed font assetbundle. The old extension was causing the game to try to load it twice on Windows due to legacy compatability features. + - Fixed text rendering on DirectX resulting in black boxes by using ARGB32 instead of RG16 for the render texture in DirectX. + v0.2.0 ------ - New Parts: