mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Fix corrupted text rendering
Fix text corruption when rendering text right after a scene change by delaying it by a single frame in OnLoad
This commit is contained in:
parent
98a790630e
commit
1ebed608a8
Binary file not shown.
@ -6,7 +6,7 @@
|
|||||||
{
|
{
|
||||||
"MAJOR":0,
|
"MAJOR":0,
|
||||||
"MINOR":2,
|
"MINOR":2,
|
||||||
"PATCH":1,
|
"PATCH":2,
|
||||||
"BUILD":0
|
"BUILD":0
|
||||||
},
|
},
|
||||||
"KSP_VERSION":
|
"KSP_VERSION":
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Conformal Decals v0.2.1
|
# Conformal Decals v0.2.2
|
||||||
[![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)
|
[![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)
|
![Screenshot](http://pileof.rocks/KSP/images/ConformalDecalsHeader.png)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections;
|
||||||
using ConformalDecals.MaterialProperties;
|
using ConformalDecals.MaterialProperties;
|
||||||
using ConformalDecals.Text;
|
using ConformalDecals.Text;
|
||||||
using ConformalDecals.UI;
|
using ConformalDecals.UI;
|
||||||
@ -99,7 +100,15 @@ namespace ConformalDecals {
|
|||||||
base.OnLoad(node);
|
base.OnLoad(node);
|
||||||
OnAfterDeserialize();
|
OnAfterDeserialize();
|
||||||
|
|
||||||
UpdateTextRecursive();
|
if (HighLogic.LoadedSceneIsGame) {
|
||||||
|
// For some reason, rendering doesnt work right on the first frame a scene is loaded
|
||||||
|
// So delay any rendering until the next frame when called in OnLoad
|
||||||
|
// This is probably a problem with Unity, not KSP
|
||||||
|
StartCoroutine(UpdateTextLate());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
UpdateText();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSave(ConfigNode node) {
|
public override void OnSave(ConfigNode node) {
|
||||||
@ -107,12 +116,6 @@ namespace ConformalDecals {
|
|||||||
base.OnSave(node);
|
base.OnSave(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnStart(StartState state) {
|
|
||||||
base.OnStart(state);
|
|
||||||
|
|
||||||
UpdateTextRecursive();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnAwake() {
|
public override void OnAwake() {
|
||||||
base.OnAwake();
|
base.OnAwake();
|
||||||
|
|
||||||
@ -210,7 +213,7 @@ namespace ConformalDecals {
|
|||||||
public void OnAfterDeserialize() {
|
public void OnAfterDeserialize() {
|
||||||
_font = DecalConfig.GetFont(fontName);
|
_font = DecalConfig.GetFont(fontName);
|
||||||
_style = new DecalTextStyle((FontStyles) style, vertical, lineSpacing, charSpacing);
|
_style = new DecalTextStyle((FontStyles) style, vertical, lineSpacing, charSpacing);
|
||||||
|
|
||||||
if (!ParseUtil.TryParseColor32(fillColor, out _fillColor)) {
|
if (!ParseUtil.TryParseColor32(fillColor, out _fillColor)) {
|
||||||
Logging.LogWarning($"Improperly formatted color value for fill: '{fillColor}'");
|
Logging.LogWarning($"Improperly formatted color value for fill: '{fillColor}'");
|
||||||
_fillColor = Color.magenta;
|
_fillColor = Color.magenta;
|
||||||
@ -252,6 +255,11 @@ namespace ConformalDecals {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerator UpdateTextLate() {
|
||||||
|
yield return null;
|
||||||
|
UpdateText();
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateText() {
|
private void UpdateText() {
|
||||||
// Render text
|
// Render text
|
||||||
var newText = new DecalText(text, _font, _style);
|
var newText = new DecalText(text, _font, _style);
|
||||||
|
@ -257,6 +257,7 @@ namespace ConformalDecals.Text {
|
|||||||
Graphics.SetRenderTarget(renderTex);
|
Graphics.SetRenderTarget(renderTex);
|
||||||
GL.PushMatrix();
|
GL.PushMatrix();
|
||||||
GL.LoadProjectionMatrix(matrix);
|
GL.LoadProjectionMatrix(matrix);
|
||||||
|
GL.LoadIdentity();
|
||||||
GL.Clear(false, true, Color.black);
|
GL.Clear(false, true, Color.black);
|
||||||
|
|
||||||
for (var i = 0; i < meshes.Length; i++) {
|
for (var i = 0; i < meshes.Length; i++) {
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
|
v0.2.2
|
||||||
|
------
|
||||||
|
- Fixes:
|
||||||
|
- Fixed corrupted text rendering when a vessel loads during a scene change.
|
||||||
|
|
||||||
v0.2.1
|
v0.2.1
|
||||||
------
|
------
|
||||||
- Changes
|
- Changes:
|
||||||
- Pressing enter in the text entry window now types a newline.
|
- Pressing enter in the text entry window now types a newline.
|
||||||
- Fixes
|
- Fixes:
|
||||||
- Renamed font assetbundle. The old extension was causing the game to try to load it twice on Windows due to legacy compatability features.
|
- 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.
|
- Fixed text rendering on DirectX resulting in black boxes by using ARGB32 instead of RG16 for the render texture in DirectX.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user