Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
drewcassidy committed Oct 4, 2020
2 parents ea08bd8 + 0066cc3 commit 880f463
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Assets/UI/TextEntryPanel.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
Binary file modified GameData/ConformalDecals/Plugins/ConformalDecals.dll
Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions GameData/ConformalDecals/Resources/conformaldecals.kspfont

This file was deleted.

Binary file modified GameData/ConformalDecals/Resources/ui.conformaldecals
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"MAJOR":0,
"MINOR":2,
"PATCH":0,
"PATCH":1,
"BUILD":0
},
"KSP_VERSION":
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 3 additions & 0 deletions Source/ConformalDecals/ConformalDecals.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>dlls/Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="KSPAssets, Version=1.4.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>dlls\KSPAssets.dll</HintPath>
</Reference>
<Reference Include="Shabby, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>dlls/Shabby.dll</HintPath>
</Reference>
Expand Down
2 changes: 1 addition & 1 deletion Source/ConformalDecals/Text/FontLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace ConformalDecals.Text {
/// KSP database loader for KSPFont files which contain TextMeshPro font assets
[DatabaseLoaderAttrib(new[] {"kspfont"})]
[DatabaseLoaderAttrib(new[] {"decalfont"})]
public class FontLoader : DatabaseLoader<GameDatabase.TextureInfo> {
private const string FallbackName = "NotoSans-Regular SDF";
private static TMP_FontAsset _fallbackFont;
Expand Down
23 changes: 17 additions & 6 deletions Source/ConformalDecals/Text/TextRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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.
Expand All @@ -15,10 +16,11 @@ public class TextRenderer : MonoBehaviour {
/// 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 {
Expand Down Expand Up @@ -84,6 +86,15 @@ private void Start() {
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
Expand Down Expand Up @@ -227,10 +238,10 @@ public TextRenderOutput RenderText(DecalText text, Texture2D texture) {

// 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
Expand All @@ -239,7 +250,7 @@ public TextRenderOutput RenderText(DecalText text, Texture2D texture) {
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
Expand Down
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 880f463

Please sign in to comment.