升级水插件
This commit is contained in:
@@ -26,6 +26,11 @@ namespace WaveHarmonic.Crest.Editor
|
||||
return;
|
||||
}
|
||||
|
||||
if (EditorApplication.isUpdating)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EditorApplication.update -= GenerateAfterReloadScripts;
|
||||
|
||||
// Generate HLSL from C#. Only targets WaveHarmonic.Crest assemblies.
|
||||
@@ -46,6 +51,8 @@ namespace WaveHarmonic.Crest.Editor
|
||||
|
||||
sealed class AssetPostProcessor : AssetPostprocessor
|
||||
{
|
||||
const string k_SettingsPath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl";
|
||||
|
||||
static async void OnPostprocessAllAssets(string[] imported, string[] deleted, string[] movedTo, string[] movedFrom, bool domainReload)
|
||||
{
|
||||
// Unused.
|
||||
@@ -53,12 +60,32 @@ namespace WaveHarmonic.Crest.Editor
|
||||
|
||||
if (EditorApplication.isCompiling)
|
||||
{
|
||||
#if CREST_DEBUG
|
||||
if (imported.Contains(k_SettingsPath))
|
||||
{
|
||||
UnityEngine.Debug.Log($"Crest: Settings.Crest.hlsl changed during compilation!");
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if (EditorApplication.isUpdating)
|
||||
{
|
||||
#if CREST_DEBUG
|
||||
if (imported.Contains(k_SettingsPath))
|
||||
{
|
||||
UnityEngine.Debug.Log($"Crest: Settings.Crest.hlsl changed during asset database update!");
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// Regenerate if file changed like re-importing.
|
||||
if (imported.Contains("Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl"))
|
||||
if (imported.Contains(k_SettingsPath))
|
||||
{
|
||||
#if CREST_DEBUG
|
||||
UnityEngine.Debug.Log($"Crest: Settings.Crest.hlsl changed!");
|
||||
#endif
|
||||
// Generate HLSL from C#. Only targets WaveHarmonic.Crest assemblies.
|
||||
await ShaderGeneratorUtility.GenerateAll();
|
||||
AssetDatabase.Refresh();
|
||||
@@ -70,6 +97,19 @@ namespace WaveHarmonic.Crest.Editor
|
||||
[GenerateHLSL(sourcePath = "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest")]
|
||||
sealed class ShaderSettings
|
||||
{
|
||||
// These two are here for compute shaders.
|
||||
public static int s_CrestPackageHDRP = 0
|
||||
#if d_UnityHDRP
|
||||
+ 1
|
||||
#endif
|
||||
;
|
||||
|
||||
public static int s_CrestPackageURP = 0
|
||||
#if d_UnityURP
|
||||
+ 1
|
||||
#endif
|
||||
;
|
||||
|
||||
public static int s_CrestPortals =
|
||||
#if d_CrestPortals
|
||||
1
|
||||
@@ -86,7 +126,10 @@ namespace WaveHarmonic.Crest.Editor
|
||||
#endif
|
||||
;
|
||||
|
||||
public static int s_CrestShadowsBuiltInRenderPipeline = ProjectSettings.Instance.BuiltInRendererSampleShadowMaps ? 1 : 0;
|
||||
public static int s_CrestFullPrecisionDisplacement = ProjectSettings.Instance.FullPrecisionDisplacementOnHalfPrecisionPlatforms ? 1 : 0;
|
||||
|
||||
public static int s_CrestDiscardAtmosphericScattering = ProjectSettings.Instance.RenderAtmosphericScatteringWhenUnderWater ? 0 : 1;
|
||||
|
||||
public static int s_CrestLegacyUnderwater = ProjectSettings.Instance.LegacyUnderwater ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user