mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
parent
bb625e768d
commit
49433588a3
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ac65cc6a62151319ac7424bb3cc91994840cdf9c1d8cc49deb958bd401855b2b
|
||||
oid sha256:670e33a0323f71039433bc3b562bb689595590100745228405556ae0f47993cd
|
||||
size 4294
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6a03b66a5aadfa17a7cd37431d3098c906a1e6764e129b523baad81e356e9fe6
|
||||
oid sha256:5cd7699beb81806ecb67f960516d89c97d25c0d576312744058c07f1dc956f9e
|
||||
size 26624
|
||||
|
@ -14,14 +14,14 @@ namespace ConformalDecals {
|
||||
public float depth = 1.0f;
|
||||
|
||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-opacity", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F2", guiUnits = "m"),
|
||||
UI_FloatRange(minValue = 0.05f, maxValue = 4f, stepIncrement = 0.05f)]
|
||||
UI_FloatRange(minValue = 0.0f, maxValue = 1f, stepIncrement = 0.05f)]
|
||||
public float opacity = 1.0f;
|
||||
|
||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-cutoff", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F2", guiUnits = "m"),
|
||||
UI_FloatRange(minValue = 0.05f, maxValue = 4f, stepIncrement = 0.05f)]
|
||||
UI_FloatRange(minValue = 0.0f, maxValue = 1f, stepIncrement = 0.05f)]
|
||||
public float cutoff = 0.5f;
|
||||
|
||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-aspectratio", guiActive = true, guiFormat = "F2")]
|
||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-aspectratio", guiActive = false, guiActiveEditor = true, guiFormat = "F2")]
|
||||
public float aspectRatio = 1.0f;
|
||||
|
||||
[KSPField] public string decalFront = string.Empty;
|
||||
@ -74,8 +74,6 @@ namespace ConformalDecals {
|
||||
if (decalFrontTransform == null) throw new FormatException($"Could not find decalFront transform: '{decalFront}'.");
|
||||
|
||||
// find back transform
|
||||
this.Log($"decalBack name is {decalBack}");
|
||||
this.Log($"updateBaseScale is {updateBackScale}");
|
||||
if (string.IsNullOrEmpty(decalBack)) {
|
||||
if (updateBackScale) {
|
||||
this.LogWarning("updateBackScale is true but has no specified decalBack transform!");
|
||||
@ -90,7 +88,7 @@ namespace ConformalDecals {
|
||||
|
||||
// find model transform
|
||||
if (string.IsNullOrEmpty(decalModel)) {
|
||||
decalModelTransform = decalFrontTransform;
|
||||
decalModelTransform = part.transform.Find("model");
|
||||
}
|
||||
else {
|
||||
decalModelTransform = part.FindModelTransform(decalModel);
|
||||
@ -232,7 +230,8 @@ namespace ConformalDecals {
|
||||
}
|
||||
|
||||
// hide preview model
|
||||
decalModelTransform.gameObject.SetActive(false);
|
||||
decalFrontTransform.gameObject.SetActive(false);
|
||||
decalBackTransform.gameObject.SetActive(false);
|
||||
|
||||
// add to preCull delegate
|
||||
Camera.onPreCull += Render;
|
||||
@ -245,7 +244,8 @@ namespace ConformalDecals {
|
||||
_isAttached = false;
|
||||
|
||||
// unhide preview model
|
||||
decalModelTransform.gameObject.SetActive(true);
|
||||
decalFrontTransform.gameObject.SetActive(true);
|
||||
decalBackTransform.gameObject.SetActive(true);
|
||||
|
||||
// remove from preCull delegate
|
||||
Camera.onPreCull -= Render;
|
||||
|
@ -69,7 +69,7 @@ namespace ConformalDecals {
|
||||
public bool Render(Material decalMaterial, MaterialPropertyBlock partMPB, Camera camera) {
|
||||
if (_projectionEnabled) {
|
||||
decalMPB.SetFloat(PropertyIDs._RimFalloff, partMPB.GetFloat(PropertyIDs._RimFalloff));
|
||||
decalMPB.SetColor(PropertyIDs._RimColor, partMPB.GetColor(PropertyIDs._RimFalloff));
|
||||
decalMPB.SetColor(PropertyIDs._RimColor, partMPB.GetColor(PropertyIDs._RimColor));
|
||||
|
||||
Graphics.DrawMesh(_targetMesh, target.localToWorldMatrix, decalMaterial, 0, camera, 0, decalMPB, ShadowCastingMode.Off, true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user