diff --git a/Assets/Nova/Editor/Core/Scripts/CustomCoord.cs b/Assets/Nova/Editor/Core/Scripts/CustomCoord.cs index db65445..d055c55 100644 --- a/Assets/Nova/Editor/Core/Scripts/CustomCoord.cs +++ b/Assets/Nova/Editor/Core/Scripts/CustomCoord.cs @@ -16,4 +16,4 @@ public enum CustomCoord Coord2Z = 22, Coord2W = 32 } -} \ No newline at end of file +} diff --git a/Assets/Nova/Editor/Core/Scripts/MaterialEditorUtility.cs b/Assets/Nova/Editor/Core/Scripts/MaterialEditorUtility.cs index 45af714..2b897d3 100644 --- a/Assets/Nova/Editor/Core/Scripts/MaterialEditorUtility.cs +++ b/Assets/Nova/Editor/Core/Scripts/MaterialEditorUtility.cs @@ -3,6 +3,7 @@ // -------------------------------------------------------------- using System; +using System.Collections.Generic; using UnityEditor; using UnityEngine; using UnityEngine.Rendering; @@ -246,10 +247,10 @@ public static void DrawSmallTexture(MaterialEditor editor, string label, Materia /// /// /// - public static void DrawTexture(MaterialEditor editor, MaterialProperty textureProperty, - bool drawTilingAndOffset) + public static void DrawTexture(MaterialEditor editor, MaterialProperty textureProperty, + bool drawTilingAndOffset) where TCustomCoord : Enum { - DrawTexture(editor, textureProperty, drawTilingAndOffset, null, null, null, null); + DrawTexture(editor, textureProperty, drawTilingAndOffset, null, null, null, null); } /// @@ -261,18 +262,18 @@ public static void DrawTexture(MaterialEditor editor, MaterialProperty texturePr /// /// /// - public static void DrawTexture(MaterialEditor editor, MaterialProperty textureProperty, + public static void DrawTexture(MaterialEditor editor, MaterialProperty textureProperty, MaterialProperty offsetCoordXProperty, MaterialProperty offsetCoordYProperty, - MaterialProperty channelsXProperty, MaterialProperty channelsYProperty) + MaterialProperty channelsXProperty, MaterialProperty channelsYProperty) where TCustomCoord : Enum { - DrawTexture(editor, textureProperty, true, + DrawTexture(editor, textureProperty, true, offsetCoordXProperty, offsetCoordYProperty, channelsXProperty, channelsYProperty); } - private static void DrawTexture(MaterialEditor editor, MaterialProperty textureProperty, + private static void DrawTexture(MaterialEditor editor, MaterialProperty textureProperty, bool drawTilingAndOffset, MaterialProperty offsetCoordXProperty, MaterialProperty offsetCoordYProperty, - MaterialProperty channelsXProperty, MaterialProperty channelsYProperty) + MaterialProperty channelsXProperty, MaterialProperty channelsYProperty) where TCustomCoord : Enum { var propertyCount = 0; if (drawTilingAndOffset) propertyCount += 2; @@ -402,7 +403,7 @@ private static void DrawTexture(MaterialEditor editor, MaterialProperty textureP var xPropertyRect = xRect; xPropertyRect.xMin += 12; EditorGUI.LabelField(xRect, new GUIContent("X")); - DrawEnumContentsProperty(editor, xPropertyRect, offsetCoordXProperty); + DrawEnumContentsProperty(editor, xPropertyRect, offsetCoordXProperty); var yRect = xRect; yRect.x += yRect.width + 2; @@ -410,7 +411,7 @@ private static void DrawTexture(MaterialEditor editor, MaterialProperty textureP var yPropertyRect = yRect; yPropertyRect.xMin += 12; EditorGUI.LabelField(yRect, new GUIContent("Y")); - DrawEnumContentsProperty(editor, yPropertyRect, offsetCoordYProperty); + DrawEnumContentsProperty(editor, yPropertyRect, offsetCoordYProperty); } // Channels @@ -446,8 +447,8 @@ private static void DrawTexture(MaterialEditor editor, MaterialProperty textureP /// /// /// - public static void DrawPropertyAndCustomCoord(MaterialEditor editor, string label, MaterialProperty property, - MaterialProperty coordProperty) + public static void DrawPropertyAndCustomCoord(MaterialEditor editor, string label, MaterialProperty property, + MaterialProperty coordProperty) where T : Enum { var fullRect = EditorGUILayout.GetControlRect(); var contentsRect = fullRect; @@ -462,17 +463,22 @@ public static void DrawPropertyAndCustomCoord(MaterialEditor editor, string labe using (new ResetIndentLevelScope()) { - var coord = (CustomCoord)coordProperty.floatValue; + T coord = (T)Enum.ToObject(typeof(T), Convert.ToInt32(coordProperty.floatValue)); + if (!Enum.IsDefined(typeof(T), coord)) + { + EditorGUILayout.HelpBox( + $"Invalid coord value\n", MessageType.Error, true); + } using (var ccs = new EditorGUI.ChangeCheckScope()) { EditorGUI.showMixedValue = coordProperty.hasMixedValue; - coord = (CustomCoord)EditorGUI.EnumPopup(coordRect, coord); + coord = (T)EditorGUI.EnumPopup(coordRect, coord); EditorGUI.showMixedValue = false; if (ccs.changed) { editor.RegisterPropertyChangeUndo(coordProperty.name); - coordProperty.floatValue = (int)coord; + coordProperty.floatValue = Convert.ToInt32(coord); } } } @@ -667,9 +673,16 @@ public static void DrawEnumContentsProperty(MaterialEditor editor, Rect rect, var value = (T)Enum.ToObject(typeof(T), (int)property.floatValue); using (var ccs = new EditorGUI.ChangeCheckScope()) { - EditorGUI.showMixedValue = property.hasMixedValue; - + EditorGUI.showMixedValue = property.hasMixedValue; + if (!Enum.IsDefined(typeof(T), value)) + { + EditorGUILayout.HelpBox( + $"Invalid coord value\n", MessageType.Error, true); + } + var intValue = Convert.ToInt32(EditorGUI.EnumPopup(rect, value)); + + EditorGUI.showMixedValue = false; if (ccs.changed) diff --git a/Assets/Nova/Editor/Core/Scripts/ParticlesDistortionGUI.cs b/Assets/Nova/Editor/Core/Scripts/ParticlesDistortionGUI.cs index 5669acb..5061daa 100644 --- a/Assets/Nova/Editor/Core/Scripts/ParticlesDistortionGUI.cs +++ b/Assets/Nova/Editor/Core/Scripts/ParticlesDistortionGUI.cs @@ -141,12 +141,12 @@ private void DrawRenderSettingsProperties(MaterialEditor editor, MaterialPropert private void DrawDistortionProperties(MaterialEditor editor, MaterialProperty[] properties) { - MaterialEditorUtility.DrawTexture(editor, _baseMapProp.Value, _baseMapOffsetXCoordProp.Value, + MaterialEditorUtility.DrawTexture(editor, _baseMapProp.Value, _baseMapOffsetXCoordProp.Value, _baseMapOffsetYCoordProp.Value, _baseMapChannelsXProp.Value, _baseMapChannelsYProp.Value); - MaterialEditorUtility.DrawPropertyAndCustomCoord(editor, "Intensity", + MaterialEditorUtility.DrawPropertyAndCustomCoord(editor, "Intensity", _distortionIntensityProp.Value, _distortionIntensityCoordProp.Value); - MaterialEditorUtility.DrawPropertyAndCustomCoord(editor, "Rotation", + MaterialEditorUtility.DrawPropertyAndCustomCoord(editor, "Rotation", _baseMapRotationProp.Value, _baseMapRotationCoordProp.Value); using (new EditorGUI.IndentLevelScope()) { @@ -158,9 +158,9 @@ private void DrawDistortionProperties(MaterialEditor editor, MaterialProperty[] private void DrawFlowMapProperties(MaterialEditor editor, MaterialProperty[] properties) { - MaterialEditorUtility.DrawTexture(editor, _flowMapProp.Value, _flowMapOffsetXCoordProp.Value, + MaterialEditorUtility.DrawTexture(editor, _flowMapProp.Value, _flowMapOffsetXCoordProp.Value, _flowMapOffsetYCoordProp.Value, _flowMapChannelsXProp.Value, _flowMapChannelsYProp.Value); - MaterialEditorUtility.DrawPropertyAndCustomCoord(editor, "Intensity", _flowIntensityProp.Value, + MaterialEditorUtility.DrawPropertyAndCustomCoord(editor, "Intensity", _flowIntensityProp.Value, _flowIntensityCoordProp.Value); MaterialEditorUtility.DrawEnumFlagsProperty(editor, "Targets", _flowMapTargetProp.Value); @@ -173,11 +173,11 @@ private void DrawAlphaTransitionProperties(MaterialEditor editor, MaterialProper var mode = (AlphaTransitionMode)_alphaTransitionModeProp.Value.floatValue; if (mode != AlphaTransitionMode.None) { - MaterialEditorUtility.DrawTexture(editor, _alphaTransitionMapProp.Value, + MaterialEditorUtility.DrawTexture(editor, _alphaTransitionMapProp.Value, _alphaTransitionMapOffsetXCoordProp.Value, _alphaTransitionMapOffsetYCoordProp.Value, _alphaTransitionMapChannelsXProp.Value, null); - MaterialEditorUtility.DrawPropertyAndCustomCoord(editor, "Progress", + MaterialEditorUtility.DrawPropertyAndCustomCoord(editor, "Progress", _alphaTransitionProgressProp.Value, _alphaTransitionProgressCoordProp.Value); if (mode == AlphaTransitionMode.Dissolve) editor.ShaderProperty(_dissolveSharpnessProp.Value, "Edge Sharpness"); @@ -283,4 +283,4 @@ private void DrawTransparencyProperties(MaterialEditor editor, MaterialProperty[ #endregion } -} \ No newline at end of file +} diff --git a/Assets/Nova/Editor/Core/Scripts/ParticlesUberCommonGUI.cs b/Assets/Nova/Editor/Core/Scripts/ParticlesUberCommonGUI.cs index 2b52ef3..eff54ab 100644 --- a/Assets/Nova/Editor/Core/Scripts/ParticlesUberCommonGUI.cs +++ b/Assets/Nova/Editor/Core/Scripts/ParticlesUberCommonGUI.cs @@ -14,7 +14,7 @@ namespace Nova.Editor.Core.Scripts /// /// Common GUI for ParticleUberUnlit, ParticleUberLit classes. /// - internal class ParticlesUberCommonGUI + internal class ParticlesUberCommonGUI where TCustomCoord : Enum { public ParticlesUberCommonGUI(MaterialEditor editor) { @@ -128,6 +128,13 @@ public void DrawFixNowButton() } } + public void DrawErrorMessage() + { + if (string.IsNullOrEmpty(_errorMessage)) return; + EditorGUILayout.HelpBox( + _errorMessage, MessageType.Error, true); + _errorMessage = ""; + } public void DrawProperties(BoolEditorPrefsProperty foldout, string categoryName, Action internalDrawFunction) { using var foldoutScope = new MaterialEditorUtility.FoldoutHeaderScope(foldout.Value, categoryName); @@ -181,7 +188,7 @@ private void InternalDrawBaseMapProperties() using (var changeCheckScope = new EditorGUI.ChangeCheckScope()) { - MaterialEditorUtility.DrawTexture(_editor, baseMapMaterialProp, props.BaseMapOffsetXCoordProp.Value, + MaterialEditorUtility.DrawTexture(_editor, baseMapMaterialProp, props.BaseMapOffsetXCoordProp.Value, props.BaseMapOffsetYCoordProp.Value, null, null); if (changeCheckScope.changed) @@ -201,7 +208,7 @@ private void InternalDrawBaseMapProperties() } } - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Rotation", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Rotation", props.BaseMapRotationProp.Value, props.BaseMapRotationCoordProp.Value); using (new EditorGUI.IndentLevelScope()) { @@ -212,7 +219,7 @@ private void InternalDrawBaseMapProperties() props.BaseMapMirrorSamplingProp.Value); if (baseMapMode == BaseMapMode.FlipBook || baseMapMode == BaseMapMode.FlipBookBlending) - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Flip-Book Progress", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Flip-Book Progress", props.BaseMapProgressProp.Value, props.BaseMapProgressCoordProp.Value); } @@ -240,7 +247,7 @@ private void InternalDrawParallaxMapsProperties() using (var changeCheckScope = new EditorGUI.ChangeCheckScope()) { - MaterialEditorUtility.DrawTexture( + MaterialEditorUtility.DrawTexture( _editor, textureProp, props.ParallaxMapOffsetXCoordProp.Value, @@ -268,7 +275,7 @@ private void InternalDrawParallaxMapsProperties() } if (parallaxMapMode > ParallaxMapMode.SingleTexture) - MaterialEditorUtility.DrawPropertyAndCustomCoord( + MaterialEditorUtility.DrawPropertyAndCustomCoord( _editor, "Flip-Book Progress", props.ParallaxMapProgressProp.Value, @@ -286,7 +293,7 @@ private void InternalDrawParallaxMapsProperties() "Target", props.ParallaxMapTargetProp.Value); } - + private void InternalDrawTintColorProperties() { var props = _commonMaterialProperties; @@ -297,10 +304,10 @@ private void InternalDrawTintColorProperties() if (tintAreaMode == TintAreaMode.Rim) using (new EditorGUI.IndentLevelScope()) { - MaterialEditorUtility.DrawPropertyAndCustomCoord( + MaterialEditorUtility.DrawPropertyAndCustomCoord( _editor, "Progress", props.TintRimProgressProp.Value, props.TintRimProgressCoordProp.Value); - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Sharpness", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Sharpness", props.TintRimSharpnessProp.Value, props.TintRimSharpnessCoordProp.Value); MaterialEditorUtility.DrawToggleProperty(_editor, "Inverse", props.InverseTintRimProp.Value); @@ -314,7 +321,7 @@ private void InternalDrawTintColorProperties() } else if (tintColorMode == TintColorMode.Texture2D) { - MaterialEditorUtility.DrawTexture(_editor, props.TintMapProp.Value, + MaterialEditorUtility.DrawTexture(_editor, props.TintMapProp.Value, props.TintMapOffsetXCoordProp.Value, props.TintMapOffsetYCoordProp.Value, null, null); } @@ -322,7 +329,7 @@ private void InternalDrawTintColorProperties() { using (var changeCheckScope = new EditorGUI.ChangeCheckScope()) { - MaterialEditorUtility.DrawTexture(_editor, props.TintMap3DProp.Value, + MaterialEditorUtility.DrawTexture(_editor, props.TintMap3DProp.Value, props.TintMapOffsetXCoordProp.Value, props.TintMapOffsetYCoordProp.Value, null, null); @@ -333,22 +340,22 @@ private void InternalDrawTintColorProperties() } } - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Progress", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Progress", props.TintMap3DProgressProp.Value, props.TintMap3DProgressCoordProp.Value); } - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Blend Rate", props.TintMapBlendRateProp.Value, + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Blend Rate", props.TintMapBlendRateProp.Value, props.TintMapBlendRateCoordProp.Value); } private void InternalDrawFlowMapProperties() { var props = _commonMaterialProperties; - MaterialEditorUtility.DrawTexture(_editor, props.FlowMapProp.Value, + MaterialEditorUtility.DrawTexture(_editor, props.FlowMapProp.Value, props.FlowMapOffsetXCoordProp.Value, props.FlowMapOffsetYCoordProp.Value, props.FlowMapChannelsXProp.Value, props.FlowMapChannelsYProp.Value); - MaterialEditorUtility.DrawPropertyAndCustomCoord( + MaterialEditorUtility.DrawPropertyAndCustomCoord( _editor, "Intensity", props.FlowIntensityProp.Value, @@ -364,7 +371,7 @@ private void InternalDrawColorCorrectionProperties() props.ColorCorrectionModeProp.Value); var colorCorrectionMode = (ColorCorrectionMode)props.ColorCorrectionModeProp.Value.floatValue; if (colorCorrectionMode == ColorCorrectionMode.GradientMap) - MaterialEditorUtility.DrawTexture(_editor, props.GradientMapProp.Value, false); + MaterialEditorUtility.DrawTexture(_editor, props.GradientMapProp.Value, false); } private void InternalDrawAlphaTransitionProperties() @@ -400,7 +407,7 @@ private void InternalDrawAlphaTransitionProperties() using (var changeCheckScope = new EditorGUI.ChangeCheckScope()) { - MaterialEditorUtility.DrawTexture(_editor, alphaTransitionMapProp, + MaterialEditorUtility.DrawTexture(_editor, alphaTransitionMapProp, props.AlphaTransitionMapOffsetXCoordProp.Value, props.AlphaTransitionMapOffsetYCoordProp.Value, props.AlphaTransitionMapChannelsXProp.Value, null); @@ -424,10 +431,10 @@ private void InternalDrawAlphaTransitionProperties() if (alphaTransitionMapMode == AlphaTransitionMapMode.FlipBook || alphaTransitionMapMode == AlphaTransitionMapMode.FlipBookBlending) - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Flip-Book Progress", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Flip-Book Progress", props.AlphaTransitionMapProgressProp.Value, props.AlphaTransitionMapProgressCoordProp.Value); - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Transition Progress", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Transition Progress", props.AlphaTransitionProgressProp.Value, props.AlphaTransitionProgressCoordProp.Value); if (mode == AlphaTransitionMode.Dissolve) _editor.ShaderProperty(props.DissolveSharpnessProp.Value, "Edge Sharpness"); @@ -442,7 +449,7 @@ private void InternalDrawAlphaTransitionProperties() { using (var changeCheckScope = new EditorGUI.ChangeCheckScope()) { - MaterialEditorUtility.DrawTexture(_editor, alphaTransitionMapSecondTextureProp, + MaterialEditorUtility.DrawTexture(_editor, alphaTransitionMapSecondTextureProp, props.AlphaTransitionMapSecondTextureOffsetXCoordProp.Value, props.AlphaTransitionMapSecondTextureOffsetYCoordProp.Value, props.AlphaTransitionMapSecondTextureChannelsXProp.Value, null); @@ -470,11 +477,11 @@ private void InternalDrawAlphaTransitionProperties() if (alphaTransitionMapMode == AlphaTransitionMapMode.FlipBook || alphaTransitionMapMode == AlphaTransitionMapMode.FlipBookBlending) - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Flip-Book Progress", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Flip-Book Progress", props.AlphaTransitionMapSecondTextureProgressProp.Value, props.AlphaTransitionMapSecondTextureProgressCoordProp.Value); - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Transition Progress", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Transition Progress", props.AlphaTransitionProgressSecondTextureProp.Value, props.AlphaTransitionProgressCoordSecondTextureProp.Value); @@ -521,7 +528,7 @@ private void InternalDrawEmissionProperties() using (var changeCheckScope = new EditorGUI.ChangeCheckScope()) { - MaterialEditorUtility.DrawTexture(_editor, emissionMapProp, + MaterialEditorUtility.DrawTexture(_editor, emissionMapProp, props.EmissionMapOffsetXCoordProp.Value, props.EmissionMapOffsetYCoordProp.Value, props.EmissionMapChannelsXProp.Value, null); @@ -545,7 +552,7 @@ private void InternalDrawEmissionProperties() if (emissionMapMode == EmissionMapMode.FlipBook || emissionMapMode == EmissionMapMode.FlipBookBlending) - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Flip-Book Progress", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Flip-Book Progress", props.EmissionMapProgressProp.Value, props.EmissionMapProgressCoordProp.Value); MaterialEditorUtility.DrawEnumProperty(_editor, "Color Type", @@ -561,7 +568,7 @@ private void InternalDrawEmissionProperties() if (colorType == EmissionColorType.Color) _editor.ShaderProperty(props.EmissionColorProp.Value, "Color"); else if (colorType == EmissionColorType.GradiantMap) - MaterialEditorUtility.DrawTexture(_editor, props.EmissionColorRampProp.Value, false); + MaterialEditorUtility.DrawTexture(_editor, props.EmissionColorRampProp.Value, false); if (areaType == EmissionAreaType.Edge) MaterialEditorUtility.DrawToggleProperty(_editor, "Keep Edge Transparency", @@ -569,7 +576,7 @@ private void InternalDrawEmissionProperties() using (var ccs2 = new EditorGUI.ChangeCheckScope()) { - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Intensity", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Intensity", props.EmissionIntensityProp.Value, props.EmissionIntensityCoordProp.Value); if (ccs2.changed) props.EmissionIntensityProp.Value.floatValue = @@ -585,9 +592,9 @@ private void InternalDrawTransparencyProperties() if (props.RimTransparencyEnabledProp.Value.floatValue > 0.5f) using (new EditorGUI.IndentLevelScope()) { - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Progress", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Progress", props.RimTransparencyProgressProp.Value, props.RimTransparencyProgressCoordProp.Value); - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Sharpness", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Sharpness", props.RimTransparencySharpnessProp.Value, props.RimTransparencySharpnessCoordProp.Value); MaterialEditorUtility.DrawToggleProperty(_editor, "Inverse", props.InverseRimTransparencyProp.Value); @@ -598,10 +605,10 @@ private void InternalDrawTransparencyProperties() if (props.LuminanceTransparencyEnabledProp.Value.floatValue > 0.5f) using (new EditorGUI.IndentLevelScope()) { - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Progress", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Progress", props.LuminanceTransparencyProgressProp.Value, props.LuminanceTransparencyProgressCoordProp.Value); - MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Sharpness", + MaterialEditorUtility.DrawPropertyAndCustomCoord(_editor, "Sharpness", props.LuminanceTransparencySharpnessProp.Value, props.LuminanceTransparencySharpnessCoordProp.Value); MaterialEditorUtility.DrawToggleProperty(_editor, "Inverse", @@ -636,11 +643,11 @@ private void InternalDrawVertexDeformationMapProperties() { var props = _commonMaterialProperties; - MaterialEditorUtility.DrawTexture(_editor, props.VertexDeformationMapProp.Value, + MaterialEditorUtility.DrawTexture(_editor, props.VertexDeformationMapProp.Value, props.VertexDeformationMapOffsetXCoordProp.Value, props.VertexDeformationMapOffsetYCoordProp.Value, props.VertexDeformationMapChannelProp.Value, null); - MaterialEditorUtility.DrawPropertyAndCustomCoord( + MaterialEditorUtility.DrawPropertyAndCustomCoord( _editor, "Intensity", props.VertexDeformationIntensityProp.Value, @@ -682,6 +689,7 @@ private void InternalDrawShadowCasterProperties() #region private variable + private string _errorMessage = ""; private const int RenderPriorityMax = 50; private const int RenderPriorityMin = -RenderPriorityMax; private MaterialEditor _editor; diff --git a/Assets/Nova/Editor/Core/Scripts/ParticlesUberLitGUI.cs b/Assets/Nova/Editor/Core/Scripts/ParticlesUberLitGUI.cs index edc0511..6e01885 100644 --- a/Assets/Nova/Editor/Core/Scripts/ParticlesUberLitGUI.cs +++ b/Assets/Nova/Editor/Core/Scripts/ParticlesUberLitGUI.cs @@ -13,231 +13,7 @@ namespace Nova.Editor.Core.Scripts /// /// GUI for a material assigned the ParticlesUberUnlit Shader. /// - internal sealed class ParticlesUberLitGUI : ParticlesGUI + internal sealed class ParticlesUberLitGUI : ParticlesUberLitGUIBase { - private ParticlesUberCommonGUI _commonGUI; - private ParticlesUberCommonMaterialProperties _commonMaterialProperties; - private MaterialEditor _editor; - - protected override void SetupProperties(MaterialProperty[] properties) - { - // common properties - _commonMaterialProperties?.Setup(properties); - // Render Settings( for lit ) - _litWorkflowModeProp.Setup(properties); - _litReceiveShadowsProp.Setup(properties); - _specularHighlightsProp.Setup(properties); - _environmentReflectionsProp.Setup(properties); - - // Sruface Map - _normalMapProp.Setup(properties); - _normalMap2DArrayProp.Setup(properties); - _normalMap3DProp.Setup(properties); - _normalMapBumpScaleProp.Setup(properties); - _specularMapProp.Setup(properties); - _specularMap2DArrayProp.Setup(properties); - _specularMap3DProp.Setup(properties); - _specularProp.Setup(properties); - - _metallicMapProp.Setup(properties); - _metallicMap2DArrayProp.Setup(properties); - _metallicMap3DProp.Setup(properties); - _metallicProp.Setup(properties); - _metallicMapChannelsXProp.Setup(properties); - _smoothnessMapProp.Setup(properties); - _smoothnessMap2DArrayProp.Setup(properties); - _smoothnessMap3DProp.Setup(properties); - _smoothnessProp.Setup(properties); - _smoothnessMapChannelsXProp.Setup(properties); - } - - - protected override void Initialize(MaterialEditor editor, MaterialProperty[] properties) - { - _commonGUI = new ParticlesUberCommonGUI(editor); - _commonMaterialProperties = new ParticlesUberCommonMaterialProperties(properties); - // Lit Settings - var prefsKeyPrefix = $"{GetType().Namespace}.{GetType().Name}."; - var litSettingsFoldoutKey = $"{prefsKeyPrefix}{nameof(LitSettingsFoldout)}"; - var surfaceMapsFoldoutKey = $"{prefsKeyPrefix}{nameof(SurfaceMapsFoldout)}"; - - - LitSettingsFoldout = new BoolEditorPrefsProperty(litSettingsFoldoutKey, true); - SurfaceMapsFoldout = new BoolEditorPrefsProperty(surfaceMapsFoldoutKey, true); - } - - protected override void DrawGUI(MaterialEditor editor, MaterialProperty[] properties) - { - _editor = editor; - _commonGUI.Setup(editor, _commonMaterialProperties); - // Render Settings - _commonGUI.DrawRenderSettingsProperties(InternalRenderSettingsProperties); - // Vertex Deformation - _commonGUI.DrawVertexDeformationProperties(); - // Base Map - _commonGUI.DrawBaseMapProperties(); - // Surface - _commonGUI.DrawProperties(SurfaceMapsFoldout, "Surface Maps", - InternalDrawSurfaceMapsProperties); // Tint Color - // Tint Color - _commonGUI.DrawTintColorProperties(); - // Flow Map - _commonGUI.DrawFlowMapProperties(); - // Parallax Map - _commonGUI.DrawParallaxMapProperties(); - // Color Correction - _commonGUI.DrawColorCorrectionProperties(); - // Alpha Transition - _commonGUI.DrawAlphaTransitionProperties(); - // Emission - _commonGUI.DrawEmissionProperties(); - // Transparency - _commonGUI.DrawTransparencyProperties(); - // ShadowCaster - _commonGUI.DrawShadowCasterProperties(); - // FixNow - _commonGUI.DrawFixNowButton(); - } - - private void InternalDrawSurfaceMapsTexturePropertiesCore(string label, Property map2DProp, - Property map2DArrayProp, - Property map3DProp, Property normalizedValueProp, - Property channelsXProperty) - { - var props = _commonMaterialProperties; - // The surface maps mode is decided by baseMapMode. - var baseMapMode = (BaseMapMode)props.BaseMapModeProp.Value.floatValue; - MaterialProperty textureProp; - switch (baseMapMode) - { - case BaseMapMode.SingleTexture: - textureProp = map2DProp.Value; - break; - case BaseMapMode.FlipBook: - textureProp = map2DArrayProp.Value; - break; - case BaseMapMode.FlipBookBlending: - textureProp = map3DProp.Value; - break; - default: - throw new ArgumentOutOfRangeException(); - } - - MaterialEditorUtility.DrawSmallTexture( - _editor, - label, - textureProp, - channelsXProperty?.Value, - normalizedValueProp?.Value - ); - } - - private void InternalDrawSurfaceMapsProperties() - { - InternalDrawSurfaceMapsTexturePropertiesCore( - "Normal Map", - _normalMapProp, - _normalMap2DArrayProp, - _normalMap3DProp, - _normalMapBumpScaleProp, - null); - - var mode = (LitWorkflowMode)_litWorkflowModeProp.Value.floatValue; - if (mode == LitWorkflowMode.Specular) - InternalDrawSurfaceMapsTexturePropertiesCore( - "Specular", - _specularMapProp, - _specularMap2DArrayProp, - _specularMap3DProp, - _specularProp, - null); - else - InternalDrawSurfaceMapsTexturePropertiesCore( - "Metallic", - _metallicMapProp, - _metallicMap2DArrayProp, - _metallicMap3DProp, - _metallicProp, - _metallicMapChannelsXProp); - - InternalDrawSurfaceMapsTexturePropertiesCore( - "Smoothness", - _smoothnessMapProp, - _smoothnessMap2DArrayProp, - _smoothnessMap3DProp, - _smoothnessProp, - _smoothnessMapChannelsXProp); - } - - private void InternalRenderSettingsProperties() - { - _commonGUI.DrawRenderSettingsPropertiesCore(); - MaterialEditorUtility.DrawEnumProperty(_editor, "Work Flow Mode", - _litWorkflowModeProp.Value); - MaterialEditorUtility.DrawToggleProperty(_editor, "Receive Shadows", _litReceiveShadowsProp.Value); - MaterialEditorUtility.DrawToggleProperty(_editor, "Specular Highlights", _specularHighlightsProp.Value); - MaterialEditorUtility.DrawToggleProperty(_editor, "Environment Reflections", - _environmentReflectionsProp.Value); - } - - protected override void MaterialChanged(Material material) - { - ParticlesUberLitMaterialPostProcessor.SetupMaterialKeywords(material); - ParticlesUberLitMaterialPostProcessor.SetupMaterialBlendMode(material); - } - - #region Foldout Properties - - private BoolEditorPrefsProperty LitSettingsFoldout { get; set; } - private BoolEditorPrefsProperty SurfaceMapsFoldout { get; set; } - - #endregion - - #region Lit Settings Material Properties - - private readonly Property _litWorkflowModeProp = new(PropertyNames.LitWorkflowMode); - private readonly Property _litReceiveShadowsProp = new(PropertyNames.LitReceiveShadows); - - #endregion - - #region Render Settings Properties - - // Specular Highlights - private readonly Property _specularHighlightsProp = new(PropertyNames.SpecularHighlights); - - // Environment Reflections - private readonly Property _environmentReflectionsProp = new(PropertyNames.EnvironmentReflections); - - #endregion - - #region Surface Maps Properties - - // normalMap - private readonly Property _normalMapProp = new(PropertyNames.NormalMap); - private readonly Property _normalMap2DArrayProp = new(PropertyNames.NormalMap2DArray); - private readonly Property _normalMap3DProp = new(PropertyNames.NormalMap3D); - private readonly Property _normalMapBumpScaleProp = new(PropertyNames.NormalMapBumpScale); - - // specularMap - private readonly Property _specularMapProp = new(PropertyNames.SpecularMap); - private readonly Property _specularMap2DArrayProp = new(PropertyNames.SpecularMap2DArray); - private readonly Property _specularMap3DProp = new(PropertyNames.SpecularMap3D); - private readonly Property _specularProp = new(PropertyNames.Specular); - - // metallicMap - private readonly Property _metallicMapProp = new(PropertyNames.MetallicMap); - private readonly Property _metallicMap2DArrayProp = new(PropertyNames.MetallicMap2DArray); - private readonly Property _metallicMap3DProp = new(PropertyNames.MetallicMap3D); - private readonly Property _metallicProp = new(PropertyNames.Metallic); - private readonly Property _metallicMapChannelsXProp = new(PropertyNames.MetallicMapChannelsX); - - // smoothnessMap - private readonly Property _smoothnessMapProp = new(PropertyNames.SmoothnessMap); - private readonly Property _smoothnessMap2DArrayProp = new(PropertyNames.SmoothnessMap2DArray); - private readonly Property _smoothnessMap3DProp = new(PropertyNames.SmoothnessMap3D); - private readonly Property _smoothnessProp = new(PropertyNames.Smoothness); - private readonly Property _smoothnessMapChannelsXProp = new(PropertyNames.SmoothnessMapChannelsX); - - #endregion } -} \ No newline at end of file +} diff --git a/Assets/Nova/Editor/Core/Scripts/ParticlesUberLitGUIBase.cs b/Assets/Nova/Editor/Core/Scripts/ParticlesUberLitGUIBase.cs new file mode 100644 index 0000000..7b0c038 --- /dev/null +++ b/Assets/Nova/Editor/Core/Scripts/ParticlesUberLitGUIBase.cs @@ -0,0 +1,245 @@ +// -------------------------------------------------------------- +// Copyright 2024 CyberAgent, Inc. +// -------------------------------------------------------------- + +using System; +using Nova.Editor.Foundation.Scripts; +using UnityEditor; +using UnityEngine; +using PropertyNames = Nova.Editor.Core.Scripts.MaterialPropertyNames; + +namespace Nova.Editor.Core.Scripts +{ + /// + /// GUI for a material assigned the ParticlesUberUnlit Shader. + /// + internal class ParticlesUberLitGUIBase : ParticlesGUI where TCustomCoord : Enum + { + private ParticlesUberCommonGUI _commonGUI; + private ParticlesUberCommonMaterialProperties _commonMaterialProperties; + private MaterialEditor _editor; + + protected override void SetupProperties(MaterialProperty[] properties) + { + // common properties + _commonMaterialProperties?.Setup(properties); + // Render Settings( for lit ) + _litWorkflowModeProp.Setup(properties); + _litReceiveShadowsProp.Setup(properties); + _specularHighlightsProp.Setup(properties); + _environmentReflectionsProp.Setup(properties); + + // Sruface Map + _normalMapProp.Setup(properties); + _normalMap2DArrayProp.Setup(properties); + _normalMap3DProp.Setup(properties); + _normalMapBumpScaleProp.Setup(properties); + _specularMapProp.Setup(properties); + _specularMap2DArrayProp.Setup(properties); + _specularMap3DProp.Setup(properties); + _specularProp.Setup(properties); + + _metallicMapProp.Setup(properties); + _metallicMap2DArrayProp.Setup(properties); + _metallicMap3DProp.Setup(properties); + _metallicProp.Setup(properties); + _metallicMapChannelsXProp.Setup(properties); + _smoothnessMapProp.Setup(properties); + _smoothnessMap2DArrayProp.Setup(properties); + _smoothnessMap3DProp.Setup(properties); + _smoothnessProp.Setup(properties); + _smoothnessMapChannelsXProp.Setup(properties); + } + + + protected override void Initialize(MaterialEditor editor, MaterialProperty[] properties) + { + _commonGUI = new ParticlesUberCommonGUI(editor); + _commonMaterialProperties = new ParticlesUberCommonMaterialProperties(properties); + // Lit Settings + var prefsKeyPrefix = $"{GetType().Namespace}.{GetType().Name}."; + var litSettingsFoldoutKey = $"{prefsKeyPrefix}{nameof(LitSettingsFoldout)}"; + var surfaceMapsFoldoutKey = $"{prefsKeyPrefix}{nameof(SurfaceMapsFoldout)}"; + + + LitSettingsFoldout = new BoolEditorPrefsProperty(litSettingsFoldoutKey, true); + SurfaceMapsFoldout = new BoolEditorPrefsProperty(surfaceMapsFoldoutKey, true); + } + + protected override void DrawGUI(MaterialEditor editor, MaterialProperty[] properties) + { + _editor = editor; + _commonGUI.Setup(editor, _commonMaterialProperties); + // Render Settings + _commonGUI.DrawRenderSettingsProperties(InternalRenderSettingsProperties); + // Vertex Deformation + _commonGUI.DrawVertexDeformationProperties(); + // Base Map + _commonGUI.DrawBaseMapProperties(); + // Surface + _commonGUI.DrawProperties(SurfaceMapsFoldout, "Surface Maps", + InternalDrawSurfaceMapsProperties); // Tint Color + // Tint Color + _commonGUI.DrawTintColorProperties(); + // Flow Map + _commonGUI.DrawFlowMapProperties(); + // Parallax Map + _commonGUI.DrawParallaxMapProperties(); + // Color Correction + _commonGUI.DrawColorCorrectionProperties(); + // Alpha Transition + _commonGUI.DrawAlphaTransitionProperties(); + // Emission + _commonGUI.DrawEmissionProperties(); + // Transparency + _commonGUI.DrawTransparencyProperties(); + // ShadowCaster + _commonGUI.DrawShadowCasterProperties(); + // FixNow + _commonGUI.DrawFixNowButton(); + // Error Message + _commonGUI.DrawErrorMessage(); + } + + private void InternalDrawSurfaceMapsTexturePropertiesCore(string label, Property map2DProp, + Property map2DArrayProp, + Property map3DProp, Property normalizedValueProp, + Property channelsXProperty) + { + var props = _commonMaterialProperties; + // The surface maps mode is decided by baseMapMode. + var baseMapMode = (BaseMapMode)props.BaseMapModeProp.Value.floatValue; + MaterialProperty textureProp; + switch (baseMapMode) + { + case BaseMapMode.SingleTexture: + textureProp = map2DProp.Value; + break; + case BaseMapMode.FlipBook: + textureProp = map2DArrayProp.Value; + break; + case BaseMapMode.FlipBookBlending: + textureProp = map3DProp.Value; + break; + default: + throw new ArgumentOutOfRangeException(); + } + + MaterialEditorUtility.DrawSmallTexture( + _editor, + label, + textureProp, + channelsXProperty?.Value, + normalizedValueProp?.Value + ); + } + + private void InternalDrawSurfaceMapsProperties() + { + InternalDrawSurfaceMapsTexturePropertiesCore( + "Normal Map", + _normalMapProp, + _normalMap2DArrayProp, + _normalMap3DProp, + _normalMapBumpScaleProp, + null); + + var mode = (LitWorkflowMode)_litWorkflowModeProp.Value.floatValue; + if (mode == LitWorkflowMode.Specular) + InternalDrawSurfaceMapsTexturePropertiesCore( + "Specular", + _specularMapProp, + _specularMap2DArrayProp, + _specularMap3DProp, + _specularProp, + null); + else + InternalDrawSurfaceMapsTexturePropertiesCore( + "Metallic", + _metallicMapProp, + _metallicMap2DArrayProp, + _metallicMap3DProp, + _metallicProp, + _metallicMapChannelsXProp); + + InternalDrawSurfaceMapsTexturePropertiesCore( + "Smoothness", + _smoothnessMapProp, + _smoothnessMap2DArrayProp, + _smoothnessMap3DProp, + _smoothnessProp, + _smoothnessMapChannelsXProp); + } + + private void InternalRenderSettingsProperties() + { + _commonGUI.DrawRenderSettingsPropertiesCore(); + MaterialEditorUtility.DrawEnumProperty(_editor, "Work Flow Mode", + _litWorkflowModeProp.Value); + MaterialEditorUtility.DrawToggleProperty(_editor, "Receive Shadows", _litReceiveShadowsProp.Value); + MaterialEditorUtility.DrawToggleProperty(_editor, "Specular Highlights", _specularHighlightsProp.Value); + MaterialEditorUtility.DrawToggleProperty(_editor, "Environment Reflections", + _environmentReflectionsProp.Value); + } + + protected override void MaterialChanged(Material material) + { + ParticlesUberLitMaterialPostProcessor.SetupMaterialKeywords(material); + ParticlesUberLitMaterialPostProcessor.SetupMaterialBlendMode(material); + } + + #region Foldout Properties + + private BoolEditorPrefsProperty LitSettingsFoldout { get; set; } + private BoolEditorPrefsProperty SurfaceMapsFoldout { get; set; } + + #endregion + + #region Lit Settings Material Properties + + private readonly Property _litWorkflowModeProp = new(PropertyNames.LitWorkflowMode); + private readonly Property _litReceiveShadowsProp = new(PropertyNames.LitReceiveShadows); + + #endregion + + #region Render Settings Properties + + // Specular Highlights + private readonly Property _specularHighlightsProp = new(PropertyNames.SpecularHighlights); + + // Environment Reflections + private readonly Property _environmentReflectionsProp = new(PropertyNames.EnvironmentReflections); + + #endregion + + #region Surface Maps Properties + + // normalMap + private readonly Property _normalMapProp = new(PropertyNames.NormalMap); + private readonly Property _normalMap2DArrayProp = new(PropertyNames.NormalMap2DArray); + private readonly Property _normalMap3DProp = new(PropertyNames.NormalMap3D); + private readonly Property _normalMapBumpScaleProp = new(PropertyNames.NormalMapBumpScale); + + // specularMap + private readonly Property _specularMapProp = new(PropertyNames.SpecularMap); + private readonly Property _specularMap2DArrayProp = new(PropertyNames.SpecularMap2DArray); + private readonly Property _specularMap3DProp = new(PropertyNames.SpecularMap3D); + private readonly Property _specularProp = new(PropertyNames.Specular); + + // metallicMap + private readonly Property _metallicMapProp = new(PropertyNames.MetallicMap); + private readonly Property _metallicMap2DArrayProp = new(PropertyNames.MetallicMap2DArray); + private readonly Property _metallicMap3DProp = new(PropertyNames.MetallicMap3D); + private readonly Property _metallicProp = new(PropertyNames.Metallic); + private readonly Property _metallicMapChannelsXProp = new(PropertyNames.MetallicMapChannelsX); + + // smoothnessMap + private readonly Property _smoothnessMapProp = new(PropertyNames.SmoothnessMap); + private readonly Property _smoothnessMap2DArrayProp = new(PropertyNames.SmoothnessMap2DArray); + private readonly Property _smoothnessMap3DProp = new(PropertyNames.SmoothnessMap3D); + private readonly Property _smoothnessProp = new(PropertyNames.Smoothness); + private readonly Property _smoothnessMapChannelsXProp = new(PropertyNames.SmoothnessMapChannelsX); + + #endregion + } +} diff --git a/Assets/Nova/Editor/Core/Scripts/ParticlesUberLitGUIBase.cs.meta b/Assets/Nova/Editor/Core/Scripts/ParticlesUberLitGUIBase.cs.meta new file mode 100644 index 0000000..6897b27 --- /dev/null +++ b/Assets/Nova/Editor/Core/Scripts/ParticlesUberLitGUIBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 81cf82469daa47c4987cf886908bd0fd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Nova/Editor/Core/Scripts/ParticlesUberUnlitGUI.cs b/Assets/Nova/Editor/Core/Scripts/ParticlesUberUnlitGUI.cs index 8bb8e7f..cbed421 100644 --- a/Assets/Nova/Editor/Core/Scripts/ParticlesUberUnlitGUI.cs +++ b/Assets/Nova/Editor/Core/Scripts/ParticlesUberUnlitGUI.cs @@ -11,44 +11,5 @@ namespace Nova.Editor.Core.Scripts /// /// GUI for a material assigned the ParticlesUberUnlit Shader. /// - internal sealed class ParticlesUberUnlitGUI : ParticlesGUI - { - private ParticlesUberCommonGUI _commonGUI; - - private ParticlesUberCommonMaterialProperties _commonMaterialProperties; - - protected override void SetupProperties(MaterialProperty[] properties) - { - _commonMaterialProperties.Setup(properties); - } - - protected override void Initialize(MaterialEditor editor, MaterialProperty[] properties) - { - _commonGUI = new ParticlesUberCommonGUI(editor); - _commonMaterialProperties = new ParticlesUberCommonMaterialProperties(properties); - } - - protected override void DrawGUI(MaterialEditor editor, MaterialProperty[] properties) - { - _commonGUI.Setup(editor, _commonMaterialProperties); - _commonGUI.DrawRenderSettingsProperties(null); - _commonGUI.DrawVertexDeformationProperties(); - _commonGUI.DrawBaseMapProperties(); - _commonGUI.DrawTintColorProperties(); - _commonGUI.DrawFlowMapProperties(); - _commonGUI.DrawParallaxMapProperties(); - _commonGUI.DrawColorCorrectionProperties(); - _commonGUI.DrawAlphaTransitionProperties(); - _commonGUI.DrawEmissionProperties(); - _commonGUI.DrawTransparencyProperties(); - _commonGUI.DrawShadowCasterProperties(); - _commonGUI.DrawFixNowButton(); - } - - protected override void MaterialChanged(Material material) - { - ParticlesUberUnlitMaterialPostProcessor.SetupMaterialKeywords(material); - ParticlesUberUnlitMaterialPostProcessor.SetupMaterialBlendMode(material); - } - } -} \ No newline at end of file + internal sealed class ParticlesUberUnlitGUI : ParticlesUberUnlitGUIBase{} +} diff --git a/Assets/Nova/Editor/Core/Scripts/ParticlesUberUnlitGUIBase.cs b/Assets/Nova/Editor/Core/Scripts/ParticlesUberUnlitGUIBase.cs new file mode 100644 index 0000000..439d23a --- /dev/null +++ b/Assets/Nova/Editor/Core/Scripts/ParticlesUberUnlitGUIBase.cs @@ -0,0 +1,56 @@ +// -------------------------------------------------------------- +// Copyright 2024 CyberAgent, Inc. +// -------------------------------------------------------------- + +using System; +using UnityEditor; +using UnityEngine; +using PropertyNames = Nova.Editor.Core.Scripts.MaterialPropertyNames; + +namespace Nova.Editor.Core.Scripts +{ + /// + /// GUI for a material assigned the ParticlesUberUnlit Shader. + /// + internal class ParticlesUberUnlitGUIBase : ParticlesGUI where TCustomCoord : Enum + { + private ParticlesUberCommonGUI _commonGUI; + + private ParticlesUberCommonMaterialProperties _commonMaterialProperties; + + protected override void SetupProperties(MaterialProperty[] properties) + { + _commonMaterialProperties.Setup(properties); + } + + protected override void Initialize(MaterialEditor editor, MaterialProperty[] properties) + { + _commonGUI = new ParticlesUberCommonGUI(editor); + _commonMaterialProperties = new ParticlesUberCommonMaterialProperties(properties); + } + + protected override void DrawGUI(MaterialEditor editor, MaterialProperty[] properties) + { + _commonGUI.Setup(editor, _commonMaterialProperties); + _commonGUI.DrawRenderSettingsProperties(null); + _commonGUI.DrawVertexDeformationProperties(); + _commonGUI.DrawBaseMapProperties(); + _commonGUI.DrawTintColorProperties(); + _commonGUI.DrawFlowMapProperties(); + _commonGUI.DrawParallaxMapProperties(); + _commonGUI.DrawColorCorrectionProperties(); + _commonGUI.DrawAlphaTransitionProperties(); + _commonGUI.DrawEmissionProperties(); + _commonGUI.DrawTransparencyProperties(); + _commonGUI.DrawShadowCasterProperties(); + _commonGUI.DrawFixNowButton(); + _commonGUI.DrawErrorMessage(); + } + + protected override void MaterialChanged(Material material) + { + ParticlesUberUnlitMaterialPostProcessor.SetupMaterialKeywords(material); + ParticlesUberUnlitMaterialPostProcessor.SetupMaterialBlendMode(material); + } + } +} diff --git a/Assets/Nova/Editor/Core/Scripts/ParticlesUberUnlitGUIBase.cs.meta b/Assets/Nova/Editor/Core/Scripts/ParticlesUberUnlitGUIBase.cs.meta new file mode 100644 index 0000000..9e8ff20 --- /dev/null +++ b/Assets/Nova/Editor/Core/Scripts/ParticlesUberUnlitGUIBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a6ebdb7eb684ccf438904e6ef08406b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Nova/Editor/Core/Scripts/UICustomCoord.cs b/Assets/Nova/Editor/Core/Scripts/UICustomCoord.cs new file mode 100644 index 0000000..c5a03d5 --- /dev/null +++ b/Assets/Nova/Editor/Core/Scripts/UICustomCoord.cs @@ -0,0 +1,15 @@ +// -------------------------------------------------------------- +// Copyright 2024 CyberAgent, Inc. +// -------------------------------------------------------------- + +namespace Nova.Editor.Core.Scripts +{ + public enum UICustomCoord + { + Unused = 0, + Coord1X = 1, + Coord1Y = 11, + Coord2X = 2, + Coord2Y = 12, + } +} diff --git a/Assets/Nova/Editor/Core/Scripts/UICustomCoord.cs.meta b/Assets/Nova/Editor/Core/Scripts/UICustomCoord.cs.meta new file mode 100644 index 0000000..e77a71f --- /dev/null +++ b/Assets/Nova/Editor/Core/Scripts/UICustomCoord.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: adf149770e96d444cad6ae52d7b81840 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Nova/Editor/Core/Scripts/UIParticlesUberLitGUI.cs b/Assets/Nova/Editor/Core/Scripts/UIParticlesUberLitGUI.cs new file mode 100644 index 0000000..1fb3836 --- /dev/null +++ b/Assets/Nova/Editor/Core/Scripts/UIParticlesUberLitGUI.cs @@ -0,0 +1,15 @@ +// -------------------------------------------------------------- +// Copyright 2024 CyberAgent, Inc. +// -------------------------------------------------------------- + +using PropertyNames = Nova.Editor.Core.Scripts.MaterialPropertyNames; + +namespace Nova.Editor.Core.Scripts +{ + /// + /// GUI for a material assigned the UIParticlesUberUnlit Shader. + /// + internal sealed class UIParticlesUberLitGUI : ParticlesUberLitGUIBase + { + } +} diff --git a/Assets/Nova/Editor/Core/Scripts/UIParticlesUberLitGUI.cs.meta b/Assets/Nova/Editor/Core/Scripts/UIParticlesUberLitGUI.cs.meta new file mode 100644 index 0000000..b23d7ba --- /dev/null +++ b/Assets/Nova/Editor/Core/Scripts/UIParticlesUberLitGUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c44a4ddd522873e4498988d921a52450 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Nova/Editor/Core/Scripts/UIParticlesUberUnlitGUI.cs b/Assets/Nova/Editor/Core/Scripts/UIParticlesUberUnlitGUI.cs new file mode 100644 index 0000000..e470a6b --- /dev/null +++ b/Assets/Nova/Editor/Core/Scripts/UIParticlesUberUnlitGUI.cs @@ -0,0 +1,15 @@ +// -------------------------------------------------------------- +// Copyright 2024 CyberAgent, Inc. +// -------------------------------------------------------------- + +using PropertyNames = Nova.Editor.Core.Scripts.MaterialPropertyNames; + +namespace Nova.Editor.Core.Scripts +{ + /// + /// GUI for a material assigned the UIParticlesUberUnlit Shader. + /// + internal sealed class UIParticlesUberUnlitGUI : ParticlesUberUnlitGUIBase + { + } +} diff --git a/Assets/Nova/Editor/Core/Scripts/UIParticlesUberUnlitGUI.cs.meta b/Assets/Nova/Editor/Core/Scripts/UIParticlesUberUnlitGUI.cs.meta new file mode 100644 index 0000000..c2afa66 --- /dev/null +++ b/Assets/Nova/Editor/Core/Scripts/UIParticlesUberUnlitGUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8a98ef16f6b10604ea503d6d82c01c0a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberLit.shader b/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberLit.shader new file mode 100644 index 0000000..3047491 --- /dev/null +++ b/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberLit.shader @@ -0,0 +1,302 @@ +Shader "Nova/UIParticles/UberLit" +{ + Properties + { + // Render Settings + _RenderType("Render Type", Float) = 2.0 + _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 + _TransparentBlendMode("Blend Mode", Float) = 0.0 + _Cull("Cull", Float) = 2.0 + _QueueOffset("Queue Offset", Float) = 0.0 + _VertexAlphaMode("Vertex Alpha Mode", Float) = 0.0 + _BlendSrc("Blend Src", Float) = 1.0 + _BlendDst("Blend Dst", Float) = 0.0 + _ZWrite("ZWrite", Float) = 1.0 + _ZWriteOverride("ZWrite Override", Float) = -1.0 + _ZTest("ZTest", Float) = 4.0 + _LitWorkflowMode("Lit Workflow Mode",Float) = 0.0 + _LitReceiveShadows("Lit Receive Shadows", Float) = 0.0 + _SpecularHighlights("Specular Highlights", Float) = 0.0 + _EnvironmentReflections("Environment Reflections", Float) = 1.0 + + // Surface Maps + _NormalMap("Normal Map", 2D) = "" {} + _NormalMap2DArray("Normal Map 2D Array", 2DArray) = "" {} + _NormalMap3D("Normal Map 3D", 3D) = "" {} + _NormalMapBumpScale("Normal Map Bump Scale", Float) = 1.0 + _SpecularMap("Specular Map", 2D) = "" {} + _SpecularMap2DArray("Specular Map 2D Array", 2DArray) = "" {} + _SpecularMap3D("Specluar Map 3D", 3D) = "" {} + _SpecularColor("Specular Color", Color) = (1, 1, 1, 1) + _SpecularMapChannelsX("Specular Map Channes X", Float) = 0.0 + _MetallicMap("Metallic Map", 2D) = "" {} + _MetallicMap2DArray("Metallic Map 2D Array", 2DArray) = "" {} + _MetallicMap3D("Metallic Map 3D", 3D) = "" {} + [Gamma]_Metallic("Metallic", Range( 0.0, 1.0)) = 1.0 + _MetallicMapChannelsX("Metallic Map Channes X", Float) = 0.0 + _SmoothnessMap("Smoothness Map", 2D) = "" {} + _SmoothnessMap2DArray("Smoothness Map 2D Array", 2DArray) = "" {} + _SmoothnessMap3D("Smoothness Map 3D", 3D) = "" {} + _Smoothness("Smoothness", Range( 0.0, 1.0)) = 1.0 + _SmoothnessMapChannelsX("Smoothness Map Channes X", Float) = 3.0 + + // Base Map + _BaseMapMode("Base Map Mode", Float) = 0.0 + [MainTexture] _BaseMap("Base Map", 2D) = "white" {} + _BaseMap2DArray("Base Map 2D Array", 2DArray) = "" {} + _BaseMap3D("Base Map 3D", 3D) = "" {} + _BaseMapProgress("Base Map Progress", Range(0.0, 1.0)) = 0.0 + _BaseMapProgressCoord("Base Map Progress Coord", Float) = 0.0 + _BaseMapSliceCount("Base Map Slice Count", Float) = 4.0 + _BaseMapOffsetXCoord("Base Map Offset X Coord", Float) = 0.0 + _BaseMapOffsetYCoord("Base Map Offset Y Coord", Float) = 0.0 + _BaseMapRotation("Base Map Rotation", Range(0.0, 1.0)) = 0.0 + _BaseMapRotationCoord("Base Map Rotation Coord", Float) = 0.0 + _BaseMapRotationOffsets("Base Map Rotation Offsets", Vector) = (0.0, 0.0, 0.0, 0.0) + _BaseMapMirrorSampling("Base Map Mirror Sampling", Float) = 0.0 + + // Tint Color + _TintAreaMode("Tint Area Mode", Float) = 0.0 + _TintColorMode("Tint Color Mode", Float) = 0.0 + [HDR] _TintColor("Tint Color", Color) = (1, 1, 1, 1) + _TintMap("Tint Map", 2D) = "white" {} + _TintMap3D("Tint Map 3D", 3D) = "" {} + _TintMap3DProgress("Tint Map 3D Progress", Range(0, 1)) = 0.0 + _TintMap3DProgressCoord("Tint Map 3D Progress Coord", Float) = 0.0 + _TintMapSliceCount("Base Map Slice Count", Float) = 4.0 + _TintMapOffsetXCoord("Tint Map Offset X Coord", Float) = 0.0 + _TintMapOffsetYCoord("Tint Map Offset Y Coord", Float) = 0.0 + _TintBlendRate("Tint Blend Rate", Range(0.0, 1.0)) = 1.0 + _TintBlendRateCoord("Tint Blend Rate Coord", Float) = 0.0 + _TintRimProgress("Tint Rim Progress", Range(0.0, 1.0)) = 0.5 + _TintRimProgressCoord("Tint Rim Progress Coord", Float) = 0.0 + _TintRimSharpness("Tint Rim Sharpness", Range(0.0, 1.0)) = 0.5 + _TintRimSharpnessCoord("Tint Rim Sharpness Coord", Float) = 0.0 + _InverseTintRim("Inverse Tint Rim", Float) = 0.0 + + // Flow Map + _FlowMap("Flow Map", 2D) = "grey" {} + _FlowMapOffsetXCoord("Flow Map Offset X Coord", Float) = 0.0 + _FlowMapOffsetYCoord("Flow Map Offset Y Coord", Float) = 0.0 + _FlowMapChannelsX("Flow Map Channes X", Float) = 0.0 + _FlowMapChannelsY("Flow Map Channes Y", Float) = 1.0 + _FlowIntensity("Flow Intensity", Float) = 1.0 + _FlowIntensityCoord("Flow Intensity Coord", Float) = 0.0 + _FlowMapTarget("Flow Map Target", Float) = 1.0 + + // Parallax Map + _ParallaxMapMode("Emission Map Mode", Float) = 0.0 + _ParallaxMap("Parallax Map", 2D) = "" {} + _ParallaxMap2DArray("Parallax Map 2D Array", 2DArray) = "" {} + _ParallaxMap3D("Parallax Map 3D", 3D) = "" {} + _ParallaxMapProgress("Parallax Map Progress", Range(0.0, 1.0)) = 0.0 + _ParallaxMapProgressCoord("Parallax Map Progress Coord", Float) = 0.0 + _ParallaxMapOffsetXCoord("Parallax Map Offset X Coord", Float) = 0.0 + _ParallaxMapOffsetYCoord("Parallax Map Offset Y Coord", Float) = 0.0 + _ParallaxMapSliceCount("Parallax Map Slice Count", Float) = 4.0 + _ParallaxMapChannel("Parallax Map Channel", Float) = 0.0 + _ParallaxStrength("Parallax Strength", Range(0.0, 1.0)) = 0.3 + _ParallaxMapTarget("Parallax Map Target", Float) = 1.0 + + // Color Correction + _ColorCorrectionMode("Alpha Transition Progress Coord", Float) = 0.0 + _GradientMap("Gradient Map", 2D) = "white" {} + + // Alpha Transition + _AlphaTransitionMode("Alpha Transition Mode", Float) = 0.0 + _AlphaTransitionMapMode("Alpha Transition Map Mode", Float) = 0.0 + _AlphaTransitionMap("Alpha Transition Map", 2D) = "white" {} + _AlphaTransitionMap2DArray("Alpha Transition Map 2D Array", 2DArray) = "" {} + _AlphaTransitionMap3D("Alpha Transition Map 3D", 3D) = "" {} + _AlphaTransitionMapProgress("Alpha Transition Map Progress", Range(0.0, 1.0)) = 0.0 + _AlphaTransitionMapProgressCoord("Alpha Transition Map Progress Coord", Float) = 0.0 + _AlphaTransitionMapOffsetXCoord("Alpha Transition Map Offset X Coord", Float) = 0.0 + _AlphaTransitionMapOffsetYCoord("Alpha Transition Map Offset Y Coord", Float) = 0.0 + _AlphaTransitionMapChannelsX("Alpha Transition Map Channes X", Float) = 0.0 + _AlphaTransitionMapSliceCount("Alpha Transition Map Slice Count", Float) = 4.0 + _AlphaTransitionProgress("Alpha Transition Progress", Range(0.0, 1.0)) = 0.0 + _AlphaTransitionProgressCoord("Alpha Transition Progress Coord", Float) = 0.0 + _DissolveSharpness("Dissolve Sharpness", Range(0.0, 1.0)) = 0.5 + _AlphaTransitionSecondTextureBlendMode("Alpha Transition Second Texture BlendMode", Float) = 0.0 + _AlphaTransitionMapSecondTexture("Alpha Transition Second Texture Map", 2D) = "white" {} + _AlphaTransitionMapSecondTexture2DArray("Alpha Transition Second Texture Map 2D Array", 2DArray) = "" {} + _AlphaTransitionMapSecondTexture3D("Alpha Transition Second Texture Map 3D", 3D) = "" {} + _AlphaTransitionMapSecondTextureProgress("Alpha Transition Map Second Texture Progress", Range(0.0, 1.0)) = 0.0 + _AlphaTransitionMapSecondTextureProgressCoord("Alpha Transition Map Second Texture Progress Coord", Float) = 0.0 + _AlphaTransitionMapSecondTextureOffsetXCoord("Alpha Transition Second Texture Map Offset X Coord", Float) = 0.0 + _AlphaTransitionMapSecondTextureOffsetYCoord("Alpha Transition Second Texture Map Offset Y Coord", Float) = 0.0 + _AlphaTransitionMapSecondTextureChannelsX("Alpha Transition Second Texture Map Channes X", Float) = 0.0 + _AlphaTransitionMapSecondTextureSliceCount("Alpha Transition Map Second Texture Slice Count", Float) = 4.0 + _AlphaTransitionProgressSecondTexture("Alpha Transition Second Texture Progress", Range(0.0, 1.0)) = 0.0 + _AlphaTransitionProgressCoordSecondTexture("Alpha Transition Second Texture Progress Coord", Float) = 0.0 + _DissolveSharpnessSecondTexture("Dissolve Sharpness", Range(0.0, 1.0)) = 0.5 + + // Emission + _EmissionAreaType("Emission Area Type", Float) = 0.0 + _EmissionMapMode("Emission Map Mode", Float) = 0.0 + _EmissionMap("Emission Map", 2D) = "black" {} + _EmissionMap2DArray("Emission Map 2D Array", 2DArray) = "" {} + _EmissionMap3D("Emission Map 3D", 3D) = "" {} + _EmissionMapProgress("Emission Map Progress", Range(0.0, 1.0)) = 0.0 + _EmissionMapProgressCoord("Emission Map Progress Coord", Float) = 0.0 + _EmissionMapOffsetXCoord("Emission Map Offset X Coord", Float) = 0.0 + _EmissionMapOffsetYCoord("Emission Map Offset Y Coord", Float) = 0.0 + _EmissionMapChannelsX("Emission Map Channels X", Float) = 0.0 + _EmissionMapSliceCount("Alpha Transition Map Slice Count", Float) = 4.0 + _EmissionColorType("Emission Color Type", Float) = 0.0 + [HDR]_EmissionColor("Emission Color", Color) = (0, 0, 0, 1) + _EmissionColorRamp("Emission Color Ramp", 2D) = "black" {} + _EmissionIntensity("Emission Intensity", Float) = 1.0 + _EmissionIntensityCoord("Emission Intensity Coord", Float) = 0.0 + _KeepEdgeTransparency("Keep Edge Transparency", Float) = 1.0 + + // Transparency + _RimTransparencyEnabled("Rim Transparency Enabled", Float) = 0.0 + _RimTransparencyProgress("Rim Transparency Progress", Range(0.0, 1.0)) = 0.5 + _RimTransparencyProgressCoord("Rim Transparency Progress Coord", Float) = 0.0 + _RimTransparencySharpness("Rim Transparency Sharpness", Range(0.0, 1.0)) = 0.5 + _RimTransparencySharpnessCoord("Rim Transparency Sharpness Coord", Float) = 0.0 + _InverseRimTransparency("Inverse Rim Transparency", Float) = 0.0 + _LuminanceTransparencyEnabled("Luminance Transparency Enabled", Float) = 0.0 + _LuminanceTransparencyProgress("Luminance Transparency Progress", Range(0.0, 1.0)) = 0.5 + _LuminanceTransparencyProgressCoord("Luminance Transparency Progress Coord", Float) = 0.0 + _LuminanceTransparencySharpness("Luminance Transparency Sharpness", Range(0.0, 1.0)) = 0.5 + _LuminanceTransparencySharpnessCoord("Luminance Transparency Sharpness Coord", Float) = 0.0 + _InverseLuminanceTransparency("Inverse Luminance Transparency", Float) = 0.0 + _SoftParticlesEnabled("Soft Particles Enabled", Float) = 0.0 + _SoftParticlesIntensity("Soft Particles Intensity", Float) = 1.0 + _DepthFadeEnabled("Depth Fade Enabled", Float) = 0.0 + _DepthFadeNear("Depth Fade Near", Float) = 1.0 + _DepthFadeFar("Depth Fade Far", Float) = 10.0 + _DepthFadeWidth("Depth Fade Width", Float) = 1.0 + + // Vertex Deformation + _VertexDeformationEnabled ("Vertex Deformation Enabled", Float) = 0 + _VertexDeformationMap ("Vertex Deformation Map", 2D) = "white" {} + _VertexDeformationMapOffsetXCoord("VertexDeformation Map Offset X Coord", Float) = 0.0 + _VertexDeformationMapOffsetYCoord("VertexDeformation Map Offset Y Coord", Float) = 0.0 + _VertexDeformationMapChannel("VertexDeformation Map Channel", Float) = 0.0 + _VertexDeformationIntensity("VertexDeformation Intensity", Float) = 0.1 + _VertexDeformationIntensityCoord("VertexDeformation Intensity Coord", Float) = 0.0 + + // Shadow Caster + _ShadowCasterEnabled("Shadow Caster", Float) = 0 + _ShadowCasterApplyVertexDeformation("Shadow Caster Vertex Deformation Enabled", Float) = 0 + _ShadowCasterAlphaTestEnabled("Shadow Caster Alpha Test Enabled", Float) = 0 + _ShadowCasterAlphaCutoff("Shadow Caster Alpha Test Cutoff", Range(0.0, 1.0)) = 0.5 + _ShadowCasterAlphaAffectedByTintColor("Shadow Caster Alpha Effect By Tint Color", Float) = 0 + _ShadowCasterAlphaAffectedByFlowMap("Shadow Caster Alpha Effect By Flow Map", Float) = 0 + _ShadowCasterAlphaAffectedByAlphaTransitionMap("Shadow Caster Alpha Effect By Alpha Transition Map", Float) = 0 + _ShadowCasterAlphaAffectedByTransparencyLuminance("Shadow Caster Alpha Effect By Transparency Luminance", Float) = 0 + } + + SubShader + { + Tags + { + "RenderType" = "Opaque" + "IgnoreProjector" = "True" + "PreviewType" = "Plane" + "PerformanceChecks" = "False" + "RenderPipeline" = "UniversalPipeline" + } + + Pass + { + Tags + { + "LightMode" = "UniversalForward" + } + Blend [_BlendSrc] [_BlendDst] + ZWrite[_ZWrite] + Cull[_Cull] + ColorMask RGB + Lighting Off + ZTest [_ZTest] + + HLSLPROGRAM + #pragma vertex vertLit + #pragma fragment fragLit + #pragma target 3.5 + + // Unity Defined + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma instancing_options procedural:ParticleInstancingSetup + #pragma require 2darray + + // ------------------------------------- + // Universal Pipeline keywords + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS + #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE + #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS + #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS + #pragma multi_compile_fragment _ _SHADOWS_SOFT + + // Render Settings + #pragma shader_feature_local_fragment _VERTEX_ALPHA_AS_TRANSITION_PROGRESS + #pragma shader_feature_local_fragment _ALPHAMODULATE_ENABLED + #pragma shader_feature_local_fragment _ALPHATEST_ENABLED + + #pragma shader_feature_local _RECEIVE_SHADOWS_ENABLED + #pragma shader_feature_local _SPECULAR_HIGHLIGHTS_ENABLED + #pragma shader_feature_local _ENVIRONMENT_REFLECTIONS_ENABLED + #pragma shader_feature_local _SPECULAR_SETUP + + // Surface maps + #pragma shader_feature_local _NORMAL_MAP_ENABLED + #pragma shader_feature_local_fragment _METALLIC_MAP_ENABLED + #pragma shader_feature_local_fragment _SMOOTHNESS_MAP_ENABLED + #pragma shader_feature_local_fragment _SPECULAR_MAP_ENABLED + + // Base Map + #pragma shader_feature_local _BASE_MAP_MODE_2D _BASE_MAP_MODE_2D_ARRAY _BASE_MAP_MODE_3D + #pragma shader_feature_local_vertex _BASE_MAP_ROTATION_ENABLED + #pragma shader_feature_local_fragment _ _BASE_SAMPLER_STATE_POINT_MIRROR _BASE_SAMPLER_STATE_LINEAR_MIRROR _BASE_SAMPLER_STATE_TRILINEAR_MIRROR + + // Tint Color + #pragma shader_feature_local _ _TINT_AREA_ALL _TINT_AREA_RIM + #pragma shader_feature_local _ _TINT_COLOR_ENABLED _TINT_MAP_ENABLED _TINT_MAP_3D_ENABLED + + // Flow Map + #pragma shader_feature_local _FLOW_MAP_ENABLED // Obsolete, but retained for compatibility. + #pragma shader_feature_local _FLOW_MAP_TARGET_BASE + #pragma shader_feature_local _FLOW_MAP_TARGET_TINT + #pragma shader_feature_local _FLOW_MAP_TARGET_EMISSION + #pragma shader_feature_local _FLOW_MAP_TARGET_ALPHA_TRANSITION + + // Parallax Map + #pragma shader_feature_local _PARALLAX_MAP_TARGET_BASE + #pragma shader_feature_local _PARALLAX_MAP_TARGET_TINT + #pragma shader_feature_local _PARALLAX_MAP_TARGET_EMISSION + #pragma shader_feature_local _PARALLAX_MAP_MODE_2D _PARALLAX_MAP_MODE_2D_ARRAY _PARALLAX_MAP_MODE_3D + + // Color Correction + #pragma shader_feature_local_fragment _ _GREYSCALE_ENABLED _GRADIENT_MAP_ENABLED + + // Alpha Transition + #pragma shader_feature_local _ _FADE_TRANSITION_ENABLED _DISSOLVE_TRANSITION_ENABLED + #pragma shader_feature_local _ALPHA_TRANSITION_MAP_MODE_2D _ALPHA_TRANSITION_MAP_MODE_2D_ARRAY _ALPHA_TRANSITION_MAP_MODE_3D + #pragma shader_feature_local _ _ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE _ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY + + // Emission + #pragma shader_feature_local _ _EMISSION_AREA_ALL _EMISSION_AREA_MAP _EMISSION_AREA_ALPHA + #pragma shader_feature_local _EMISSION_MAP_MODE_2D _EMISSION_MAP_MODE_2D_ARRAY _EMISSION_MAP_MODE_3D + #pragma shader_feature_local _ _EMISSION_COLOR_COLOR _EMISSION_COLOR_BASECOLOR _EMISSION_COLOR_MAP + + // Transparency + #pragma shader_feature_local_fragment _TRANSPARENCY_BY_LUMINANCE + #pragma shader_feature_local _TRANSPARENCY_BY_RIM + #pragma shader_feature_local _SOFT_PARTICLES_ENABLED + #pragma shader_feature_local _DEPTH_FADE_ENABLED + + // Vertex Deformation + #pragma shader_feature_local_vertex _ _VERTEX_DEFORMATION_ENABLED + + #include "ParticlesUberLitForward.hlsl" + ENDHLSL + } + } + CustomEditor "Nova.Editor.Core.Scripts.UIParticlesUberLitGUI" +} diff --git a/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberLit.shader.meta b/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberLit.shader.meta new file mode 100644 index 0000000..3e8aeeb --- /dev/null +++ b/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberLit.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 5befadde7f2b6a9498dd225c31369d75 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberUnlit.shader b/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberUnlit.shader new file mode 100644 index 0000000..86f824c --- /dev/null +++ b/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberUnlit.shader @@ -0,0 +1,258 @@ +Shader "Nova/UIParticles/UberUnlit" +{ + Properties + { + // Render Settings + _RenderType("Render Type", Float) = 2.0 + _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5 + _TransparentBlendMode("Blend Mode", Float) = 0.0 + _Cull("Cull", Float) = 2.0 + _QueueOffset("Queue Offset", Float) = 0.0 + _VertexAlphaMode("Vertex Alpha Mode", Float) = 0.0 + _BlendSrc("Blend Src", Float) = 1.0 + _BlendDst("Blend Dst", Float) = 0.0 + _ZWrite("ZWrite", Float) = 1.0 + _ZWriteOverride("ZWrite Override", Float) = -1.0 + _ZTest("ZTest", Float) = 4.0 + + // Base Map + _BaseMapMode("Base Map Mode", Float) = 0.0 + [MainTexture] _BaseMap("Base Map", 2D) = "white" {} + _BaseMap2DArray("Base Map 2D Array", 2DArray) = "" {} + _BaseMap3D("Base Map 3D", 3D) = "" {} + _BaseMapProgress("Base Map Progress", Range(0.0, 1.0)) = 0.0 + _BaseMapProgressCoord("Base Map Progress Coord", Float) = 0.0 + _BaseMapSliceCount("Base Map Slice Count", Float) = 4.0 + _BaseMapOffsetXCoord("Base Map Offset X Coord", Float) = 0.0 + _BaseMapOffsetYCoord("Base Map Offset Y Coord", Float) = 0.0 + _BaseMapRotation("Base Map Rotation", Range(0.0, 1.0)) = 0.0 + _BaseMapRotationCoord("Base Map Rotation Coord", Float) = 0.0 + _BaseMapRotationOffsets("Base Map Rotation Offsets", Vector) = (0.0, 0.0, 0.0, 0.0) + _BaseMapMirrorSampling("Base Map Mirror Sampling", Float) = 0.0 + + // Tint Color + _TintAreaMode("Tint Area Mode", Float) = 0.0 + _TintColorMode("Tint Color Mode", Float) = 0.0 + [HDR] _TintColor("Tint Color", Color) = (1, 1, 1, 1) + _TintMap("Tint Map", 2D) = "white" {} + _TintMap3D("Tint Map 3D", 3D) = "" {} + _TintMap3DProgress("Tint Map 3D Progress", Range(0, 1)) = 0.0 + _TintMap3DProgressCoord("Tint Map 3D Progress Coord", Float) = 0.0 + _TintMapSliceCount("Tint Map Slice Count", Float) = 4.0 + _TintMapOffsetXCoord("Tint Map Offset X Coord", Float) = 0.0 + _TintMapOffsetYCoord("Tint Map Offset Y Coord", Float) = 0.0 + _TintBlendRate("Tint Blend Rate", Range(0.0, 1.0)) = 1.0 + _TintBlendRateCoord("Tint Blend Rate Coord", Float) = 0.0 + _TintRimProgress("Tint Rim Progress", Range(0.0, 1.0)) = 0.5 + _TintRimProgressCoord("Tint Rim Progress Coord", Float) = 0.0 + _TintRimSharpness("Tint Rim Sharpness", Range(0.0, 1.0)) = 0.5 + _TintRimSharpnessCoord("Tint Rim Sharpness Coord", Float) = 0.0 + _InverseTintRim("Inverse Tint Rim", Float) = 0.0 + + // Flow Map + _FlowMap("Flow Map", 2D) = "grey" {} + _FlowMapOffsetXCoord("Flow Map Offset X Coord", Float) = 0.0 + _FlowMapOffsetYCoord("Flow Map Offset Y Coord", Float) = 0.0 + _FlowMapChannelsX("Flow Map Channes X", Float) = 0.0 + _FlowMapChannelsY("Flow Map Channes Y", Float) = 1.0 + _FlowIntensity("Flow Intensity", Float) = 1.0 + _FlowIntensityCoord("Flow Intensity Coord", Float) = 0.0 + _FlowMapTarget("Flow Map Target", Float) = 1.0 + + // Parallax Map + _ParallaxMapMode("Emission Map Mode", Float) = 0.0 + _ParallaxMap("Parallax Map", 2D) = "" {} + _ParallaxMap2DArray("Parallax Map 2D Array", 2DArray) = "" {} + _ParallaxMap3D("Parallax Map 3D", 3D) = "" {} + _ParallaxMapProgress("Parallax Map Progress", Range(0.0, 1.0)) = 0.0 + _ParallaxMapProgressCoord("Parallax Map Progress Coord", Float) = 0.0 + _ParallaxMapOffsetXCoord("Parallax Map Offset X Coord", Float) = 0.0 + _ParallaxMapOffsetYCoord("Parallax Map Offset Y Coord", Float) = 0.0 + _ParallaxMapChannel("Parallax Map Channel", Float) = 0.0 + _ParallaxMapSliceCount("Parallax Map Slice Count", Float) = 4.0 + _ParallaxStrength("Parallax Strength", Range(0.0, 1.0)) = 0.3 + _ParallaxMapTarget("Parallax Map Target", Float) = 1.0 + + // Color Correction + _ColorCorrectionMode("Alpha Transition Progress Coord", Float) = 0.0 + _GradientMap("Gradient Map", 2D) = "white" {} + + // Alpha Transition + _AlphaTransitionMode("Alpha Transition Mode", Float) = 0.0 + _AlphaTransitionMapMode("Alpha Transition Map Mode", Float) = 0.0 + _AlphaTransitionMap("Alpha Transition Map", 2D) = "white" {} + _AlphaTransitionMap2DArray("Alpha Transition Map 2D Array", 2DArray) = "" {} + _AlphaTransitionMap3D("Alpha Transition Map 3D", 3D) = "" {} + _AlphaTransitionMapProgress("Alpha Transition Map Progress", Range(0.0, 1.0)) = 0.0 + _AlphaTransitionMapProgressCoord("Alpha Transition Map Progress Coord", Float) = 0.0 + _AlphaTransitionMapOffsetXCoord("Alpha Transition Map Offset X Coord", Float) = 0.0 + _AlphaTransitionMapOffsetYCoord("Alpha Transition Map Offset Y Coord", Float) = 0.0 + _AlphaTransitionMapChannelsX("Alpha Transition Map Channes X", Float) = 0.0 + _AlphaTransitionMapSliceCount("Alpha Transition Map Slice Count", Float) = 4.0 + _AlphaTransitionProgress("Alpha Transition Progress", Range(0.0, 1.0)) = 0.0 + _AlphaTransitionProgressCoord("Alpha Transition Progress Coord", Float) = 0.0 + _DissolveSharpness("Dissolve Sharpness", Range(0.0, 1.0)) = 0.5 + _AlphaTransitionSecondTextureBlendMode("Alpha Transition Second Texture BlendMode", Float) = 0.0 + _AlphaTransitionMapSecondTexture("Alpha Transition Second Texture Map", 2D) = "white" {} + _AlphaTransitionMapSecondTexture2DArray("Alpha Transition Second Texture Map 2D Array", 2DArray) = "" {} + _AlphaTransitionMapSecondTexture3D("Alpha Transition Second Texture Map 3D", 3D) = "" {} + _AlphaTransitionMapSecondTextureProgress("Alpha Transition Map Second Texture Progress", Range(0.0, 1.0)) = 0.0 + _AlphaTransitionMapSecondTextureProgressCoord("Alpha Transition Map Second Texture Progress Coord", Float) = 0.0 + _AlphaTransitionMapSecondTextureOffsetXCoord("Alpha Transition Second Texture Map Offset X Coord", Float) = 0.0 + _AlphaTransitionMapSecondTextureOffsetYCoord("Alpha Transition Second Texture Map Offset Y Coord", Float) = 0.0 + _AlphaTransitionMapSecondTextureChannelsX("Alpha Transition Second Texture Map Channes X", Float) = 0.0 + _AlphaTransitionMapSecondTextureSliceCount("Alpha Transition Map Second Texture Slice Count", Float) = 4.0 + _AlphaTransitionProgressSecondTexture("Alpha Transition Second Texture Progress", Range(0.0, 1.0)) = 0.0 + _AlphaTransitionProgressCoordSecondTexture("Alpha Transition Second Texture Progress Coord", Float) = 0.0 + _DissolveSharpnessSecondTexture("Dissolve Sharpness", Range(0.0, 1.0)) = 0.5 + + // Emission + _EmissionAreaType("Emission Area Type", Float) = 0.0 + _EmissionMapMode("Emission Map Mode", Float) = 0.0 + _EmissionMap("Emission Map", 2D) = "black" {} + _EmissionMap2DArray("Emission Map 2D Array", 2DArray) = "" {} + _EmissionMap3D("Emission Map 3D", 3D) = "" {} + _EmissionMapProgress("Emission Map Progress", Range(0.0, 1.0)) = 0.0 + _EmissionMapProgressCoord("Emission Map Progress Coord", Float) = 0.0 + _EmissionMapOffsetXCoord("Emission Map Offset X Coord", Float) = 0.0 + _EmissionMapOffsetYCoord("Emission Map Offset Y Coord", Float) = 0.0 + _EmissionMapChannelsX("Emission Map Channels X", Float) = 0.0 + _EmissionMapSliceCount("Alpha Transition Map Slice Count", Float) = 4.0 + _EmissionColorType("Emission Color Type", Float) = 0.0 + [HDR]_EmissionColor("Emission Color", Color) = (0, 0, 0, 1) + _EmissionColorRamp("Emission Color Ramp", 2D) = "black" {} + _EmissionIntensity("Emission Intensity", Float) = 1.0 + _EmissionIntensityCoord("Emission Intensity Coord", Float) = 0.0 + _KeepEdgeTransparency("Keep Edge Transparency", Float) = 1.0 + + // Transparency + _RimTransparencyEnabled("Rim Transparency Enabled", Float) = 0.0 + _RimTransparencyProgress("Rim Transparency Progress", Range(0.0, 1.0)) = 0.5 + _RimTransparencyProgressCoord("Rim Transparency Progress Coord", Float) = 0.0 + _RimTransparencySharpness("Rim Transparency Sharpness", Range(0.0, 1.0)) = 0.5 + _RimTransparencySharpnessCoord("Rim Transparency Sharpness Coord", Float) = 0.0 + _InverseRimTransparency("Inverse Rim Transparency", Float) = 0.0 + _LuminanceTransparencyEnabled("Luminance Transparency Enabled", Float) = 0.0 + _LuminanceTransparencyProgress("Luminance Transparency Progress", Range(0.0, 1.0)) = 0.5 + _LuminanceTransparencyProgressCoord("Luminance Transparency Progress Coord", Float) = 0.0 + _LuminanceTransparencySharpness("Luminance Transparency Sharpness", Range(0.0, 1.0)) = 0.5 + _LuminanceTransparencySharpnessCoord("Luminance Transparency Sharpness Coord", Float) = 0.0 + _InverseLuminanceTransparency("Inverse Luminance Transparency", Float) = 0.0 + _SoftParticlesEnabled("Soft Particles Enabled", Float) = 0.0 + _SoftParticlesIntensity("Soft Particles Intensity", Float) = 1.0 + _DepthFadeEnabled("Depth Fade Enabled", Float) = 0.0 + _DepthFadeNear("Depth Fade Near", Float) = 1.0 + _DepthFadeFar("Depth Fade Far", Float) = 10.0 + _DepthFadeWidth("Depth Fade Width", Float) = 1.0 + + // Vertex Deformation + _VertexDeformationEnabled ("Vertex Deformation Enabled", Float) = 0 + _VertexDeformationMap ("Vertex Deformation Map", 2D) = "white" {} + _VertexDeformationMapOffsetXCoord("VertexDeformation Map Offset X Coord", Float) = 0.0 + _VertexDeformationMapOffsetYCoord("VertexDeformation Map Offset Y Coord", Float) = 0.0 + _VertexDeformationMapChannel("VertexDeformation Map Channel", Float) = 0.0 + _VertexDeformationIntensity("VertexDeformation Intensity", Float) = 0.1 + _VertexDeformationIntensityCoord("VertexDeformation Intensity Coord", Float) = 0.0 + + // Shadow Caster + _ShadowCasterEnabled("Shadow Caster", Float) = 0 + _ShadowCasterApplyVertexDeformation("Shadow Caster Vertex Deformation Enabled", Float) = 0 + _ShadowCasterAlphaTestEnabled("Shadow Caster Alpha Test Enabled", Float) = 0 + _ShadowCasterAlphaCutoff("Shadow Caster Alpha Test Cutoff", Range(0.0, 1.0)) = 0.5 + _ShadowCasterAlphaAffectedByTintColor("Shadow Caster Alpha Effect By Tint Color", Float) = 0 + _ShadowCasterAlphaAffectedByFlowMap("Shadow Caster Alpha Effect By Flow Map", Float) = 0 + _ShadowCasterAlphaAffectedByAlphaTransitionMap("Shadow Caster Alpha Effect By Alpha Transition Map", Float) = 0 + _ShadowCasterAlphaAffectedByTransparencyLuminance("Shadow Caster Alpha Effect By Transparency Luminance", Float) = 0 + } + + SubShader + { + Tags + { + "RenderType" = "Opaque" + "IgnoreProjector" = "True" + "PreviewType" = "Plane" + "PerformanceChecks" = "False" + "RenderPipeline" = "UniversalPipeline" + } + + Pass + { + Tags + { + "LightMode" = "UniversalForward" + } + Blend [_BlendSrc] [_BlendDst] + ZWrite[_ZWrite] + Cull[_Cull] + ColorMask RGB + Lighting Off + ZTest [_ZTest] + + HLSLPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 3.5 + + // Unity Defined + #pragma multi_compile_fog + #pragma multi_compile_instancing + #pragma multi_compile_fragment _ DEBUG_DISPLAY + #pragma instancing_options procedural:ParticleInstancingSetup + #pragma require 2darray + + // Render Settings + #pragma shader_feature_local_fragment _VERTEX_ALPHA_AS_TRANSITION_PROGRESS + #pragma shader_feature_local_fragment _ALPHAMODULATE_ENABLED + #pragma shader_feature_local_fragment _ALPHATEST_ENABLED + + // Base Map + #pragma shader_feature_local _BASE_MAP_MODE_2D _BASE_MAP_MODE_2D_ARRAY _BASE_MAP_MODE_3D + #pragma shader_feature_local_vertex _BASE_MAP_ROTATION_ENABLED + #pragma shader_feature_local_fragment _ _BASE_SAMPLER_STATE_POINT_MIRROR _BASE_SAMPLER_STATE_LINEAR_MIRROR _BASE_SAMPLER_STATE_TRILINEAR_MIRROR + + // Tint Color + #pragma shader_feature_local _ _TINT_AREA_ALL _TINT_AREA_RIM + #pragma shader_feature_local _ _TINT_COLOR_ENABLED _TINT_MAP_ENABLED _TINT_MAP_3D_ENABLED + + // Flow Map + #pragma shader_feature_local _FLOW_MAP_ENABLED // Obsolete, but retained for compatibility. + #pragma shader_feature_local _FLOW_MAP_TARGET_BASE + #pragma shader_feature_local _FLOW_MAP_TARGET_TINT + #pragma shader_feature_local _FLOW_MAP_TARGET_EMISSION + #pragma shader_feature_local _FLOW_MAP_TARGET_ALPHA_TRANSITION + + // Parallax Map + #pragma shader_feature_local _PARALLAX_MAP_TARGET_BASE + #pragma shader_feature_local _PARALLAX_MAP_TARGET_TINT + #pragma shader_feature_local _PARALLAX_MAP_TARGET_EMISSION + #pragma shader_feature_local _PARALLAX_MAP_MODE_2D _PARALLAX_MAP_MODE_2D_ARRAY _PARALLAX_MAP_MODE_3D + + // Color Correction + #pragma shader_feature_local_fragment _ _GREYSCALE_ENABLED _GRADIENT_MAP_ENABLED + + // Alpha Transition + #pragma shader_feature_local _ _FADE_TRANSITION_ENABLED _DISSOLVE_TRANSITION_ENABLED + #pragma shader_feature_local _ALPHA_TRANSITION_MAP_MODE_2D _ALPHA_TRANSITION_MAP_MODE_2D_ARRAY _ALPHA_TRANSITION_MAP_MODE_3D + #pragma shader_feature_local _ _ALPHA_TRANSITION_BLEND_SECOND_TEX_AVERAGE _ALPHA_TRANSITION_BLEND_SECOND_TEX_MULTIPLY + + // Emission + #pragma shader_feature_local _ _EMISSION_AREA_ALL _EMISSION_AREA_MAP _EMISSION_AREA_ALPHA + #pragma shader_feature_local _EMISSION_MAP_MODE_2D _EMISSION_MAP_MODE_2D_ARRAY _EMISSION_MAP_MODE_3D + #pragma shader_feature_local _ _EMISSION_COLOR_COLOR _EMISSION_COLOR_BASECOLOR _EMISSION_COLOR_MAP + + // Transparency + #pragma shader_feature_local _TRANSPARENCY_BY_LUMINANCE + #pragma shader_feature_local _TRANSPARENCY_BY_RIM + #pragma shader_feature_local _SOFT_PARTICLES_ENABLED + #pragma shader_feature_local _DEPTH_FADE_ENABLED + + // Vertex Deformation + #pragma shader_feature_local_vertex _ _VERTEX_DEFORMATION_ENABLED + + #include "ParticlesUberUnlitForward.hlsl" + ENDHLSL + } + } + CustomEditor "Nova.Editor.Core.Scripts.UIParticlesUberUnlitGUI" +} diff --git a/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberUnlit.shader.meta b/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberUnlit.shader.meta new file mode 100644 index 0000000..f7caddb --- /dev/null +++ b/Assets/Nova/Runtime/Core/Shaders/UIParticlesUberUnlit.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 72225468864e7e849bc3e630d1756259 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: