-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
543 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
Chroma/EnvironmentEnhancement/Component/BloomFogCustomizer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using CustomJSONData.CustomBeatmap; | ||
using IPA.Utilities; | ||
using static Chroma.EnvironmentEnhancement.Component.ComponentConstants; | ||
|
||
namespace Chroma.EnvironmentEnhancement.Component | ||
{ | ||
internal static class BloomFogCustomizer | ||
{ | ||
private static readonly FieldAccessor<BloomFogEnvironment, BloomFogEnvironmentParams>.Accessor _fogParamsAccessor = FieldAccessor<BloomFogEnvironment, BloomFogEnvironmentParams>.GetAccessor("_fogParams"); | ||
|
||
internal static void BloomFogEnvironmentInit(List<UnityEngine.Component> allComponents, CustomData customData) | ||
{ | ||
BloomFogEnvironment[] bloomFogEnvironments = allComponents | ||
.OfType<BloomFogEnvironment>() | ||
.ToArray(); | ||
if (bloomFogEnvironments.Length == 0) | ||
{ | ||
Log.Logger.Log($"No [{BLOOM_FOG_ENVIRONMENT}] component found."); | ||
return; | ||
} | ||
|
||
float? attenuation = customData.Get<float?>(ATTENUATION); | ||
float? offset = customData.Get<float?>(OFFSET); | ||
float? heightFogStartY = customData.Get<float?>(HEIGHT_FOG_STARTY); | ||
float? heightFogHeight = customData.Get<float?>(HEIGHT_FOG_HEIGHT); | ||
|
||
foreach (BloomFogEnvironment bloomFogEnvironment in bloomFogEnvironments) | ||
{ | ||
BloomFogEnvironment fuckref = bloomFogEnvironment; | ||
BloomFogEnvironmentParams fogParams = _fogParamsAccessor(ref fuckref); | ||
|
||
if (attenuation.HasValue) | ||
{ | ||
fogParams.attenuation = attenuation.Value; | ||
} | ||
|
||
if (offset.HasValue) | ||
{ | ||
fogParams.offset = offset.Value; | ||
} | ||
|
||
if (heightFogStartY.HasValue) | ||
{ | ||
fogParams.heightFogStartY = heightFogStartY.Value; | ||
} | ||
|
||
if (heightFogHeight.HasValue) | ||
{ | ||
fogParams.heightFogHeight = heightFogHeight.Value; | ||
} | ||
} | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
Chroma/EnvironmentEnhancement/Component/ComponentConstants.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
namespace Chroma.EnvironmentEnhancement.Component | ||
{ | ||
internal static class ComponentConstants | ||
{ | ||
internal const string COMPONENTS = "components"; | ||
|
||
internal const string LIGHT_WITH_ID = "ILightWithId"; | ||
internal const string LIGHT_ID = "lightID"; | ||
internal const string LIGHT_TYPE = "type"; | ||
|
||
internal const string BLOOM_FOG_ENVIRONMENT = "BloomFogEnvironment"; | ||
internal const string ATTENUATION = "attenuation"; | ||
internal const string OFFSET = "offset"; | ||
internal const string HEIGHT_FOG_STARTY = "startY"; | ||
internal const string HEIGHT_FOG_HEIGHT = "height"; | ||
|
||
internal const string TUBE_BLOOM_PRE_PASS_LIGHT = "TubeBloomPrePassLight"; | ||
internal const string COLOR_ALPHA_MULTIPLIER = "colorAlphaMultiplier"; | ||
internal const string BLOOM_FOG_INTENSITY_MULTIPLIER = "bloomFogIntensityMultiplier"; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
Chroma/EnvironmentEnhancement/Component/ComponentCustomizer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System.Collections.Generic; | ||
using CustomJSONData.CustomBeatmap; | ||
using JetBrains.Annotations; | ||
using UnityEngine; | ||
using static Chroma.EnvironmentEnhancement.Component.ComponentConstants; | ||
|
||
namespace Chroma.EnvironmentEnhancement.Component | ||
{ | ||
internal class ComponentCustomizer | ||
{ | ||
private readonly ILightWithIdCustomizer _lightWithIdCustomizer; | ||
|
||
[UsedImplicitly] | ||
private ComponentCustomizer( | ||
ILightWithIdCustomizer _lightWithIdCustomizer) | ||
{ | ||
this._lightWithIdCustomizer = _lightWithIdCustomizer; | ||
} | ||
|
||
internal static void GetAllComponents(List<UnityEngine.Component> components, Transform root) | ||
{ | ||
components.AddRange(root.GetComponents<UnityEngine.Component>()); | ||
|
||
foreach (Transform transform in root) | ||
{ | ||
GetAllComponents(components, transform); | ||
} | ||
} | ||
|
||
internal void Customize(Transform gameObject, CustomData customData) | ||
{ | ||
List<UnityEngine.Component> allComponents = new(); | ||
GetAllComponents(allComponents, gameObject); | ||
|
||
CustomData? lightWithID = customData.Get<CustomData>(LIGHT_WITH_ID); | ||
if (lightWithID != null) | ||
{ | ||
_lightWithIdCustomizer.ILightWithIdInit(allComponents, lightWithID); | ||
} | ||
|
||
CustomData? bloomFogEnvironment = customData.Get<CustomData>(BLOOM_FOG_ENVIRONMENT); | ||
if (bloomFogEnvironment != null) | ||
{ | ||
BloomFogCustomizer.BloomFogEnvironmentInit(allComponents, bloomFogEnvironment); | ||
} | ||
|
||
CustomData? tubeBloomPrePassLight = customData.Get<CustomData>(TUBE_BLOOM_PRE_PASS_LIGHT); | ||
if (tubeBloomPrePassLight != null) | ||
{ | ||
TubeBloomLightCustomizer.TubeBloomPrePassLightInit(allComponents, tubeBloomPrePassLight); | ||
} | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...a/EnvironmentEnhancement/ComponentData.cs → ...entEnhancement/Component/ComponentData.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.