Merge branch 'dev' into height-map-resolution

This commit is contained in:
Nick 2022-07-14 20:26:42 -04:00
commit 94ca87b871
5 changed files with 61 additions and 21 deletions

View File

@ -18,6 +18,8 @@ namespace NewHorizons.Builder.Body
private static readonly int SkyColor = Shader.PropertyToID("_SkyColor");
private static readonly int AtmosFar = Shader.PropertyToID("_AtmosFar");
private static readonly int AtmosNear = Shader.PropertyToID("_AtmosNear");
private static readonly int Tint = Shader.PropertyToID("_Tint");
private static readonly int Radius = Shader.PropertyToID("_Radius");
private static readonly int InnerRadius = Shader.PropertyToID("_InnerRadius");
private static readonly int OuterRadius = Shader.PropertyToID("_OuterRadius");
@ -47,6 +49,7 @@ namespace NewHorizons.Builder.Body
if (starModule.tint != null)
{
fog.fogTint = starModule.tint.ToColor();
fog.fogImpostor.material.SetColor(Tint, starModule.tint.ToColor());
sunAtmosphere.transform.Find("AtmoSphere").transform.localScale = Vector3.one;
foreach (var lod in sunAtmosphere.transform.Find("AtmoSphere").GetComponentsInChildren<MeshRenderer>())
{
@ -60,6 +63,7 @@ namespace NewHorizons.Builder.Body
fog.transform.localScale = Vector3.one;
fog.fogRadius = starModule.size * OuterRadiusRatio;
fog.lodFadeDistance = fog.fogRadius * (StarBuilder.OuterRadiusRatio - 1f);
fog.fogImpostor.material.SetFloat(Radius, starModule.size * OuterRadiusRatio);
}
var ambientLightGO = Object.Instantiate(SearchUtilities.Find("Sun_Body/AmbientLight_SUN"), starGO.transform);
@ -140,6 +144,16 @@ namespace NewHorizons.Builder.Body
controller.StartColour = starModule.tint;
controller.EndColour = starModule.endTint;
controller.WillExplode = starModule.goSupernova;
if (!string.IsNullOrEmpty(starModule.starRampTexture))
{
var ramp = ImageUtilities.GetTexture(mod, starModule.starRampTexture);
controller.normalRamp = ramp;
}
if (!string.IsNullOrEmpty(starModule.starCollapseRampTexture))
{
var ramp = ImageUtilities.GetTexture(mod, starModule.starCollapseRampTexture);
controller.collapseRamp = ramp;
}
surfaceAudio.SetStarEvolutionController(controller);
starGO.SetActive(true);
@ -212,7 +226,7 @@ namespace NewHorizons.Builder.Body
foreach (var controller in solarFlareEmitter.GetComponentsInChildren<SolarFlareController>())
{
// It multiplies color by tint but wants something very bright idk
controller._color = new Color(11, 11, 11);
controller._color = new Color(1, 1, 1);
controller.GetComponent<MeshRenderer>().sharedMaterial.SetColor("_Color", controller._color);
controller._tint = flareTint;
}

View File

@ -365,43 +365,42 @@ namespace NewHorizons.Builder.Props
{
GameObject arc;
var type = arcInfo != null ? arcInfo.type : PropModule.NomaiTextArcInfo.NomaiTextArcType.Adult;
var variation = arcInfo.variation;
var variation = arcInfo == null ? arcInfo.variation : -1;
switch (type)
{
case PropModule.NomaiTextArcInfo.NomaiTextArcType.Child:
variation = arcInfo.variation < 0
variation = variation < 0
? Random.Range(0, _childArcPrefabs.Count())
: (arcInfo.variation % _childArcPrefabs.Count());
: (variation % _childArcPrefabs.Count());
arc = _childArcPrefabs[variation].InstantiateInactive();
break;
case PropModule.NomaiTextArcInfo.NomaiTextArcType.Stranger when _ghostArcPrefabs.Any():
variation = arcInfo.variation < 0
variation = variation < 0
? Random.Range(0, _ghostArcPrefabs.Count())
: (arcInfo.variation % _ghostArcPrefabs.Count());
: (variation % _ghostArcPrefabs.Count());
arc = _ghostArcPrefabs[variation].InstantiateInactive();
break;
case PropModule.NomaiTextArcInfo.NomaiTextArcType.Adult:
default:
variation = arcInfo.variation < 0
variation = variation < 0
? Random.Range(0, _arcPrefabs.Count())
: (arcInfo.variation % _arcPrefabs.Count());
: (variation % _arcPrefabs.Count());
arc = _arcPrefabs[variation].InstantiateInactive();
break;
}
arcInfo.variation = variation;
arc.transform.parent = conversationZone.transform;
arc.GetComponent<NomaiTextLine>()._prebuilt = false;
if (arcInfo != null)
{
var a = arcInfo;
if (a.position == null) arc.transform.localPosition = Vector3.zero;
else arc.transform.localPosition = new Vector3(a.position.x, a.position.y, 0);
arcInfo.variation = variation;
if (arcInfo.position == null) arc.transform.localPosition = Vector3.zero;
else arc.transform.localPosition = new Vector3(arcInfo.position.x, arcInfo.position.y, 0);
arc.transform.localRotation = Quaternion.Euler(0, 0, a.zRotation);
arc.transform.localRotation = Quaternion.Euler(0, 0, arcInfo.zRotation);
if (a.mirror) arc.transform.localScale = new Vector3(-1, 1, 1);
if (arcInfo.mirror) arc.transform.localScale = new Vector3(-1, 1, 1);
}
// Try auto I guess
else
@ -425,7 +424,7 @@ namespace NewHorizons.Builder.Props
arc.SetActive(true);
arcInfoToCorrespondingSpawnedGameObject[arcInfo] = arc;
if (arcInfo != null) arcInfoToCorrespondingSpawnedGameObject[arcInfo] = arc;
return arc;
}

View File

@ -18,6 +18,8 @@ namespace NewHorizons.Components.SizeControllers
public bool WillExplode { get; set; }
public MColor StartColour { get; set; }
public MColor EndColour { get; set; }
public Texture normalRamp;
public Texture collapseRamp;
private Color _startColour;
private Color _endColour;
@ -43,6 +45,8 @@ namespace NewHorizons.Components.SizeControllers
private Material _collapseEndSurfaceMaterial;
private Material _startSurfaceMaterial;
private Material _endSurfaceMaterial;
private Texture _normalRamp;
private Texture _collapseRamp;
private StarEvolutionController _proxy;
@ -59,13 +63,26 @@ namespace NewHorizons.Components.SizeControllers
_startSurfaceMaterial = new Material(sun._startSurfaceMaterial);
_endSurfaceMaterial = new Material(sun._endSurfaceMaterial);
var supernovaSurfaceColorRamp = supernova._surface.sharedMaterial.GetTexture(ColorRamp);
if (normalRamp == null)
{
_normalRamp = sun._startSurfaceMaterial.GetTexture(ColorRamp);
} else
{
_normalRamp = normalRamp;
}
if (collapseRamp == null)
{
_collapseRamp = sun._collapseStartSurfaceMaterial.GetTexture(ColorRamp);
} else
{
_collapseRamp = collapseRamp;
}
// Copy over the material that was set in star builder
_collapseStartSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
_collapseEndSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
_startSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
_endSurfaceMaterial.SetTexture(ColorRamp, supernovaSurfaceColorRamp);
_collapseStartSurfaceMaterial.SetTexture(ColorRamp, _collapseRamp);
_collapseEndSurfaceMaterial.SetTexture(ColorRamp, _collapseRamp);
_startSurfaceMaterial.SetTexture(ColorRamp, _normalRamp);
_endSurfaceMaterial.SetTexture(ColorRamp, _normalRamp);
if (StartColour == null)
{
@ -85,7 +102,7 @@ namespace NewHorizons.Components.SizeControllers
else
{
_endColour = EndColour.ToColor();
_endSurfaceMaterial.color = _endColour;
_endSurfaceMaterial.color = _startColour * 4.5948f;
}
_heatVolume = GetComponentInChildren<HeatHazardVolume>();
@ -129,6 +146,7 @@ namespace NewHorizons.Components.SizeControllers
_isCollapsing = true;
_collapseStartSize = CurrentScale;
_collapseTimer = 0f;
supernova._surface._materials[0].CopyPropertiesFromMaterial(_collapseStartSurfaceMaterial);
if (_proxy != null) _proxy.Die();
}

View File

@ -61,6 +61,11 @@ namespace NewHorizons.External.Modules.VariableSize
/// </summary>
public string starRampTexture;
/// <summary>
/// Path to the texture to put as the star ramp while it is collapsing. Optional.
/// </summary>
public string starCollapseRampTexture;
/// <summary>
/// How far the light from the star can reach.
/// </summary>

View File

@ -1976,6 +1976,10 @@
"type": "string",
"description": "Path to the texture to put as the star ramp. Optional."
},
"starCollapseRampTexture": {
"type": "string",
"description": "Path to the texture to put as the star ramp while it is collapsing. Optional."
},
"lightRadius": {
"type": "number",
"description": "How far the light from the star can reach.",