mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Compare commits
2 Commits
6b7996fdd7
...
3173dd914a
Author | SHA1 | Date | |
---|---|---|---|
3173dd914a | |||
5f6712f476 |
Binary file not shown.
@ -12,8 +12,8 @@
|
|||||||
"KSP_VERSION":
|
"KSP_VERSION":
|
||||||
{
|
{
|
||||||
"MAJOR":1,
|
"MAJOR":1,
|
||||||
"MINOR":10,
|
"MINOR":11,
|
||||||
"PATCH":1
|
"PATCH":0
|
||||||
},
|
},
|
||||||
"KSP_VERSION_MIN":{
|
"KSP_VERSION_MIN":{
|
||||||
"MAJOR":1,
|
"MAJOR":1,
|
||||||
@ -22,7 +22,7 @@
|
|||||||
},
|
},
|
||||||
"KSP_VERSION_MAX":{
|
"KSP_VERSION_MAX":{
|
||||||
"MAJOR":1,
|
"MAJOR":1,
|
||||||
"MINOR":10,
|
"MINOR":11,
|
||||||
"PATCH":99
|
"PATCH":99
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,10 +89,8 @@ namespace ConformalDecals {
|
|||||||
[KSPField] public Transform decalProjectorTransform;
|
[KSPField] public Transform decalProjectorTransform;
|
||||||
[KSPField] public Transform decalColliderTransform;
|
[KSPField] public Transform decalColliderTransform;
|
||||||
|
|
||||||
[KSPField] public MeshRenderer boundsRenderer;
|
[KSPField] public Material backMaterial;
|
||||||
[KSPField] public MeshRenderer frontRenderer;
|
[KSPField] public Vector2 backTextureBaseScale;
|
||||||
[KSPField] public Material backMaterial;
|
|
||||||
[KSPField] public Vector2 backTextureBaseScale;
|
|
||||||
|
|
||||||
private const int DecalQueueMin = 2100;
|
private const int DecalQueueMin = 2100;
|
||||||
private const int DecalQueueMax = 2400;
|
private const int DecalQueueMax = 2400;
|
||||||
@ -103,8 +101,9 @@ namespace ConformalDecals {
|
|||||||
private bool _isAttached;
|
private bool _isAttached;
|
||||||
private Matrix4x4 _orthoMatrix;
|
private Matrix4x4 _orthoMatrix;
|
||||||
|
|
||||||
private Material _decalMaterial;
|
private Material _decalMaterial;
|
||||||
private Material _previewMaterial;
|
private Material _previewMaterial;
|
||||||
|
private MeshRenderer _boundsRenderer;
|
||||||
|
|
||||||
private int DecalQueue {
|
private int DecalQueue {
|
||||||
get {
|
get {
|
||||||
@ -133,33 +132,24 @@ namespace ConformalDecals {
|
|||||||
public override void OnLoad(ConfigNode node) {
|
public override void OnLoad(ConfigNode node) {
|
||||||
try {
|
try {
|
||||||
// SETUP TRANSFORMS
|
// SETUP TRANSFORMS
|
||||||
// Projector transform, where the decal is projected from when attached
|
|
||||||
decalProjectorTransform = part.FindModelTransform(decalProjector);
|
|
||||||
if (decalProjectorTransform == null) throw new FormatException($"Could not find decalProjector transform: '{decalProjector}'.");
|
|
||||||
|
|
||||||
// Model transform, containing all visible elements of the decal when not attached
|
|
||||||
decalModelTransform = part.FindModelTransform(decalModel);
|
|
||||||
if (decalModelTransform == null) throw new FormatException($"Could not find decalModel transform: '{decalModel}'.");
|
|
||||||
|
|
||||||
// Front transform, shows a preview of the decal when unattached
|
|
||||||
decalFrontTransform = part.FindModelTransform(decalFront);
|
decalFrontTransform = part.FindModelTransform(decalFront);
|
||||||
if (decalFrontTransform == null) throw new FormatException($"Could not find decalFront transform: '{decalFront}'.");
|
if (decalFrontTransform == null) throw new FormatException($"Could not find decalFront transform: '{decalFront}'.");
|
||||||
|
|
||||||
frontRenderer = decalFrontTransform.GetComponent<MeshRenderer>();
|
decalBackTransform = part.FindModelTransform(decalBack);
|
||||||
|
if (decalBackTransform == null) throw new FormatException($"Could not find decalBack transform: '{decalBack}'.");
|
||||||
|
|
||||||
|
decalModelTransform = part.FindModelTransform(decalModel);
|
||||||
|
if (decalModelTransform == null) throw new FormatException($"Could not find decalModel transform: '{decalModel}'.");
|
||||||
|
|
||||||
|
decalProjectorTransform = part.FindModelTransform(decalProjector);
|
||||||
|
if (decalProjectorTransform == null) throw new FormatException($"Could not find decalProjector transform: '{decalProjector}'.");
|
||||||
|
|
||||||
// Collider transform, selectable area and shows where the decal is projecting onto
|
|
||||||
decalColliderTransform = part.FindModelTransform(decalCollider);
|
decalColliderTransform = part.FindModelTransform(decalCollider);
|
||||||
if (decalColliderTransform == null) throw new FormatException($"Could not find decalCollider transform: '{decalCollider}'.");
|
if (decalColliderTransform == null) throw new FormatException($"Could not find decalCollider transform: '{decalCollider}'.");
|
||||||
|
|
||||||
boundsRenderer = decalColliderTransform.GetComponent<MeshRenderer>();
|
// SETUP BACK MATERIAL
|
||||||
|
|
||||||
// SETUP BACK
|
|
||||||
if (updateBackScale) {
|
if (updateBackScale) {
|
||||||
decalBackTransform = part.FindModelTransform(decalBack);
|
|
||||||
if (decalBackTransform == null) throw new FormatException($"Could not find decalBack transform: '{decalBack}'.");
|
|
||||||
|
|
||||||
var backRenderer = decalBackTransform.GetComponent<MeshRenderer>();
|
var backRenderer = decalBackTransform.GetComponent<MeshRenderer>();
|
||||||
|
|
||||||
if (backRenderer == null) {
|
if (backRenderer == null) {
|
||||||
this.LogError($"Specified decalBack transform {decalBack} has no renderer attached! Setting updateBackScale to false.");
|
this.LogError($"Specified decalBack transform {decalBack} has no renderer attached! Setting updateBackScale to false.");
|
||||||
updateBackScale = false;
|
updateBackScale = false;
|
||||||
@ -254,8 +244,7 @@ namespace ConformalDecals {
|
|||||||
public override void OnStart(StartState state) {
|
public override void OnStart(StartState state) {
|
||||||
materialProperties.RenderQueue = DecalQueue;
|
materialProperties.RenderQueue = DecalQueue;
|
||||||
|
|
||||||
boundsRenderer = decalProjectorTransform.GetComponent<MeshRenderer>();
|
_boundsRenderer = decalProjectorTransform.GetComponent<MeshRenderer>();
|
||||||
frontRenderer = decalFrontTransform.GetComponent<MeshRenderer>();
|
|
||||||
|
|
||||||
// handle tweakables
|
// handle tweakables
|
||||||
if (HighLogic.LoadedSceneIsEditor) {
|
if (HighLogic.LoadedSceneIsEditor) {
|
||||||
@ -289,7 +278,7 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
if (!selectableInFlight || !DecalConfig.SelectableInFlight) {
|
if (!selectableInFlight || !DecalConfig.SelectableInFlight) {
|
||||||
decalColliderTransform.GetComponent<Collider>().enabled = false;
|
decalColliderTransform.GetComponent<Collider>().enabled = false;
|
||||||
boundsRenderer.enabled = false;
|
_boundsRenderer.enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -451,7 +440,7 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
// update projection
|
// update projection
|
||||||
foreach (var target in _targets) {
|
foreach (var target in _targets) {
|
||||||
target.Project(_orthoMatrix, decalProjectorTransform, boundsRenderer.bounds, useBaseNormal);
|
target.Project(_orthoMatrix, decalProjectorTransform, _boundsRenderer.bounds, useBaseNormal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -476,7 +465,7 @@ namespace ConformalDecals {
|
|||||||
_decalMaterial = materialProperties.DecalMaterial;
|
_decalMaterial = materialProperties.DecalMaterial;
|
||||||
_previewMaterial = materialProperties.PreviewMaterial;
|
_previewMaterial = materialProperties.PreviewMaterial;
|
||||||
|
|
||||||
if (!_isAttached) frontRenderer.material = _previewMaterial;
|
if (!_isAttached) decalFrontTransform.GetComponent<MeshRenderer>().material = _previewMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdateTargets() {
|
protected void UpdateTargets() {
|
||||||
|
@ -31,7 +31,6 @@ namespace ConformalDecals.Text {
|
|||||||
/// Update text immediately without using job queue
|
/// Update text immediately without using job queue
|
||||||
public static TextRenderOutput UpdateText(DecalText oldText, DecalText newText) {
|
public static TextRenderOutput UpdateText(DecalText oldText, DecalText newText) {
|
||||||
if (newText == null) throw new ArgumentNullException(nameof(newText));
|
if (newText == null) throw new ArgumentNullException(nameof(newText));
|
||||||
Logging.Log($"Rendering text {newText}");
|
|
||||||
|
|
||||||
if (!(oldText is null)) UnregisterText(oldText);
|
if (!(oldText is null)) UnregisterText(oldText);
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
v0.2.7
|
v0.2.7
|
||||||
------
|
------
|
||||||
|
- Supported KSP versions: 1.8.x to 1.11.x
|
||||||
|
- Notes:
|
||||||
|
- Attaching decal parts in flight using engineer kerbals is not supported.
|
||||||
- Fixes:
|
- Fixes:
|
||||||
- Fixed certain non-ascii strings not rendering correctly under certain circumstances.
|
- Fixed certain non-ascii strings not rendering correctly under certain circumstances.
|
||||||
- Yet another attempted fix for the planet text glitch.
|
- Yet another attempted fix for the planet text glitch.
|
||||||
- Changes:
|
|
||||||
- Small optimizations and simplified text rendering.
|
|
||||||
|
|
||||||
v0.2.6
|
v0.2.6
|
||||||
------
|
------
|
||||||
|
Loading…
Reference in New Issue
Block a user