mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fixed star fog LOD stuff
This commit is contained in:
parent
8e502f2c28
commit
44f87131c9
@ -126,7 +126,7 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
funnelGO.transform.localPosition = Vector3.zero;
|
funnelGO.transform.localPosition = Vector3.zero;
|
||||||
|
|
||||||
var funnelSizeController = funnelGO.AddComponent<FunnelSizeController>();
|
var funnelSizeController = funnelGO.AddComponent<FunnelController>();
|
||||||
|
|
||||||
if(module.Curve != null)
|
if(module.Curve != null)
|
||||||
{
|
{
|
||||||
@ -137,12 +137,13 @@ namespace NewHorizons.Builder.Body
|
|||||||
}
|
}
|
||||||
funnelSizeController.scaleCurve = curve;
|
funnelSizeController.scaleCurve = curve;
|
||||||
}
|
}
|
||||||
|
funnelSizeController.anchor = go.transform;
|
||||||
|
|
||||||
// Finish up next tick
|
// Finish up next tick
|
||||||
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => PostMake(funnelGO, alignment, funnelSizeController, module));
|
Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => PostMake(funnelGO, alignment, funnelSizeController, module));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PostMake(GameObject funnelGO, AlignWithTargetBody alignment, FunnelSizeController funnelSizeController, FunnelModule module)
|
private static void PostMake(GameObject funnelGO, AlignWithTargetBody alignment, FunnelController funnelSizeController, FunnelModule module)
|
||||||
{
|
{
|
||||||
var target = AstroObjectLocator.GetAstroObject(module.Target)?.GetAttachedOWRigidbody();
|
var target = AstroObjectLocator.GetAstroObject(module.Target)?.GetAttachedOWRigidbody();
|
||||||
if(target == null)
|
if(target == null)
|
||||||
|
|||||||
@ -84,7 +84,8 @@ namespace NewHorizons.Builder.Body
|
|||||||
}
|
}
|
||||||
fog.transform.localScale = Vector3.one;
|
fog.transform.localScale = Vector3.one;
|
||||||
fog.fogRadius = starModule.Size * OuterRadiusRatio;
|
fog.fogRadius = starModule.Size * OuterRadiusRatio;
|
||||||
if(starModule.Curve != null)
|
fog.lodFadeDistance = fog.fogRadius * (StarBuilder.OuterRadiusRatio - 1f);
|
||||||
|
if (starModule.Curve != null)
|
||||||
{
|
{
|
||||||
var controller = sunAtmosphere.AddComponent<StarAtmosphereSizeController>();
|
var controller = sunAtmosphere.AddComponent<StarAtmosphereSizeController>();
|
||||||
controller.scaleCurve = starModule.ToAnimationCurve();
|
controller.scaleCurve = starModule.ToAnimationCurve();
|
||||||
|
|||||||
@ -7,14 +7,19 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace NewHorizons.Components
|
namespace NewHorizons.Components
|
||||||
{
|
{
|
||||||
public class FunnelSizeController : MonoBehaviour
|
public class FunnelController : MonoBehaviour
|
||||||
{
|
{
|
||||||
public AnimationCurve scaleCurve;
|
public AnimationCurve scaleCurve;
|
||||||
public Transform target;
|
public Transform target;
|
||||||
|
public Transform anchor;
|
||||||
|
|
||||||
private void FixedUpdate()
|
private void FixedUpdate()
|
||||||
{
|
{
|
||||||
float num = scaleCurve == null ? 1f : scaleCurve.Evaluate(TimeLoop.GetMinutesElapsed());
|
float num = scaleCurve == null ? 1f : scaleCurve.Evaluate(TimeLoop.GetMinutesElapsed());
|
||||||
|
|
||||||
|
// Temporary solution that i will never get rid of
|
||||||
|
transform.position = anchor.position;
|
||||||
|
|
||||||
var dist = (transform.position - target.position).magnitude;
|
var dist = (transform.position - target.position).magnitude;
|
||||||
transform.localScale = new Vector3(num, dist/500f, num);
|
transform.localScale = new Vector3(num, dist/500f, num);
|
||||||
}
|
}
|
||||||
@ -24,6 +24,7 @@ namespace NewHorizons.Components
|
|||||||
{
|
{
|
||||||
base.FixedUpdate();
|
base.FixedUpdate();
|
||||||
fog.fogRadius = initialSize * CurrentScale * StarBuilder.OuterRadiusRatio;
|
fog.fogRadius = initialSize * CurrentScale * StarBuilder.OuterRadiusRatio;
|
||||||
|
fog.lodFadeDistance = initialSize * CurrentScale * (StarBuilder.OuterRadiusRatio - 1f);
|
||||||
foreach (var lod in atmosphereRenderers)
|
foreach (var lod in atmosphereRenderers)
|
||||||
{
|
{
|
||||||
lod.material.SetFloat("_InnerRadius", initialSize * CurrentScale);
|
lod.material.SetFloat("_InnerRadius", initialSize * CurrentScale);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user