diff options
| author | chai <215380520@qq.com> | 2024-05-19 17:03:57 +0800 |
|---|---|---|
| committer | chai <215380520@qq.com> | 2024-05-19 17:03:57 +0800 |
| commit | cf58771365b5953c6eac548b172aae880d1f0acd (patch) | |
| tree | a49757a4b5c447cbf877584d482367a6bfe33b10 /Thronefall_1_57/Decompile/NGS.MeshFusionPro/LODMeshFusionSource.cs | |
| parent | eed315deae356ddfb17f28305e7cde6cdfc43313 (diff) | |
* rename
Diffstat (limited to 'Thronefall_1_57/Decompile/NGS.MeshFusionPro/LODMeshFusionSource.cs')
| -rw-r--r-- | Thronefall_1_57/Decompile/NGS.MeshFusionPro/LODMeshFusionSource.cs | 141 |
1 files changed, 0 insertions, 141 deletions
diff --git a/Thronefall_1_57/Decompile/NGS.MeshFusionPro/LODMeshFusionSource.cs b/Thronefall_1_57/Decompile/NGS.MeshFusionPro/LODMeshFusionSource.cs deleted file mode 100644 index 4b941b9..0000000 --- a/Thronefall_1_57/Decompile/NGS.MeshFusionPro/LODMeshFusionSource.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace NGS.MeshFusionPro; - -public class LODMeshFusionSource : MeshFusionSource -{ - [SerializeField] - [HideInInspector] - private LODGroup _group; - - private LODGroupCombineSource _source; - - private CombinedLODGroupPart _part; - - private Bounds? _savedBounds; - - public override bool TryGetBounds(ref Bounds bounds) - { - if (_source != null) - { - bounds = _source.Bounds; - return true; - } - if (_part != null) - { - bounds = _part.Bounds; - return true; - } - if (_savedBounds.HasValue) - { - bounds = _savedBounds.Value; - return true; - } - if (base.IsIncompatible) - { - return false; - } - LOD[] lODs = _group.GetLODs(); - bounds = new Bounds(base.transform.position, Vector3.zero); - for (int i = 0; i < lODs.Length; i++) - { - Renderer[] renderers = lODs[i].renderers; - for (int j = 0; j < renderers.Length; j++) - { - if (!(renderers[j] == null)) - { - bounds.Encapsulate(renderers[j].bounds); - } - } - } - _savedBounds = bounds; - return true; - } - - protected override void OnSourceCombinedInternal(ICombinedObject root, ICombinedObjectPart part) - { - _part = (CombinedLODGroupPart)part; - } - - protected override bool CheckCompatibilityAndGetComponents(out string incompatibilityReason) - { - if (_group == null) - { - _group = GetComponent<LODGroup>(); - } - if (_group == null) - { - incompatibilityReason = "LODGroup not found"; - return false; - } - incompatibilityReason = ""; - MeshFilter filter = null; - Mesh mesh = null; - LOD[] lODs = _group.GetLODs(); - for (int i = 0; i < lODs.Length; i++) - { - Renderer[] renderers = lODs[i].renderers; - for (int j = 0; j < renderers.Length; j++) - { - MeshRenderer renderer = renderers[j] as MeshRenderer; - if (!(renderer == null) && !CanCreateCombineSource(renderer.gameObject, ref incompatibilityReason, ref renderer, ref filter, ref mesh)) - { - return false; - } - } - } - return true; - } - - protected override void CreateSources() - { - _source = new LODGroupCombineSource(_group); - } - - protected override IEnumerable<ICombineSource> GetCombineSources() - { - if (_source != null) - { - yield return _source; - } - } - - protected override IEnumerable<ICombinedObjectPart> GetCombinedParts() - { - if (_part != null) - { - yield return _part; - } - } - - protected override void ClearSources() - { - if (_source != null) - { - _source = null; - } - } - - protected override void ClearParts() - { - if (_part != null) - { - _part = null; - } - } - - protected override void ToggleComponents(bool enabled) - { - LOD[] lODs = _group.GetLODs(); - for (int i = 0; i < lODs.Length; i++) - { - Renderer[] renderers = lODs[i].renderers; - for (int j = 0; j < renderers.Length; j++) - { - renderers[j].enabled = enabled; - } - } - _group.enabled = enabled; - } -} |
