mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Make details high LOD
This commit is contained in:
parent
80ca144793
commit
4efba911b3
@ -10,6 +10,7 @@ using Logger = NewHorizons.Utility.Logger;
|
||||
using NewHorizons.External;
|
||||
using OWML.Common;
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.Handlers;
|
||||
|
||||
namespace NewHorizons.Builder.Props
|
||||
{
|
||||
@ -63,21 +64,8 @@ namespace NewHorizons.Builder.Props
|
||||
GameObject prop = GameObject.Instantiate(prefab, sector.transform);
|
||||
prop.SetActive(false);
|
||||
|
||||
List<string> assetBundles = new List<string>();
|
||||
foreach (var streamingHandle in prop.GetComponentsInChildren<StreamingMeshHandle>())
|
||||
{
|
||||
var assetBundle = streamingHandle.assetBundle;
|
||||
if (!assetBundles.Contains(assetBundle))
|
||||
{
|
||||
assetBundles.Add(assetBundle);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var assetBundle in assetBundles)
|
||||
{
|
||||
sector.OnOccupantEnterSector += (SectorDetector sd) => StreamingManager.LoadStreamingAssets(assetBundle);
|
||||
StreamingManager.LoadStreamingAssets(assetBundle);
|
||||
}
|
||||
sector.OnOccupantEnterSector += (SectorDetector sd) => OWAssetHandler.LoadObject(prop);
|
||||
OWAssetHandler.LoadObject(prop);
|
||||
|
||||
foreach (var component in prop.GetComponents<Component>().Concat(prop.GetComponentsInChildren<Component>()))
|
||||
{
|
||||
|
||||
53
NewHorizons/Handlers/OWAssetHandler.cs
Normal file
53
NewHorizons/Handlers/OWAssetHandler.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Logger = NewHorizons.Utility.Logger;
|
||||
|
||||
namespace NewHorizons.Handlers
|
||||
{
|
||||
public static class OWAssetHandler
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void LoadObject(GameObject obj)
|
||||
{
|
||||
var assetBundles = new List<string>();
|
||||
|
||||
var tables = Resources.FindObjectsOfTypeAll<StreamingMaterialTable>();
|
||||
foreach (var streamingHandle in obj.GetComponentsInChildren<StreamingMeshHandle>())
|
||||
{
|
||||
var assetBundle = streamingHandle.assetBundle;
|
||||
if (!assetBundles.Contains(assetBundle))
|
||||
{
|
||||
assetBundles.Add(assetBundle);
|
||||
}
|
||||
if (streamingHandle is StreamingRenderMeshHandle || streamingHandle is StreamingSkinnedMeshHandle)
|
||||
{
|
||||
var materials = streamingHandle.GetComponent<Renderer>().sharedMaterials;
|
||||
foreach (var table in tables)
|
||||
{
|
||||
foreach(var x in table._materialPropertyLookups)
|
||||
{
|
||||
if(materials.Contains(x.material))
|
||||
{
|
||||
assetBundles.SafeAdd(table.assetBundle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var assetBundle in assetBundles)
|
||||
{
|
||||
Logger.Log($"Loading {assetBundles.Count} : {assetBundle}");
|
||||
StreamingManager.LoadStreamingAssets(assetBundle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -190,6 +190,7 @@ namespace NewHorizons
|
||||
SignalBuilder.Init();
|
||||
AstroObjectLocator.RefreshList();
|
||||
PlanetCreationHandler.Init(BodyDict[CurrentStarSystem]);
|
||||
OWAssetHandler.Init();
|
||||
LoadTranslations(ModHelper.Manifest.ModFolderPath + "AssetBundle/", this);
|
||||
|
||||
Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => Locator.GetPlayerBody().gameObject.AddComponent<DebugRaycaster>());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user