mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
parent
91a6613707
commit
d54887414f
Binary file not shown.
Binary file not shown.
@ -14,14 +14,14 @@ namespace ConformalDecals {
|
|||||||
public float depth = 1.0f;
|
public float depth = 1.0f;
|
||||||
|
|
||||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-opacity", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F2", guiUnits = "m"),
|
[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;
|
public float opacity = 1.0f;
|
||||||
|
|
||||||
[KSPField(guiName = "#LOC_ConformalDecals_gui-cutoff", guiActive = false, guiActiveEditor = true, isPersistant = true, guiFormat = "F2", guiUnits = "m"),
|
[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;
|
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;
|
public float aspectRatio = 1.0f;
|
||||||
|
|
||||||
[KSPField] public string decalFront = string.Empty;
|
[KSPField] public string decalFront = string.Empty;
|
||||||
@ -74,8 +74,6 @@ namespace ConformalDecals {
|
|||||||
if (decalFrontTransform == null) throw new FormatException($"Could not find decalFront transform: '{decalFront}'.");
|
if (decalFrontTransform == null) throw new FormatException($"Could not find decalFront transform: '{decalFront}'.");
|
||||||
|
|
||||||
// find back transform
|
// find back transform
|
||||||
this.Log($"decalBack name is {decalBack}");
|
|
||||||
this.Log($"updateBaseScale is {updateBackScale}");
|
|
||||||
if (string.IsNullOrEmpty(decalBack)) {
|
if (string.IsNullOrEmpty(decalBack)) {
|
||||||
if (updateBackScale) {
|
if (updateBackScale) {
|
||||||
this.LogWarning("updateBackScale is true but has no specified decalBack transform!");
|
this.LogWarning("updateBackScale is true but has no specified decalBack transform!");
|
||||||
@ -90,7 +88,7 @@ namespace ConformalDecals {
|
|||||||
|
|
||||||
// find model transform
|
// find model transform
|
||||||
if (string.IsNullOrEmpty(decalModel)) {
|
if (string.IsNullOrEmpty(decalModel)) {
|
||||||
decalModelTransform = decalFrontTransform;
|
decalModelTransform = part.transform.Find("model");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
decalModelTransform = part.FindModelTransform(decalModel);
|
decalModelTransform = part.FindModelTransform(decalModel);
|
||||||
@ -232,7 +230,8 @@ namespace ConformalDecals {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hide preview model
|
// hide preview model
|
||||||
decalModelTransform.gameObject.SetActive(false);
|
decalFrontTransform.gameObject.SetActive(false);
|
||||||
|
decalBackTransform.gameObject.SetActive(false);
|
||||||
|
|
||||||
// add to preCull delegate
|
// add to preCull delegate
|
||||||
Camera.onPreCull += Render;
|
Camera.onPreCull += Render;
|
||||||
@ -245,7 +244,8 @@ namespace ConformalDecals {
|
|||||||
_isAttached = false;
|
_isAttached = false;
|
||||||
|
|
||||||
// unhide preview model
|
// unhide preview model
|
||||||
decalModelTransform.gameObject.SetActive(true);
|
decalFrontTransform.gameObject.SetActive(true);
|
||||||
|
decalBackTransform.gameObject.SetActive(true);
|
||||||
|
|
||||||
// remove from preCull delegate
|
// remove from preCull delegate
|
||||||
Camera.onPreCull -= Render;
|
Camera.onPreCull -= Render;
|
||||||
|
@ -69,7 +69,7 @@ namespace ConformalDecals {
|
|||||||
public bool Render(Material decalMaterial, MaterialPropertyBlock partMPB, Camera camera) {
|
public bool Render(Material decalMaterial, MaterialPropertyBlock partMPB, Camera camera) {
|
||||||
if (_projectionEnabled) {
|
if (_projectionEnabled) {
|
||||||
decalMPB.SetFloat(PropertyIDs._RimFalloff, partMPB.GetFloat(PropertyIDs._RimFalloff));
|
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);
|
Graphics.DrawMesh(_targetMesh, target.localToWorldMatrix, decalMaterial, 0, camera, 0, decalMPB, ShadowCastingMode.Off, true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user